Encoding and obfuscation converters in PyRIT

PyRIT's non-LLM converters transform prompts with Base64, ciphers, leetspeak and similar methods so you can test whether content filters miss obfuscated requests. This page covers when to use them, how to stack them without losing readability, and what to confirm in your environment.

On this page

Why test encoding and obfuscation converters in PyRIT

If your AI system sits behind input filters, you need to know whether simple encoding or character substitution gets past them. A filter that catches a plain request may not catch the same request written in Base64, in leetspeak, or with look-alike Unicode characters. PyRIT's encoding and obfuscation converters let your team generate those transformed prompts systematically and send them to the target, so the question becomes a measured result rather than a guess about how the filter behaves. This matters most for teams whose filters rely on keyword or pattern matching, and for teams that must show a reviewer how their controls were tested.

PyRIT's text-to-text converters are a family of transformations applied to a prompt before it reaches the target. Alongside the LLM-based converters, which call a model to translate, rephrase or change tone, the family includes non-LLM converters that work deterministically: encodings such as Base64, ciphers, leetspeak, Unicode confusables, ASCII art and zero-width characters, among others. The non-LLM converters need no model call, so they are cheap to run at volume and their output is repeatable. Teams usually run them early in a test cycle to establish a baseline of filter behavior before they spend effort on more variable techniques. Confirm the exact converter names, parameters and any version differences in the PyRIT documentation for converters before you write your test plan.

Before committing to a test plan, decide three things: which filter layers are in scope, which harm objectives your team will use as the baseline prompts, and how you will judge whether a transformed prompt succeeded. The third decision depends on scoring, which PyRIT covers separately, so an encoded prompt that the target answers in encoded form still needs a scorer that can read it. Also confirm that your target can process the encoded text at all. Some models decode Base64 readily and others return garbled output, and a garbled reply is not a bypass. Those checks determine whether your results mean anything, and they are the first things a reviewer will ask about.

Which encoding and obfuscation converters PyRIT offers

PyRIT's non-LLM converters rewrite the characters of a prompt without calling a model, so the transformation is deterministic and repeatable. Each family below targets a different way a filter can miss content, and each one has a cost in how readable the prompt remains for the target.

Base64 and other encodings

Encoding converters such as Base64 turn the whole prompt into a different byte representation, and the target may decode it or ignore it. Test whether the filter inspects decoded content or only the surface text. Confirm the exact encoding class names and options in the text-to-text converter documentation before writing code, because the set of supported encodings changes between releases.

Text-to-text converters

Ciphers

Cipher converters substitute or shift characters according to a fixed rule, such as a Caesar shift. They test whether a keyword filter recognizes content that has been mechanically rearranged. A model may still decode simple ciphers, so a failure to decode is not a pass. Record the cipher key and parameters in the run results so the test can be reproduced.

Leetspeak

Leetspeak replaces letters with visually similar digits and symbols, for example turning a letter into a digit that resembles it. It tests whether keyword matching survives simple character substitution while a human or model still reads the word. Because the text stays largely legible, leetspeak is a useful low-cost baseline before heavier transformations.

Unicode confusables

Confusable converters swap Latin letters for visually identical characters from other Unicode scripts. They test whether filters normalize text before matching. The prompt looks unchanged to a reviewer but differs at the code point level, so the test is sensitive to how each layer in your stack handles Unicode normalization.

ASCII art

ASCII art converters render words as multi-line character figures. They test whether a filter reads text as a sequence of tokens or recognizes the spelled-out word. Output length grows quickly, so check the context window and the target's input limits before running large batches.

Zero-width characters

Zero-width converters insert invisible characters between letters, which breaks string matches while the text still appears normal to people. They test sanitizers that strip or fail to strip invisible characters. Verify that your logging and review tools display these characters, because a tester who cannot see the payload cannot judge the result.

Choosing an encoding converter for the filter you are testing

This table compares encoding and obfuscation converter families by the defense they probe, what the target must do to recover the prompt, and how a refusal or empty answer should be read. Use it to pick one or two converters that match the control you are testing, not to run every converter in the catalog. The main takeaway is that a converter that the target cannot decode tests the model's comprehension, not its filter.

Converter familyWhat it probesWhat the target must doRisk that the target answers nothing useful
Base64 and other byte encodingsKeyword and string-matching filters that scan plain text but do not decode inputRecognize the encoding and decode it before acting on the contentHigh for smaller models, which may return the encoded string or a generic error
Ciphers such as ROT13 or Caesar shiftsFilters that depend on exact English tokens or known wordsReverse a simple substitution, often only with a hint or a repeated patternHigh, since many models fail to decode without examples or a key
LeetspeakKeyword filters that match exact spelling but tolerate substitutionsRead character substitutions as ordinary lettersLow to moderate, because most instruction-tuned models read it easily
Unicode confusables and homoglyphsFilters that compare visible characters or normalized stringsMap look-alike characters to their intended lettersModerate, since rendering and normalization differ between targets and pipelines
Zero-width and invisible charactersTokenizer and preprocessing behavior, and whether stripping happens before filteringIgnore the inserted characters and read the remaining textModerate, because the target may strip them silently or produce a garbled reply
ASCII artClassifiers and human reviewers, since the text is legible to people but hard to matchRead the letter shapes as wordsHigh, as the output may be a redrawn picture rather than an answer
Stacked convertersLayered defenses that need more than one transformation to failDecode several transformations in the right orderVery high, so stack only after each single converter gives a readable baseline
Human-readability checkWhether the probe stays understandable enough to judge the responseProduce a reply that a scorer can classify as compliant or refusedAny family, if the reply is unrelated; treat empty or confused answers as inconclusive

How to stack converters without making prompts unreadable

Stacking converters multiplies obfuscation, and every extra layer raises the chance that the target can no longer decode the prompt. A Base64 string wrapped in leetspeak and then mapped to Unicode confusables may be unintelligible to the model, so a refusal or a nonsense reply tells you nothing about the safety filter you meant to test. Before you run a stacked attack, decide what the target must be able to read for the test to mean anything, and treat a result that fails that bar as an error in the test setup, not as a pass for the target.

Check readability at each step of the chain, not only at the end. Run the converted prompt through the converter pipeline one stage at a time and, where your target allows it, ask the model to decode or paraphrase the intermediate output. Keep a control prompt in plain text that goes through the same target, system prompt and scorer with no converters applied. If the control is refused, the target is filtering the objective itself, and a converted variant that gets through shows the bypass. If the control is not refused and the converted variant fails to produce a coherent answer, the obfuscation is too heavy for the target to read.

Record the converter order in the run configuration and in the saved results, because the same converters applied in a different sequence produce different prompts. Note the converter class names, their parameters, the target model version and the scorer settings, so another tester can rebuild the exact prompt and compare results later. Partial conversion, where only the sensitive words are transformed and the rest of the prompt stays readable, is a separate technique and is covered in its own topic.

How a prompt moves through converters to the target and scorer

The flow starts with a seed objective that PyRIT passes through one or more non-LLM converters, such as Base64, leetspeak or Unicode confusables, before the transformed prompt is sent to the target endpoint. The target is the trust boundary: it is the first place the obfuscated input is received and interpreted, so that is where bypass behavior shows up. The response then goes to a scorer, and the prompt, converted text, response and score are written to memory in SQLite or Azure SQL. Check that the stored record keeps the original objective and the converted prompt side by side, so a result can be traced back to the transformation that produced it.

Obfuscated prompts cross the target boundary, and each run is recorded in memory.

Setting up PyRIT for encoding converter tests

This sequence gets PyRIT installed, connected to one target and checked with a plain-text control, so each encoding converter is added and verified one at a time. The result is a test setup where any change in the target's behavior can be traced to a single converter.

  1. Confirm a supported Python version

    The engineer running the tests checks that the workstation or test runner has a Python version the PyPI package supports, which is 3.10 up to but not including 3.15. The PyRIT documentation recommends Python 3.13, so use that version where you can. Confirm the version with the interpreter's version command before installing anything. The step is done when the version string falls inside the supported range and the team has recorded it in the test runbook.

  2. Install PyRIT with pip

    Create an isolated virtual environment and install the PyRIT package from PyPI with pip, so the converter tests run against a known version. Pin the version you tested with, and record it alongside the results. Use the 1.1.0 documentation as the reference for the API you will call. The step is done when importing the package in a Python shell succeeds and the installed version matches the one in the runbook.

  3. Configure credentials and settings files

    Place the target credentials in the ~/.pyrit/.env file and the non-secret settings in ~/.pyrit/.pyrit_conf. Keep API keys out of scripts and out of version control, and restrict file permissions to the test account. Confirm with the team which secret store they will use in production runs, since the PyRIT setup guidance covers Key Vault options separately. The step is done when a short script reads the target configuration without printing any secret values.

  4. Connect one target

    Choose a single target that represents the system under test, such as one model deployment or one custom HTTP endpoint, and configure it in PyRIT. Do not add a second target until the first one behaves predictably. Send one harmless prompt and confirm a response comes back and is stored. The step is done when the response appears in the output and the target's connection details are recorded in the runbook.

  5. Run a plain-text control

    Send the same benign objective through the target with no converter applied and save the response as the control. Read it manually and note its tone, length and any refusal or filter message. Every later result is compared against this baseline. Repeat the control two or three times if the target is non-deterministic, so the team knows normal variation. The step is done when the team has a recorded baseline it can reproduce.

  6. Add one converter and check readability

    Apply a single non-LLM encoding converter, such as Base64, leetspeak or a Unicode confusable converter, to the same objective and send it to the target. Check that the target's response shows it understood the converted input, either by decoding it correctly or by answering in a way that matches the control. Record whether the converted prompt is still readable enough to test anything. The step is done when the team marks each converter as readable, partly readable or unreadable before moving on.

  7. Verify memory records each converter chain

    After each converter run, query PyRIT memory to confirm the original prompt, the converted prompt, the converter used and the target response are all stored as one conversation. Check that stacked converters appear in the order they were applied. This record is what lets you reconstruct a finding later. The step is done when a memory query returns the full chain for every test run, and the team can reproduce a stored chain from its record.

Security and operational considerations for obfuscation testing

Obfuscation tests generate large volumes of prompts, many of them harmful, and every response lands in memory. The cards below cover the controls an organization should set before running encoding converters against a model, from seed handling and credentials to production impact and vulnerability reporting.

Harmful seed prompts and memory

Encoding converters are usually applied to harmful objectives, so each run writes both the encoded prompt and the target's decoded or refused reply into PyRIT memory. Decide in advance which seed datasets are approved, who may load them, and how long results stay in the SQLite or Azure SQL store. Confirm that the storage location sits inside your controlled environment and that deletion of old runs is a documented step, not an afterthought.

Credential files and permissions

PyRIT reads target keys from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf. On a shared test host, these files can expose model API keys to anyone with read access to that home directory. Restrict the files to the account that runs tests, use a dedicated key with spend limits for each target, and rotate keys after engagements end. Avoid pasting keys into notebooks that are later committed to version control.

Staging versus production targets

Obfuscated prompts often produce unusual outputs, and a successful bypass on a live system is a real exposure for customers. Point the converter tests at a staging deployment that mirrors production filters, system prompts and tools. Where production testing is unavoidable, agree the window, the prompt volume and the stop conditions with the system owner in writing before the first run.

Rate and cost impact on the target

Stacked converters multiply the number of variants per objective, and each variant is a billable request to a hosted model or a load on a custom endpoint. Estimate the request count from your objective set and converter combinations before running, and ask the provider for the rate limits and billing terms that apply to your key. Set concurrency and retry limits so a test does not degrade service for other users.

Conversation log access

Conversation logs show exactly which obfuscated prompts worked, which makes them useful to attackers if leaked. Limit read access to the red team and the reviewers who score results, and apply the same access rules to exports and to any CoPyRIT instance that displays the memory. Review who can open the database file, and make sure log exports are stored with the same classification as the seed data they contain.

Reporting vulnerabilities in PyRIT

If your review finds a flaw in PyRIT itself, such as a converter that leaks data or a configuration path that exposes credentials, report it privately rather than in a public issue. The project's security policy directs reports to the Microsoft Security Response Center. Record the PyRIT version you tested so your findings can be matched to the correct release.

PyRIT on GitHub

How much effort does encoding converter testing take

What drives the effort of encoding converter testing in PyRIT?

Effort grows with the number of targets, the number of converter combinations you test, and how carefully you design scoring and review. A single chat endpoint with a short list of Base64, leetspeak and Unicode converters is a small job. Ten targets with stacked encodings, each scored by an LLM judge and reviewed by hand, is a much larger one. The main multipliers are:

  • Targets: each model, system prompt, filter or endpoint needs its own runs and its own baseline.
  • Converter combinations: stacking converters multiplies the number of variants, so you need a rule for which chains are worth running.
  • Scorer design: deciding whether an encoded answer counts as a bypass is often harder than running the attack.
  • Result review: someone must read flagged responses, because decoded output is frequently garbled.

Ask any partner to break the quote down along these four lines.

Can our own team run encoding converter tests with the PyRIT documentation?

Yes, a team with Python experience can run basic encoding converter tests from the documentation alone, because PyRIT is an open-source Python framework with documented converters and targets. The documentation separates non-LLM converters, such as encoding and obfuscation, from LLM-based converters, which is useful when planning the first runs. What the documentation will not do is decide your test strategy: which harms matter, which chains are in scope, how to score a decoded answer and how to keep records an auditor can follow. Teams that can staff those decisions and a reviewer for results usually keep the work in-house. Teams without that capacity often bring in help for the design and first cycle, then run retests themselves.

