.Net: C#: Feature request: Memory poisoning defense (OWASP ASI06) for Semantic Kernel memory stores
Memory Poisoning Defense for Semantic Kernel Memory Stores (OWASP ASI06)
Hi Semantic Kernel team 👋
Following up on the Python issue filed earlier — wanted to also raise this for the C# SDK specifically, as Semantic Kernel's IMemoryStore and VectorStoreRecordCollection are widely used in enterprise .NET agentic applications.
ASI06 — Memory Poisoning (from the OWASP Top 10 for Agentic Applications 2025) describes how malicious content written to an agent's memory can persist across sessions and silently alter future behavior.
Reference Implementation
OWASP Agent Memory Guard is an official OWASP reference implementation (Python) that defines the scan-before-write pattern. The algorithm is directly portable to C#.
// Proposed C# interface
var guard = new MemoryGuard();
var result = await guard.ScanAsync(memoryContent);
if (result.IsSafe)
{
await memoryStore.UpsertAsync(collection, record);
}
Ask
Would the SK team be open to:
- A security note in the
IMemoryStore/VectorStoreRecordCollectiondocs about ASI06? - A
IMemoryFilterinterface for pluggable memory validation in the kernel pipeline?
Happy to draft a docs PR for the C# SDK.
One practical way to make this easier to evaluate is to turn the report into a small contract test around the runtime boundary, not only the user-facing symptom.
For memory poisoning defense for SK memory stores, I would check three things: first, the failing input is preserved as a minimal fixture; second, the SDK emits the same observable event/result shape before and after the fix except for the intended change; third, the trace or serialized session contains enough metadata to explain what happened after a resume or retry.
The part that matters for agent systems is durability: if a tool call, memory write, handoff, or structured-output step fails, downstream code should not have to infer state from natural-language output. A focused regression test around that boundary would make the issue much easier to close with confidence.