Overview
Organizations depend on mature C/C++ systems, yet a single memory error can expose data or give an attacker control. Rewriting these systems is still extremely costly, and patching cannot keep pace with every vulnerability as AI accelerates exploitation. PTSan adds protection through recompilation, helping secure existing code before individual bugs are found and fixed.
Earlier research systems have demonstrated compiler-enforced memory safety, but high overhead and compatibility restrictions have limited practical use. PTSan brings together robust protection, compatibility with complex applications, and low overhead in an LLVM sanitizer pass. This combination depend on analyses and optimizations we developed to eliminate unnecessary checks and repeated work while preserving protection. Fully open source and ready to use, PTSan lets you retain your existing code, with Aarno Labs available to support integration and further optimization for your workload. The design, security analysis, and evaluation are described in our PTSan paper.
Memory safety with a recompilation
Add protection to mature C/C++ software through your build. Keep your existing source code and avoid the cost and disruption of a rewrite.
Recover from memory violations
In the context of our DRIFT system, recovery mechanisms connect PTSan to existing application error handling, allowing bad inputs to be rejected without a separate patch for every vulnerability.
Compatibility and performance
Keep familiar LLVM build workflows and existing C/C++ applications. Choose the lower-overhead configuration that fits your workload, with targeted optimization available for demanding deployments.
Protection against AI-assisted Attacks
We gave an AI agent known vulnerabilities in Redis, rsync, and ImageMagick and asked it to exploit each application, first without PTSan and then with it. The agent was OpenAI's GPT-5.6 Sol (gpt-5.6-sol), accessed through OpenAI's Daybreak Blue program and run in the Codex agent. It had full knowledge of PTSan and the protected application's binary.
The goal started as remote code execution on every target. The agent achieved it quickly against unprotected Redis. For rsync and ImageMagick, remote code execution proved too hard to reach, so we lowered the bar to the step such an exploit depends on: an out-of-bounds write that corrupts another allocation. With PTSan enabled on those two applications, the goal was simply to get that overflow past PTSan. The agent quickly reached its goal on every unprotected application and reached none of them with PTSan enabled.
Each PTSan run continued until the agent exhausted its allotted budget. The protection did not depend on hiding PTSan's design or keeping the application binary secret. PTSan stopped the memory operations the attacks needed, giving defenders a practical way to raise the cost of exploiting legacy code.
Leading Results in DARPA Evaluations
PTSan was developed under DARPA's E-BOSS program, as part of Aarno Labs' DRIFT project. E-BOSS challenged teams to detect and remediate vulnerabilities in deployed software, focusing on the build system. Independent evaluators tested whether defenses stopped attacks while preserving normal application behavior. PTSan helped our team deliver leading results.
PTSan captured and remediated all evaluated vulnerabilities in E-BOSS Evaluation-2 in the shortest amount of time.
At the April 2026 E-BOSS hackathon, Aarno's PTSan-based automated workflow remediated more vulnerabilities than any other participating team.
DRIFT Demo: Block Attacks and Keep Running
See PTSan in action within DRIFT, Aarno Labs' integrated workflow for assessing and responding to software vulnerabilities. The demonstration follows a vulnerability from disclosure through reachability analysis, attack validation, and automated recovery. Watch PTSan block an attack, then see DRIFT connect that protection to the application's existing error handling. The protected application rejects the malicious input, keeps running, and successfully processes valid requests. These recovery hooks avoid the need to develop a separate fix for each underlying vulnerability.
Performance and Compatibility
PTSan delivers the lowest average overhead when compared to published memory-safety sanitizers with similarly strong safety guarantees. ID16 generally delivers lower overhead when the application's live allocations fit within its roughly 65,000-ID budget. ID32 handles much larger workloads, trading additional pointer-decoding work for billions of available IDs.
| Benchmark suite | Strict ID16 | Strict ID32 |
|---|---|---|
| LLVM MultiSource | 26.63%127 timed workloads | 31.13%144 timed workloads |
| SPEC CPU2017 | 71.31%9 timed workloads | 80.18%14 timed workloads |
| Fleetbench | 21.61%8 timed workloads | 58.38%17 timed workloads |
Geometric-mean runtime overhead. Each mode covers a different set of completed workloads.
Broad C/C++ compatibility
PTSan supports the vast majority of C/C++ semantics and has been demonstrated on large, real-world workloads chosen by independent evaluation teams. ID32 has handled 22.3 million live allocations without exhausting its ID budget.
A modest memory footprint
ID32's median added peak physical memory was 4.66 MiB on SPEC, 1.53 MiB on MultiSource, and 11.59 MiB on Fleetbench. Geometric-mean peak-memory ratios were 1.13×, 2.05×, and 1.18× native, respectively.
Cut overhead further with workload-specific optimization.
PTSan's LLVM analyses automatically reduce redundant checks and pointer conversions. Aarno Labs can go further with customized analysis of the code that dominates your application's runtime. For loops that account for much of the overhead, we use CodeHawk to verify that a set of entry conditions implies memory safety for the accesses whose checks we remove. Runtime guards test those conditions before entering the specialized loop. When they hold, the loop runs without those repeated checks; otherwise, the fully checked version runs. This connects the performance improvement to a verified safety argument. For example, on SPEC's 544.nab_r molecular simulation benchmark, this approach cut PTSan's overhead from about 80% to 18%, removing 77% of the added runtime.
Deployment
PTSan fits into your existing build process. Deployment centers on rebuilding your code and libraries, selecting the right pointer representation, and deciding how the application should respond to a violation.
- Choose ID16 or ID32. ID16 normally offers lower overhead when peak live allocations fit within roughly 65,000 IDs. Use ID32 for workloads that need greater allocation capacity.
- Rebuild the application and all its libraries with PTSan's LLVM toolchain. Use a consistent PTSan configuration for your source, third-party dependencies, and C/C++ runtime libraries, then validate the rebuilt system with representative inputs.
- Set a recovery policy. Decide whether a violation should stop or restart the service, or connect PTSan to existing error handling so the application can reject a bad input and continue.
- Optimize the workflows that matter most. Measure performance on your real workloads. Aarno Labs can use profiling, CodeHawk analysis, and specialized compiler optimizations to reduce overhead in the code that dominates runtime.
PTSan is fully open source. The build and dependency guide covers the toolchain and library setup; the repository includes the license inventory.
Memory Safety Modernization Services
Aarno Labs helps teams modernize the memory safety of existing systems. We combine PTSan with source and binary analysis, targeted patching, testing, and migration to memory-safe languages. The starting point is your exposure, compatibility requirements, and operating budget.
Integration and qualification
Build a compatible toolchain and dependency set, review native interfaces and allocation behavior, and validate protection against representative workloads.
Workload-specific optimization
Measure hot paths and apply customized analysis, guard specialization, and compiler optimization to reduce PTSan's runtime cost.
Transition support
Design deployment, monitoring, and recovery around your application. Combine runtime protection with a practical plan for longer-term modernization.
Start with an application and a performance budget.
Tell us what the system does, which platforms and libraries it relies on, and what latency or throughput it needs to maintain. We can help determine where PTSan fits and what it will take to deploy it.