CVE-2021-42574
Description
Bidirectional control characters can reorder source code tokens, enabling invisible code injection by subverting human review.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Bidirectional control characters can reorder source code tokens, enabling invisible code injection by subverting human review.
Vulnerability
The Unicode Bidirectional Algorithm through version 14.0 permits the visual reordering of characters via control sequences, allowing source code to render differently than its logical token order [4]. This affects any compiler or interpreter that accepts Unicode source files, as the logical order ingested by parsers may differ from the visual order seen by human reviewers [2].
Exploitation
An attacker embeds Unicode bidirectional control characters (such as U+200E, U+200F, U+202A–U+202E) in source code to reorder tokens so that benign code appears visually, while malicious code is executed logically [1][2]. No special privileges are required; the attacker only needs to submit the crafted source code to a code repository or build system that accepts Unicode files. Human reviewers see the visual order and approve the code, but the compiler/interpreter processes the logical order, executing the injected payload.
Impact
Successful exploitation allows arbitrary code injection that bypasses code review. The attacker can introduce subtle vulnerabilities such as logic bombs, backdoors, or data exfiltration without detection [1][3]. The impact depends on the privileges of the process that compiles or interprets the code, potentially leading to full system compromise.
Mitigation
The Unicode Consortium provides mitigations in Unicode Technical Standard #39 (Unicode Security Mechanisms) and Unicode Standard Annex #31 (Unicode Identifier and Pattern Syntax) [1][3]. Specific recommendations include restricting allowed characters in source code, displaying control characters visibly, and using tools that detect or reject bidirectional override sequences [2]. The issue is inherent to the Unicode standard; no single patch exists. Software vendors should implement input validation and user notification for bidirectional control characters.
AI Insight generated on May 27, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
102- The Unicode Consortium/Unicode Specificationdescription
- Range: all versions
- Range: <=14.0
- osv-coords99 versionspkg:rpm/almalinux/annobinpkg:rpm/almalinux/annobin-annocheckpkg:rpm/almalinux/binutils-develpkg:rpm/almalinux/cargopkg:rpm/almalinux/cargo-docpkg:rpm/almalinux/clangpkg:rpm/almalinux/clang-analyzerpkg:rpm/almalinux/clang-develpkg:rpm/almalinux/clang-libspkg:rpm/almalinux/clang-resource-filesystempkg:rpm/almalinux/clang-tools-extrapkg:rpm/almalinux/clippypkg:rpm/almalinux/compiler-rtpkg:rpm/almalinux/cpppkg:rpm/almalinux/gccpkg:rpm/almalinux/gcc-c%2B%2Bpkg:rpm/almalinux/gcc-gdb-pluginpkg:rpm/almalinux/gcc-gfortranpkg:rpm/almalinux/gcc-offload-nvptxpkg:rpm/almalinux/gcc-plugin-develpkg:rpm/almalinux/gcc-toolset-10-annobinpkg:rpm/almalinux/gcc-toolset-10-binutilspkg:rpm/almalinux/gcc-toolset-10-binutils-develpkg:rpm/almalinux/gcc-toolset-10-gccpkg:rpm/almalinux/gcc-toolset-10-gcc-c%2B%2Bpkg:rpm/almalinux/gcc-toolset-10-gcc-gdb-pluginpkg:rpm/almalinux/gcc-toolset-10-gcc-gfortranpkg:rpm/almalinux/gcc-toolset-10-gcc-plugin-develpkg:rpm/almalinux/gcc-toolset-10-libasan-develpkg:rpm/almalinux/gcc-toolset-10-libatomic-develpkg:rpm/almalinux/gcc-toolset-10-libitm-develpkg:rpm/almalinux/gcc-toolset-10-liblsan-develpkg:rpm/almalinux/gcc-toolset-10-libquadmath-develpkg:rpm/almalinux/gcc-toolset-10-libstdc%2B%2B-develpkg:rpm/almalinux/gcc-toolset-10-libstdc%2B%2B-docspkg:rpm/almalinux/gcc-toolset-10-libtsan-develpkg:rpm/almalinux/gcc-toolset-10-libubsan-develpkg:rpm/almalinux/gcc-toolset-11-annobin-annocheckpkg:rpm/almalinux/gcc-toolset-11-annobin-docspkg:rpm/almalinux/gcc-toolset-11-annobin-plugin-gccpkg:rpm/almalinux/gcc-toolset-11-binutilspkg:rpm/almalinux/gcc-toolset-11-binutils-develpkg:rpm/almalinux/gcc-toolset-11-gccpkg:rpm/almalinux/gcc-toolset-11-gcc-c%2B%2Bpkg:rpm/almalinux/gcc-toolset-11-gcc-gdb-pluginpkg:rpm/almalinux/gcc-toolset-11-gcc-gfortranpkg:rpm/almalinux/gcc-toolset-11-gcc-plugin-develpkg:rpm/almalinux/gcc-toolset-11-libasan-develpkg:rpm/almalinux/gcc-toolset-11-libatomic-develpkg:rpm/almalinux/gcc-toolset-11-libgccjitpkg:rpm/almalinux/gcc-toolset-11-libgccjit-develpkg:rpm/almalinux/gcc-toolset-11-libgccjit-docspkg:rpm/almalinux/gcc-toolset-11-libitm-develpkg:rpm/almalinux/gcc-toolset-11-liblsan-develpkg:rpm/almalinux/gcc-toolset-11-libquadmath-develpkg:rpm/almalinux/gcc-toolset-11-libstdc%2B%2B-develpkg:rpm/almalinux/gcc-toolset-11-libstdc%2B%2B-docspkg:rpm/almalinux/gcc-toolset-11-libtsan-develpkg:rpm/almalinux/gcc-toolset-11-libubsan-develpkg:rpm/almalinux/git-clang-formatpkg:rpm/almalinux/libasan6pkg:rpm/almalinux/libitm-develpkg:rpm/almalinux/libomppkg:rpm/almalinux/libomp-develpkg:rpm/almalinux/libomp-testpkg:rpm/almalinux/libquadmath-develpkg:rpm/almalinux/libstdc%2B%2B-develpkg:rpm/almalinux/libstdc%2B%2B-docspkg:rpm/almalinux/libstdc%2B%2B-staticpkg:rpm/almalinux/lldpkg:rpm/almalinux/lldbpkg:rpm/almalinux/lldb-develpkg:rpm/almalinux/lld-develpkg:rpm/almalinux/lld-libspkg:rpm/almalinux/lld-testpkg:rpm/almalinux/llvmpkg:rpm/almalinux/llvm-develpkg:rpm/almalinux/llvm-docpkg:rpm/almalinux/llvm-googletestpkg:rpm/almalinux/llvm-libspkg:rpm/almalinux/llvm-staticpkg:rpm/almalinux/llvm-testpkg:rpm/almalinux/llvm-toolsetpkg:rpm/almalinux/python3-clangpkg:rpm/almalinux/python3-litpkg:rpm/almalinux/python3-lldbpkg:rpm/almalinux/rlspkg:rpm/almalinux/rustpkg:rpm/almalinux/rust-analysispkg:rpm/almalinux/rust-debugger-commonpkg:rpm/almalinux/rust-docpkg:rpm/almalinux/rustfmtpkg:rpm/almalinux/rust-gdbpkg:rpm/almalinux/rust-lldbpkg:rpm/almalinux/rust-srcpkg:rpm/almalinux/rust-std-staticpkg:rpm/almalinux/rust-std-static-wasm32-unknown-unknownpkg:rpm/almalinux/rust-toolsetpkg:rpm/opensuse/rust1.56&distro=openSUSE%20Tumbleweed
< 9.72-1.el8_5.2+ 98 more
- (no CPE)range: < 9.72-1.el8_5.2
- (no CPE)range: < 9.72-1.el8_5.2
- (no CPE)range: < 2.30-108.el8_5.1
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 9.29-1.el8_5.2
- (no CPE)range: < 2.35-8.el8_5.6
- (no CPE)range: < 2.35-8.el8_5.6
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 9.85-1.el8_5.1
- (no CPE)range: < 9.85-1.el8_5.1
- (no CPE)range: < 9.85-1.el8_5.1
- (no CPE)range: < 2.36.1-1.el8_5.1
- (no CPE)range: < 2.36.1-1.el8_5.1
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 11.2.1-1.2.el8_5
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 10.3.1-1.2.el8_5
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 8.5.0-4.el8_5.alma
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-2.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-4.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 12.0.1-1.module_el8.4.0+2600+cefb5d4c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-3.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.54.0-1.module_el8.5.0+2599+d655d86c
- (no CPE)range: < 1.56.1-1.1
Patches
0No patches discovered yet.
Vulnerability mechanics
Root cause
"The Unicode Bidirectional Algorithm permits invisible control sequences that visually reorder characters, enabling source code to display different logic than the logical token order consumed by compilers and interpreters."
Attack vector
An attacker embeds invisible bidirectional override codepoints (e.g., U+202E, U+2066, U+2069) into source code. These codepoints cause bidirectional-aware editors and code review tools to visually reorder characters, making the displayed logic differ from the logical token order the compiler processes [ref_id=1]. A human reviewer sees one condition (e.g., a harmless string comparison) while the compiler executes a different one, allowing the attacker to hide malicious logic. The attack requires the victim to use a tool that renders the bidirectional control sequences and to not have separate out-of-band checks for the codepoints.
Affected code
The vulnerability is in the Unicode Bidirectional Algorithm specification (through version 14.0) and affects any compiler or interpreter that accepts Unicode source code. The Rust compiler (rustc) versions 1.0.0 through 1.56.0 are cited as an affected implementation that lacked lints to detect the dangerous codepoints [ref_id=1].
What the fix does
The Rust Security Response WG introduced two new lints in Rust 1.56.1 that detect and reject source code containing the affected bidirectional override codepoints [ref_id=1]. This prevents the compiler from processing files that contain the dangerous control sequences, eliminating the discrepancy between what a reviewer sees and what the compiler interprets. The Unicode Consortium separately provides guidance in Unicode Technical Standard #39 and Unicode Standard Annex #31 for mitigating this class of issue.
Preconditions
- configThe victim must use a code editor, review tool, or terminal that renders Unicode bidirectional override codepoints (e.g., U+202E, U+2066, U+2069).
- configThe compiler or interpreter must accept Unicode source code without rejecting the dangerous codepoints (e.g., Rust 1.0.0 through 1.56.0).
- inputThe attacker must be able to contribute or inject source code that the victim will review and compile.
Generated on May 30, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
18- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IH2RG5YTR6ZZOLUV3EUPZEIJR7XHJLVD/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LQNTFF24ROHLVPLUOEISBN3F7QM27L4U/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/QUPA37D57VPTDLSXOOGF4UXUEADOC4PQ/mitrevendor-advisory
- security.gentoo.org/glsa/202210-09mitrevendor-advisory
- www.kb.cert.org/vuls/id/999008mitrethird-party-advisory
- www.openwall.com/lists/oss-security/2021/11/01/1mitremailing-list
- www.openwall.com/lists/oss-security/2021/11/01/4mitremailing-list
- www.openwall.com/lists/oss-security/2021/11/01/5mitremailing-list
- www.openwall.com/lists/oss-security/2021/11/01/6mitremailing-list
- www.openwall.com/lists/oss-security/2021/11/02/10mitremailing-list
- www.unicode.org/versions/Unicode14.0.0/mitre
- trojansource.codesmitre
- www.scyon.nl/post/trojans-in-your-source-codemitre
- www.starwindsoftware.com/security/sw-20220804-0002/mitre
- www.unicode.org/reports/tr31/mitre
- www.unicode.org/reports/tr36/mitre
- www.unicode.org/reports/tr39/mitre
- www.unicode.org/reports/tr9/tr9-44.htmlmitre
News mentions
0No linked articles in our index yet.