Trojan Source
A single U+202E RIGHT-TO-LEFT OVERRIDE inside a comment reverses how the rest of the line is displayed. An editor shows the reader one thing; the interpreter reads another. Boucher and Anderson showed in 2021 that the same trick can hide an early return or flip an access check in nearly every language and code review tool (CVE-2021-42574). disclude reports any bidirectional control character in source as critical, and the page shows it as a visible marker.
- Credit
- Nicholas Boucher and Ross Anderson, Trojan Source (2021)
- File
trojan_source.py(download)- Signals
- 1 critical · 0 warn · 0 info
- Disclude version
- 4.3.0
Source
Hidden characters are shown as ⟨U+…⟩. Each signal below links to its line.
# Trojan Source style comment — the next line looks innocent but contains a RLO. = # ⟨U+202E⟩ ;"admin" = level_access
Signals
Ordered by severity.
-
# Trojan Source style comment — the next line looks innocent but contains a RLO. = # ⟨U+202E⟩ ;"admin" = level_access
Reproduce
Download the file and scan it. Copying it from this page won't work: the hidden characters are shown as markers.