dotnet-security
Skill2 starsChanged 49 days agoMITView on GitHub
Audits ASP.NET Core / .NET Framework applications — Razor Html.Raw and Blazor MarkupString XSS, EF Core FromSqlRaw/SqlQueryRaw and Dapper/ADO string-concat SQL injection, BinaryFormatter/ObjectStateFormatter deserialization RCE, hardcoded machineKey → ViewState RCE, XXE via DtdProcessing.Parse, Newtonsoft TypeNameHandling polymorphic gadgets, AllowAnonymous on sensitive endpoints, antiforgery gaps, CORS AllowAnyOrigin+AllowCredentials, open redirect, Process.Start command injection, hardcoded connection strings, developer exception page in prod. Use when the project has .csproj, .sln, packages.lock.json, packages.config, or web.config.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- dprakash2101/dotnet-production-agent-skillstheir own version, first seen Sep 23, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- dprakash2101/dotnet-production-agent-skills★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- android-code-securitySkill
- auth-reviewSkill
- config-hardeningSkill
- container-iac-securitySkill
- course-platform-securitySkill
- crypto-reviewSkill
- cve-researchSkill
- data-exposureSkill
- dependency-vulnsSkill
- design-threat-reviewSkill
- django-securitySkill
- flow-securitySkill
- flutter-securitySkill
- graphql-securitySkill
- injection-flawsSkill
- laravel-securitySkill
- llm-securitySkill
- mobile-securitySkill
- rails-securitySkill
- secrets-detectionSkill
- security-auditSkill
- skill-forgeSkill
- spring-securitySkill
The file
Files
.NET Security (ASP.NET Core / .NET Framework)
Step 0 — Detect
rg --files -g '*.csproj' -g '*.sln' -g 'packages.lock.json' -g 'packages.config' -g 'web.config' -g 'appsettings*.json' | head -10
rg -n "Microsoft.AspNetCore|System.Web|TargetFramework" -g '*.csproj'Record: TargetFramework (netcoreapp/net5+ = ASP.NET Core; net4x = Web Forms/MVC5), template engine (Razor .cshtml, Blazor .razor, Web Forms .aspx), data access (EF Core, Dapper, ADO.NET). Check NuGet versions against ../cve-research/vuln-db/entries/.
Step 1 — Config & secrets
rg -n "Password=|password\"|machineKey|validationKey|UseDeveloperExceptionPage" -g 'appsettings*.json' -g '*.config' -g 'launchSettings.json' -g 'Program.cs' -g 'Startup.cs'- Connection strings with embedded passwords (
"Password=...") → Critical in public repos, High otherwise <machineKey validationKey="<literal>" decryptionKey="<literal>"/>in web.config → Critical: leaked/hardcoded machine key → forged__VIEWSTATE→ pre-auth RCE (KEV-class exploit chains).AutoGenerateis the safe formUseDeveloperExceptionPage()without environment guard, orASPNETCORE_ENVIRONMENT: Developmentcommitted → High (stacktrace + path leak)
Step 2 — Authorization & antiforgery
rg -n "AllowAnonymous|Authorize|ValidateAntiForgeryToken|IgnoreAntiforgery" -g '*.cs'
rg -n "AllowAnyOrigin|AllowCredentials|AddCors" -g '*.cs'[AllowAnonymous]on any action touching data, users, or admin ops → Critical (route-census discipline: disposition EVERY controller/action,../auth-review/SKILL.md§1)- Controller classes with role-sensitive ops and no
[Authorize]→ High (verify per-handler) - Cookie-auth POST actions without
[ValidateAntiForgeryToken]→ High (state change + CSRF) .AllowAnyOrigin()combined with.AllowCredentials()→ High (reflected-origin patterns)- Mass assignment: request-bound model assigning privilege fields (
user.Role = model.Role) → Critical (CWE-915; the Umbraco GHSL class)
Step 3 — SQL injection
rg -n "FromSqlRaw|SqlQueryRaw|ExecuteSqlRaw|\.Query\(|SqlCommand\(" -g '*.cs'- EF Core
FromSqlRaw($"... {user}")/ExecuteSqlRaw($"...")with interpolated strings → Critical. Near-miss:FromSqlInterpolated($"... {user}")is SAFE — the API parameterizes C# interpolation by design - Dapper
conn.Query("... " + user)or$"... {user}"→ Critical;conn.Query(sql, new { id })→ safe - ADO.NET
new SqlCommand("... " + user)→ Critical;Parameters.Add/SqlParameter→ safe
Step 4 — XSS / templates
rg -n "Html\.Raw|MarkupString|<%=" -g '*.cshtml' -g '*.razor' -g '*.aspx' -g '*.ascx'
rg -n "Mode=\"PassThrough\"|Literal" -g '*.aspx' -g '*.ascx' -g '*.cs'Census, don't sample: disposition every raw sink with privilege direction (../injection-flaws/SKILL.md XSS table).
- Razor
@Html.Raw(userContent)→ direction-triaged (plain@userauto-encodes ✓) - Blazor
@((MarkupString)userContent)→ direction-triaged - Web Forms
<%= user %>(raw) vs<%: user %>(encoded ✓);<asp:Literal Mode="PassThrough">→ unencoded
Step 5 — Deserialization & XML
rg -n "BinaryFormatter|ObjectStateFormatter|LosFormatter|NetDataContractSerializer|TypeNameHandling" -g '*.cs'
rg -n "DtdProcessing\.Parse|ProhibitDtd\s*=\s*false|XmlResolver" -g '*.cs'BinaryFormatter.Deserialize/ObjectStateFormatter/LosFormatter/NetDataContractSerializeron request/external data → Critical (gadget chains)- Newtonsoft
TypeNameHandling.All/Auto/Objectsenabled on request bodies → Critical (polymorphic gadgets; same class as Jackson defaultTyping).TypeNameHandling.Nonesafe XmlSerializerover type-controlled input → High; XXE:DtdProcessing.ParseorXmlResolvernon-null on untrusted XML → High
Step 6 — Files, commands, redirects
rg -n "Path\.Combine|PhysicalFile\(" -g '*.cs' | rg -i "request|query|param|route|input"
rg -n "Process\.Start|ProcessStartInfo" -g '*.cs'
rg -n "Redirect\(" -g '*.cs' | rg -i "request|query|param|url"Path.Combine(root, userInput)serving/reading files → traversal, HighProcess.Start/ProcessStartInfowith concatenated single-string args → High (argument injection;ArgumentListadditive form → safe)return Redirect(Request.Query["url"])unvalidated → open redirect, High;Url.IsLocalUrlallowlist check → safe
Reporting
Severity table above; fixes localized (bound params, @ encoding, [Authorize] per-route, AutoGenerate machineKey, JSON over BinaryFormatter). Cross-reference NuGet CVEs via ../cve-research/SKILL.md and dependency reachability via ../dependency-vulns/SKILL.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

