Security Audit Findings (SAST)
[!WARNING] Audit Status: Completed Scope: Static Code Analysis of
WepNG_MVCDate: 2026-01-09
Executive Summary
The audit identified High-Risk vulnerabilities in Authentication and Data Protection (GDPR), along with significant tech-debt related security flaws (XSS/CSRF).
| Risk Class | Finding | Severity | Status |
|---|---|---|---|
| GDPR | Cleartext Medical Data in Database | CRITICAL | 🔴 Confirmed |
| Auth | Legacy Login Backdoor (SQL Auth) | HIGH | 🔴 Confirmed |
| Config | debug="true" enabled in Production (BO) | HIGH | 🔴 Confirmed |
| Injection | SQL Injection in FinancialTransactionImporter | MEDIUM | 🟡 Confirmed |
| Web | Global XSS Protection Disabled | HIGH | 🔴 Confirmed |
| Web | Missing Anti-CSRF Tokens in BO POSTs | MEDIUM | 🔴 Confirmed |
Detailed Findings
1. GDPR: Cleartext Health Data
- Location:
EITWEP.EntityClasses.Customer.cs - Compliance Violation: GDPR Article 9 (Special Categories of Personal Data).
- Evidence: Properties
CUSTMedicalTreatmentDetail,CUSTAllergyDetail,CUSTDietDetailare standard strings with NO encryption attributes or getters/setters handling decryption. - Impact: Database compromise leads to direct exposure of sensitive minor's health data.
- Reach: Data is exposed in
_MedicalInfosSummary.cshtml(WepAccess/OMGT).
2. Auth: Legacy Login Bypass ("The Zombie Backdoor")
- Location:
WepNG_BO.Controllers.AccountController.cs(Line 186) - Vulnerability: The
LogOnPOST method checks legacyMembership.ValidateUserfirst before attempting Azure AD logic. - Scenario: An attacker (or former employee) with old SQL credentials can log in even if their Azure AD account is disabled, effectively bypassing SSO policies.
- Code Evidence:
if (Membership.ValidateUser(model.UserName, model.Password)) { ... SignInAsync ... }
3. Insecure Configuration
- Location:
WepNG_BO/Web.config - Setting:
<compilation debug="true" ... /> - Risk:
- Memory Overhead (High).
- Detailed Error Pages (Information Leakage).
- Code Optimization Disabled.
- Mitigation: Must be set to
falseinWeb.Release.config.
4. SQL Injection (Internal Tool)
- Location:
FinancialTransactionImporter.cs(Line 593) - Code:
string updateQuery = "UPDATE ... WHERE Date >= '" + removeFromDate.ToString(...) + "' ...";
this._dbContext.Database.ExecuteSqlCommand(updateQuery); - Analysis: While
removeFromDateis aDateTime(low risk of injection), the pattern of concatenating strings intoExecuteSqlCommandis dangerous and prevalent. - Good News:
WAStoredProcedure.cscorrectly uses@Parameters.
5. Global XSS Vulnerability
- Location:
WepNG_BO/Web.config - Setting:
<httpRuntime requestValidationMode="2.0" /> - Impact: Disables ASP.NET 4.0+ Request Validation.
- Aggravating Factor:
[ValidateInput(false)]found on multiple Controllers, allowing raw HTML submission without sanitization.
6. Missing CSRF Protection
- Location:
WepNG_BOControllers - Evidence: Grep scan for
[ValidateAntiForgeryToken]returned 0 results in BO controllers. - Impact: Attackers can trick authenticated admins into performing actions (e.g., creating users, changing statuses) without their consent via malicious links.
Recommendations
Immediate Actions (Quick Wins)
- Disable Legacy Auth: In
AccountController, wrapMembership.ValidateUserinif (ConfigurationManager.AppSettings["AllowLegacyAuth"] == "true"). Set tofalsein Prod. - Fix Web.config: Set
debug="false"andrequestValidationMode="4.5".
Strategic Actions (Roadmap)
- GDPR Remediation: Implement Column-Level Encryption (Always Encrypted in SQL Server or App-Level AES) for Medical/Diet fields.
- Security Sprint: Add
[ValidateAntiForgeryToken]to all POST actions in BO.