This document outlines the threat landscape targeting high-performance .NET applications (Game Backends/Real-Time APIs) and how RASP.Net mitigates specific attack vectors that traditional WAFs miss.
Perspective: Purple Team (Attacker-First Design validated against Defense constraints).
Scope: LibrarySystem.Api (Proxy for Game Inventory/Economy Service).
Security Level: Hardened (Zero-Trust).
Threat Actor: Malicious Player / Script Kiddie
Goal: Modify inventory state, duplicate items, or corrupt economy tables.
Method:
Attackers utilize grpcio-tools to bypass client-side validation and send raw Protobuf messages containing SQL payloads injected into string fields.
- Binary Obfuscation: Payloads are serialized in Protobuf. Standard WAFs often fail to decode deep nested binary fields in real-time.
- Encoding Evasion: Attackers use double-encoding or SQL comments (
/**/) that look like noise to network filters but are valid for the DB engine.
The Zero-Allocation Detection Engine intercepts the request after deserialization but before business logic execution.
- Detection:
SqlInjectionDetectionEngine.cs - Technique:
- Normalization:
StackAllocbuffer normalizes input (lowercasing, whitespace removal) without Heap Allocations. - Heuristics: Scans for token combinations (
union select,drop table) usingSpan<T>search. - Outcome: If
RiskScore >= 1.0, the request is blocked instantly inside the process memory.
- Normalization:
Threat Actor: Reverse Engineer / Cheat Developer Goal: Analyze memory layout, hook functions, or freeze threads to manipulate runtime variables (e.g., God Mode, Currency Freeze). Method: Attaching managed (Visual Studio) or native (x64dbg, Cheat Engine) debuggers to the running process.
The Native Integrity Guard serves as a sentinel for the process environment.
- Detection:
NativeGuard.cs(P/Invoke) ->Guard.cpp(Native Win32). - Technique: Checks PEB (Process Environment Block) and Debug Ports.
- Business Impact: Prevents development of "Trainers" and protect Game Economy integrity.
Threat Actor: Competitor / Griefer Goal: Degrade server performance (Lag Switching) by forcing Garbage Collection pauses. Method: Sending thousands of requests with large strings designed to trigger massive allocations during security analysis.
- Zero-Allocation Hot Path: Safe requests (99% of traffic) use cached results and
stackallocbuffers. - No
new String(): Analysis is performed onReadOnlySpan<char>views. - Target: Analysis overhead < 100ns per request (measured via BenchmarkDotNet).
| Threat Category | Attack Vector | RASP Mitigation | Status |
|---|---|---|---|
| Spoofing | Client Impersonation | gRPC Interceptor Auth Check | 🚧 Planned |
| Tampering | Protobuf Payload Injection | Deep Inspection (Pre-Execution) | ✅ Implemented |
| Repudiation | Action without trace | OpenTelemetry Tracing | ✅ Implemented |
| Information Disclosure | SQLi Data Exfiltration | Heuristic Blocking | ✅ Implemented |
| Denial of Service | GC Heap Exhaustion | Zero-Allocation Engine | ✅ Implemented |
| Elevation of Privilege | Runtime Memory Hooking | Native Integrity Guard | ✅ Implemented |
To validate the defense, we developed a Python exploit script mocking a compromised client.
Generating the gRPC stubs from the .proto definition:
python -m grpc_tools.protoc -I./protos --python_out=./attack --grpc_python_out=./attack library.protoThis script attempts to inject a SQL payload into the CreateBook method.
# Simplified snippet from attack/exploit_grpc.py
import grpc
import library_pb2_grpc as pb2_grpc
channel = grpc.insecure_channel('localhost:5001')
stub = pb2_grpc.LibraryStub(channel)
# Payload: Attempt to inject generic SQL logic
malicious_title = "' OR '1'='1"
try:
response = stub.CreateBook(library_pb2.CreateBookRequest(
title=malicious_title,
author="Hacker",
publication_year=2025
))
print(f"Server Response: {response}")
except grpc.RpcError as e:
print(f"Attack Blocked: {e.details()}")When the exploit runs, the RASP intercepts and blocks execution:
{
"timestamp": "2026-02-02T20:30:00Z",
"level": "Warning",
"message": "⚔️ RASP SQLi Blocked! Score: 1.5",
"data": {
"threat_type": "SQL Injection",
"score": 1.5,
"snippet": "' OR '1'='1"
}
}| Limitation | Risk | Current Mitigation | Future Enhancement | Risk Acceptance |
|---|---|---|---|---|
| Native DLL Unhooking | Attackers with kernel access could unload Rasp.Native.Guard.dll from process memory |
DLL signed with Authenticode | Self-checksum validation + heartbeat monitoring | |
| Time-Based Blind SQLi | Inference attacks via response time analysis | Blocked by keyword matching (SELECT, CASE) |
Random jitter injection in interceptor pipeline | |
| Polyglot Payloads | Context-aware exploits valid in multiple languages (SQL+NoSQL+OS) | Single-engine detection (SQL focus) | Multi-engine pipeline + ML anomaly detection | |
| NoSQL Injection | MongoDB/Cosmos DB query injection | Not currently covered | Phase 3: NoSQL detection engine | ❌ Not Implemented |
Legend:
- ✅ Fully Mitigated
⚠️ Partially Mitigated / Risk Accepted- ❌ Not Implemented