NemesisShield 0.1.4

dotnet add package NemesisShield --version 0.1.4
                    
NuGet\Install-Package NemesisShield -Version 0.1.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NemesisShield" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NemesisShield" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="NemesisShield" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NemesisShield --version 0.1.4
                    
#r "nuget: NemesisShield, 0.1.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NemesisShield@0.1.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NemesisShield&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=NemesisShield&version=0.1.4
                    
Install as a Cake Tool

Nemesis Shield - .NET / C#

Native .NET SDK for Nemesis Shield. Learns your app's normal behavior; in enforce mode BLOCKS off-baseline requests (auth bypass, BOLA, path traversal, scanners, unusual methods) before your endpoints run. Positive-security, fail-open, privacy-preserving.

Targets net8.0 (modern ASP.NET Core) and netstandard2.0 (.NET Framework 4.6.1+, .NET 6/7/8, .NET Core) - the mix an enterprise/bank estate needs. The trained ML model ships inside the assembly.

Install

dotnet add package NemesisShield

ASP.NET Core - register the middleware first in the pipeline so it inspects every request (including paths that match no endpoint), then set NEMESIS_TOKEN:

var app = builder.Build();
app.UseMiddleware<NemesisShield.SentinelMiddleware>();   // BEFORE UseRouting / endpoints - sees all traffic
// ... app.UseRouting(); app.MapControllers(); etc.

Self-hosted / on-prem / air-gapped Shield? Point the SDK at your own endpoint with the NEMESIS_ENDPOINT environment variable (defaults to the Nemesis Shield cloud).

Observe (default) → learn & approve behaviors in the console → flip to enforce (the SDK polls the policy in the background, no redeploy) → off-baseline requests get 403 blocked_by_nemesis_shield. Verified end-to-end (learn → enforce → attack) on ASP.NET Core: legit passes (200); auth bypass, BOLA, path traversal and scanner probes blocked (403) and reported.

LLM Guard (OWASP LLM Top 10)

The same HashLR ML classifier every Nemesis Shield SDK ships - catches obfuscated prompt injection signature rules miss, scored identically in every language. LlmGuard and the trained ml_weights.json are included in the package (embedded - no extra setup).

using NemesisShield;

var v = LlmGuard.GuardLLM(userPrompt, enforce: true);
if (v.Blocked) {
    // refuse - v.Kind, v.Score, v.Owasp ("LLM01")
}

double score = LlmGuard.MlInjectionScore(userPrompt); // 0..1

Regex first, then ML. Blocks at ≥ 0.85 (high), flags at ≥ 0.45.

Central model updates (hot-swap)

The HashLR model can be retrained and pushed centrally, so SDKs pick up a new version without a redeploy:

// Pull the latest signed model (defaults to env NEMESIS_MODEL_URL). Returns the new version, or null
// if nothing newer / rejected. Fail-safe: the embedded model is kept on any error.
int? v = LlmGuard.RefreshModel("https://shield.nemesislabs.xyz/api/v1/model/injection");
int current = LlmGuard.ModelVersion();

Bundles are Ed25519-signed; a pinned public key verifies the exact bytes before the swap, so unsigned or tampered bundles are rejected. Signature verification uses BouncyCastle (.NET has no built-in Ed25519 on net8), so add the package to your project:

dotnet add package BouncyCastle.Cryptography

Run RefreshModel on startup and/or on a timer (e.g. hourly). The feature space (dim) is fixed across versions; only weights, bias and thresholds swap.

Full coverage & safe-unlock

Mount it first / outermost so every route is inspected (not just API routes - attackers hit any path):

app.UseMiddleware<NemesisShield.SentinelMiddleware>();   // BEFORE UseStaticFiles / UseRouting

What's inspected (privacy-preserving): method + normalized route + query-param structure (names + kinds, never values) + auth flag + status. An off-baseline route, param structure, method, or auth state is blocked in enforce mode. Path-traversal segments normalize to {traversal}.

Safe-unlock (break-glass): the login/auth path is never blocked, so a still-learning baseline can't lock you out. Defaults: /login /signin /sign-in /auth /oauth /session /wp-login.php /wp-admin. Override:

export NEMESIS_SHIELD_BOOTSTRAP="/login,/admin,/healthz"

Verify coverage - in observe mode, hit a normal route, a param, and a scanner path, then confirm all three appear in the console (Activity / Behaviors):

curl -s "http://localhost:8080/" >/dev/null
curl -s "http://localhost:8080/search?q=shoes" >/dev/null
curl -s "http://localhost:8080/.env" >/dev/null   # shows up as an off-baseline behavior
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.4 87 8/10/2026
0.1.3 102 8/3/2026
0.1.2 114 8/2/2026
0.1.1 104 7/31/2026