Skip to main content

attackmap-analyzer-dotnet

C# / .NET (ASP.NET Core) ecosystem analyzer for AttackMap.

This analyzer extracts structured signals from .NET solutions and projects:

  • Web frameworks — ASP.NET Core minimal APIs (app.MapGet, app.MapPost, app.MapMethods, nested MapGroup prefixes), attribute routing on controllers ([HttpGet], [HttpPost], [Route], [AcceptVerbs], with class-level [Route] prefix joining and [controller]/[action]/[area] token substitution), MapHub<T>, MapControllerRoute, Razor Pages @page; MapGrpcService<T> as a protocol hint
  • Databases — Entity Framework Core (UseSqlServer / UseNpgsql / UseMySql / UseSqlite), Dapper, System.Data.SqlClient / Microsoft.Data.SqlClient, Npgsql, MySql.Data / MySqlConnector, MongoDB.Driver, StackExchange.Redis, AWS SDK (S3, DynamoDB)
  • Auth packages — AddJwtBearer (Microsoft.AspNetCore.Authentication.JwtBearer), AddOpenIdConnect, ASP.NET Identity (UserManager, SignInManager, IdentityUser, PasswordHasher), per-route [Authorize] / [AllowAnonymous] / .RequireAuthorization() / .AllowAnonymous(), Duende IdentityServer, BCrypt.Net, Argon2
  • HTTP clients (external calls) — HttpClient.GetAsync / PostAsync / SendAsync, HttpRequestMessage, RestClient (RestSharp), new Uri(...)
  • Secrets — Environment.GetEnvironmentVariable("..."), IConfiguration["..."] / Configuration["..."] / builder.Configuration["..."] with secret-shaped keys, literal Password= in appsettings*.json ConnectionStrings
  • Service hints — <RootNamespace> and <AssemblyName> from .csproj

All emissions populate AttackMap's Signal v2 fields (line numbers, evidence snippets, confidence scores) so downstream insights can cite path/to/file.cs:NN.

Install

uv tool install attackmap --with attackmap-analyzer-dotnet    # from PyPI
# or: pip install attackmap-analyzer-dotnet    (installs attackmap too)
# or from source:
pip install git+https://github.com/mlaify/attackmap-analyzer-dotnet.git

The analyzer is auto-discovered by AttackMap via the attackmap.analyzers entry-point group.

Usage with AttackMap

# Auto-discovered when installed:
attackmap analyze /path/to/dotnet/repo

# Or invoke explicitly:
attackmap analyze /path/to/dotnet/repo --module dotnet

Detection

detect() returns true when any of the following are present, ignoring bin/, obj/, .vs/, .idea/, .git/, node_modules/, packages/, TestResults/, and publish/:

  • A .csproj, .fsproj, or .sln file anywhere in the tree
  • A .cs file anywhere in the tree

Coverage notes

  • Route templates follow ASP.NET semantics: a controller annotated with [Route("api/[controller]")] causes its [HttpGet("{id:int}", Name = "GetUser")] action to emit as /api/Orders/{id:int}. An action template starting with / or ~/ is absolute and replaces the controller prefix. [controller] (class name minus Controller), [action] (method name minus Async) and [area] ([Area("...")]) are substituted case-insensitively. A class prefix applies only inside that class's body. Every emitted path starts with /.
  • Minimal API groups: var api = app.MapGroup("/api"); var v2 = api.MapGroup("/v2"); v2.MapGet("/orders/{id}", ...) emits /api/v2/orders/{id}. Inline chains (app.MapGroup("/x").MapGet("/y", ...)) work too. A group built in another file or by a custom extension method isn't followed.
  • Per-route auth: each route's effective state is computed. [AllowAnonymous] (attribute) or .AllowAnonymous() (minimal API, on the endpoint or any enclosing group) wins over [Authorize] / .RequireAuthorization(), as in ASP.NET. An authorization fallback policy, or MapControllers().RequireAuthorization(), makes unmarked routes require auth. A route that requires auth gets an aspnet_authorize:<METHOD> <path> auth hint on its own line; an explicitly anonymous route gets an aspnet_allow_anonymous:<METHOD> <path> entrypoint hint and no auth hint. Core attributes auth hints to routes by a ±40-line window until Route carries an auth field (mlaify/AttackMap#256), so in a compact controller a neighbor's hint can still show up on an anonymous route. [Authorize] inherited from a base controller class isn't followed.
  • Connection strings: GetConnectionString("DefaultConnection") names a connection string, so it isn't reported as a secret. A literal Password=/Pwd= inside an appsettings*.json ConnectionStrings entry is reported as connection_string_password (kind="config_literal"); the evidence names the entry, never the value.
  • F# (.fs) projects are detected via .fsproj but route extraction is not yet implemented (Giraffe / Saturn).
  • Razor Pages: @page in a .cshtml file emits an ANY route from the file's path under Pages/ (or Areas/<Area>/Pages/), with Index mapped to its folder and an optional @page "template" appended (or used as-is when it starts with /). Page auth conventions (AuthorizeFolder, [Authorize] on the PageModel) aren't read yet. Blazor .razor components aren't covered.

License

MIT

Metadata

Release files for attackmap-analyzer-dotnet 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for attackmap-analyzer-dotnet 0.2.1
File Size Uploaded Provenance Actions
attackmap_analyzer_dotnet-0.2.1.tar.gz 29.5 kB With provenance Details for attackmap_analyzer_dotnet-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for attackmap-analyzer-dotnet 0.2.1
File Interpreter ABI Platform Actions
attackmap_analyzer_dotnet-0.2.1-py3-none-any.whl Python 3 none any Details for attackmap_analyzer_dotnet-0.2.1-py3-none-any.whl

Total release size: 52.6 kB

Release files / attackmap_analyzer_dotnet-0.2.1.tar.gz

Download URL attackmap_analyzer_dotnet-0.2.1.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8e20777d63228cc1f7631952a9ff4abd2af3cd41d40be82f04c353f4dbfc6ff8
BLAKE2b-256 checksum
How to use checksums
5e5edfb730877f408705a2ef815fe8e41d0a1b421bf95afabc7dc97937cb61fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / attackmap_analyzer_dotnet-0.2.1-py3-none-any.whl

Download URL attackmap_analyzer_dotnet-0.2.1-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cfe3f9858b6a1fcfc14a025b322010a3be7233ee7d0f6643acbecbb2a661e97
BLAKE2b-256 checksum
How to use checksums
5ee819288243ae8e5427207c0eaa78eefb9826df246974d19229dd9e1ca03711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for attackmap-analyzer-dotnet 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for attackmap_analyzer_dotnet-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page