Python: Feature request: Memory poisoning defense (OWASP ASI06) integration

Open
#14,011 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python
Domain
ai, security

Research direction

Start by reviewing the ISemanticTextMemory adapter and the kernel memory pipeline mentioned in the proposal, then examine how Semantic Kernel currently handles persistent memory. Determine whether the integration should be an adapter, middleware hook, documentation guidance, or a combination, and define completion criteria for memory validation, integrity checks, policy handling, and rollback.

Written by the indexing model from the issue text.

Description

python triage

Summary

OWASP recently published the Top 10 for Agentic Applications, which includes ASI06: Memory Poisoning — a threat category specific to AI agents that persist memory across sessions.

As Semantic Kernel adds more persistent memory and agent loop capabilities, it would be valuable to have a built-in or recommended defense layer for this attack surface.

The threat

When an agent stores information in memory (conversation history, retrieved facts, tool outputs, scratchpads), a malicious actor can craft inputs that get stored as "trusted" memories. Those poisoned memories then influence the agent's future behavior — causing it to leak data, take unauthorized actions, or be persistently manipulated across sessions.

This is distinct from prompt injection (which targets user input at the front of the loop) — memory poisoning targets the memory store itself.

Proposed integration

The OWASP reference implementation for ASI06 is agent-memory-guard (MIT/Apache-2.0 licensed, pure Python, zero external dependencies):

pip install agent-memory-guard

It provides:

  • Runtime memory validation (prompt injection, secret leakage, protected-key tampering)
    • Cryptographic integrity verification (SHA-256 baselines)
      • Declarative YAML policy engine
        • Point-in-time snapshots and rollback
          • Drop-in middleware for common memory backends
            Suggested integration points for Semantic Kernel:
  1. A MemoryGuard-wrapped ISemanticTextMemory adapter
    1. Optional middleware hook in the kernel's memory pipeline
    1. Documentation guidance on memory security best practices per OWASP ASI06

References

Dominant language
C#
Stars
28.8k
Forks
4.9k
Avg merge
2d 17h
Merged PRs (30d)
48

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/semantic-kernel

All issues in microsoft/semantic-kernel

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.