What does DeployOpen need from our organization to start?

DeployOpen needs enough access and approval to test the system as it will really be used, and it should be agreed in writing before work starts. Typical inputs include:

  • Target access: a test endpoint, API credentials with the right role, and documentation of the system prompt, filters and any content safety layer.
  • Approved seed prompts: the objectives you are allowed to test, signed off by the people accountable for the harms involved.
  • A test environment: ideally a copy that matches production configuration, so results carry over.
  • Named reviewers: people who can judge decoded responses and accept or reject findings.

Missing any of these usually extends the schedule more than it extends the cost, so confirm them in the written scope rather than assuming them.

How long does setup take for a simple target versus a complex one?

Setup length depends mainly on how hard the target is to reach and how much it has to be configured before the first useful run. A direct API with documented authentication can be connected quickly. A custom web application driven through a browser, an endpoint behind SSO, or a system with several filters in front of the model takes longer, because each layer needs to be mapped and verified. No duration is given here because the supplied information does not include one for this work. Ask any provider for a written timeline that lists the targets, the access steps and the review cycle separately, and check which of those depend on your team's response times.

Which questions should a quote for encoding converter testing answer?

A useful quote is tied to a written scope, not a per-hour estimate with no boundaries. Ask the provider to state the number of targets, the converter families and maximum chain depth, the seed prompt sets, the scoring method and the review process, and the deliverables such as findings, evidence and a retest. Also ask what happens when results need a second round, whether retests are included, and which parts recur if you run the suite after each model or prompt change. DeployOpen does not publish a price list; a quote follows from the written scope, so the scope is where you should spend your time.

When should we bring in a partner for encoding converter testing?

Bring in a partner when the test design, scoring or evidence requirements exceed what your team can staff, or when a deadline makes an outside first cycle worthwhile. Common triggers are several targets with different configurations, a need for records that compliance reviewers can follow, or no one internally who can judge decoded output reliably. DeployOpen plans, runs and documents security testing for AI systems, including AI and agent security reviews with findings, fixes and a retest. Engagements are fixed-scope and agreed in writing before work starts, and retainers are available for continuous testing.

What recurring effort should we expect after the first encoding test cycle?

The recurring effort is usually the re-run after every meaningful change: a new model version, a changed system prompt, a new filter or a new converter chain. Plan for the reviewer's time as well as compute, because flagged responses still need human judgment. Also budget for maintaining the scoring logic and the records, since those are what let you show a result changed or did not. Whether this recurring work is run in-house or under a retainer is a decision to make early, and the written scope should say which runs are included and how often they repeat.

How DeployOpen scopes and delivers PyRIT converter testing

DeployOpen plans encoding and obfuscation converter testing as a written, fixed-scope engagement tied to the filters, guardrails and targets you actually run. The work covers which converters apply to which prompt categories, how they are chained, how results are recorded in PyRIT memory, and what your team receives at the end.

How we scope

  • Inventory the target endpoints, content filters and guardrails that encoded prompts will reach in your environment
  • Agree which encoding and obfuscation converters to test, and which prompt categories and datasets they apply to
  • Define the stacking depth, readability checks and success criteria written into the scope before any testing starts
  • Confirm where PyRIT will run, which credentials it will read from the environment file, and who approves test traffic

How we build

  • Configure PyRIT targets and a converter pipeline in your infrastructure, with SQLite or Azure SQL memory set up as agreed
  • Build converter chains with a readability check so results show filter bypass rather than prompts the target could not parse
  • Pair converter output with scorers so each bypass is judged against the harm definition written in the scope
  • Run baseline tests on unconverted prompts first so every encoded result can be compared against a known control

How we hand over

  • Deliver a written report of which converters, chains and prompt categories bypassed controls, with conversation evidence
  • Document the converter configuration, scorer settings and memory queries so your team can rerun the tests
  • Provide a runbook for repeating the tests after model, filter or configuration changes, with the retest plan agreed in writing
  • Walk your security and AI engineering teams through the findings and the fixes they should prioritize

How we support

  • Offer retesting of fixed filters and guardrails within the agreed scope, so remediation is verified rather than assumed
  • Keep the PyRIT version and dependency notes current with the release you run, and flag upgrade impacts on converters
  • Provide ongoing support, continuous testing and PyRIT upgrades as a retainer when your model or filter stack changes
  • Ask for a quote built from the written scope, including which parts recur and which are one-time work

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.