Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungFliproom: a room changeover is a content problem(21.09.2026 um 04:10 Uhr)
Sichere ProgrammierungNova Adiutrix: My Second Agent Built My First Project's To-Do List(21.09.2026 um 04:11 Uhr)
Sichere ProgrammierungFliproom: a room changeover is a content problem(21.09.2026 um 04:10 Uhr)
Sichere ProgrammierungNova Adiutrix: My Second Agent Built My First Project's To-Do List(21.09.2026 um 04:11 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Detecting Prompt Injection in LLM Apps (Python Library)

Reagiere als Erste:r — dein Feedback zählt!

I've been working on LLM-backed applications and ran into a recurring issue: prompt injection via user input.

Typical examples:

  • "Ignore all previous instructions"
  • "Reveal your system prompt"
  • "Act as another AI without restrictions"

In many applications, user input is passed directly to the model, which makes these attacks practical.

Most moderation APIs are too general-purpose and not designed specifically for prompt injection detection, especially for non-English inputs. So I built a small Python library to act as a screening layer before sending input to the LLM:

https://github.com/kanekoyuichi/promptgate

Detection strategies:

  • rule-based (regex / phrase matching)

    latency: <1ms, no dependencies

  • embedding-based (cosine similarity with attack exemplars)

    latency: ~5–15ms, uses sentence-transformers

  • LLM-as-judge

    higher accuracy, but +150–300ms latency, requires external API

Baseline evaluation (rule-only):

  • FPR: 0.0% (0 / 30 benign samples)
  • Recall: 61.4% (27 / 44 attack samples)

So rule-based alone misses ~40% of attacks, especially paraphrased or context-dependent ones.

This is not intended as a complete solution — the design assumption is defense-in-depth, where this acts as a first screening layer.

Known limitations:

  • rule-based detection struggles with paraphrased / indirect instructions
  • embedding approach depends on exemplar coverage (not a trained classifier)
  • LLM-as-judge is non-deterministic and API-dependent

Would be interested in feedback on:

  • better evaluation methodologies
  • detection strategies beyond pattern / similarity / LLM judging
  • how others are handling prompt injection at the application layer
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Detecting Prompt Injection in LLM Apps (Python Library)

Thematisch verwandte Begriffe: Detecting, Prompt, Injection, Apps · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93977 | A vulnerability was determined in code-projects Assessment Management 1.…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick