Skip to content

FEAT: Add a converter for indirect prompt injection via hidden HTML/Markdown text #2780

Description

@shashank03-dev

Summary

I would like to add a new text-to-text converter, HiddenTextConverter, that embeds
the input prompt as hidden or de-emphasized text inside an HTML or Markdown carrier.

Motivation

PyRIT already has the XPIA workflow for indirect prompt injection, but there is no
converter that produces a hidden payload for it to deliver. Systems that summarize or
act on external content (web pages, documents, emails) read the raw source, so text can
be present in the source while staying invisible to a human reviewer. A model that parses
that source may still read and follow it.

This is the same idea as the existing AnsiAttackConverter (terminal escape sequences) and
TransparencyAttackConverter (image layers), applied to HTML and Markdown documents. The
hiding methods are documented injection vectors from the WASP web-agent security benchmark
(arXiv:2504.18575).

Proposed behavior

The converter takes a prompt and wraps it using a chosen technique:

  • html_comment
  • css_display_none
  • css_offscreen
  • html_alt_text
  • aria_label
  • markdown_comment
  • markdown_link_title

An optional carrier_text places the hidden payload inside normal looking content. The
converter only formats the text it is given and does not generate any attack content on
its own. Input is escaped so the payload cannot break out of the surrounding markup.

Scope

  • New converter in pyrit/converter with SUPPORTED_INPUT_TYPES and SUPPORTED_OUTPUT_TYPES of text
  • Unit tests for each technique, escaping, carrier text, and input validation
  • Reference added to doc/references.bib
  • Intended for use as a request converter with the XPIA workflow

I have a working implementation and would like to take this issue if it fits the project's plans.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions