CVE-2021-42574

HIGH LAB

Unicode < 14.0.0 - Code Injection via Bidirectional Algorithm Control Sequences

Title source: llm
STIX 2.1

Exploitation Summary

EIP tracks 8 public exploits for CVE-2021-42574. PoCs published by simplylu, maweil, tin-z.

AI-analyzed exploit summary This repository provides a tool to generate malicious code using the Trojan Source vulnerability (CVE-2021-42574), which exploits Unicode bidirectional control characters to visually reorder source code. The tool can encode and decode files with these characters, demonstrating how adversaries can hide malicious logic from human reviewers.

Description

An issue was discovered in the Bidirectional Algorithm in the Unicode Specification through 14.0. It permits the visual reordering of characters via control sequences, which can be used to craft source code that renders different logic than the logical ordering of tokens ingested by compilers and interpreters. Adversaries can leverage this to encode source code for compilers accepting Unicode such that targeted vulnerabilities are introduced invisibly to human reviewers. NOTE: the Unicode Consortium offers the following alternative approach to presenting this concern. An issue is noted in the nature of international text that can affect applications that implement support for The Unicode Standard and the Unicode Bidirectional Algorithm (all versions). Due to text display behavior when text includes left-to-right and right-to-left characters, the visual order of tokens may be different from their logical order. Additionally, control characters needed to fully support the requirements of bidirectional text can further obfuscate the logical order of tokens. Unless mitigated, an adversary could craft source code such that the ordering of tokens perceived by human reviewers does not match what will be processed by a compiler/interpreter/etc. The Unicode Consortium has documented this class of vulnerability in its document, Unicode Technical Report #36, Unicode Security Considerations. The Unicode Consortium also provides guidance on mitigations for this class of issues in Unicode Technical Standard #39, Unicode Security Mechanisms, and in Unicode Standard Annex #31, Unicode Identifier and Pattern Syntax. Also, the BIDI specification allows applications to tailor the implementation in ways that can mitigate misleading visual reordering in program text; see HL4 in Unicode Standard Annex #9, Unicode Bidirectional Algorithm.

Exploits (8)

nomisec WORKING POC 8 stars
by simplylu · poc
https://github.com/simplylu/CVE-2021-42574

This repository provides a tool to generate malicious code using the Trojan Source vulnerability (CVE-2021-42574), which exploits Unicode bidirectional control characters to visually reorder source code. The tool can encode and decode files with these characters, demonstrating how adversaries can hide malicious logic from human reviewers.

Classification
Working Poc 95%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: Compilers and interpreters accepting Unicode (e.g., C, C++, C#, Go, Java, JavaScript, Nim, Rust)
No auth needed
Prerequisites: Access to a compiler/interpreter vulnerable to Unicode bidirectional control character manipulation
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec SCANNER 6 stars
by maweil · poc
https://github.com/maweil/bidi_char_detector

This repository provides a Rust-based tool to detect Unicode BIDI characters in files, which can be exploited for supply chain attacks as described in CVE-2021-42574. It includes a Docker container for easy deployment and configuration options for file scanning.

Classification
Scanner 100%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: Files containing Unicode BIDI characters
No auth needed
Prerequisites: Access to the target files or directory
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 3 stars
by tin-z · poc
https://github.com/tin-z/solidity_CVE-2021-42574-POC

This PoC demonstrates CVE-2021-42574, a trojan source vulnerability in Solidity where Unicode control characters (RLO_i) manipulate code interpretation, causing hidden logic execution. The exploit generates a Solidity contract with deceptive comments that appear benign but compile malicious logic.

Classification
Working Poc 95%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: Solidity compiler (solc) versions prior to 0.8.17
No auth needed
Prerequisites: Solidity compiler (solc) or solcjs · Foundry for testing
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 1 stars
by waseeld · poc
https://github.com/waseeld/CVE-2021-42574

This PoC demonstrates CVE-2021-42574, a Trojan Source vulnerability in Rust (pre-1.56.0) using bidirectional Unicode characters to alter code logic during compilation. The example shows how hidden control characters can change conditional logic to bypass access checks.

Classification
Working Poc 90%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: Rust compiler (rustc) versions < 1.56.0
No auth needed
Prerequisites: Target uses a vulnerable Rust compiler version · Ability to inject or modify source code
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WRITEUP 1 stars
by hffaust · poc
https://github.com/hffaust/CVE-2021-42574_and_CVE-2021-42694

This repository contains a README file referencing CVE-2021-42574 and CVE-2021-42694 but lacks any exploit code or technical details. It appears to be a placeholder or informational writeup.

Classification
Writeup 90%
Attack Type
Other
Complexity
Trivial
Reliability
Theoretical
Target: unknown
No auth needed
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec WORKING POC 1 stars
by shiomiyan · poc
https://github.com/shiomiyan/CVE-2021-42574

This PoC demonstrates a Unicode-based authentication bypass vulnerability (CVE-2021-42574) by exploiting bidirectional override characters to manipulate string comparison logic. The Rust code shows how an attacker could bypass access control checks by crafting a malicious string that appears as 'user' but contains hidden Unicode characters.

Classification
Working Poc 90%
Attack Type
Auth Bypass
Complexity
Trivial
Reliability
Reliable
Target: Applications using Unicode string comparisons for authentication (specific software not specified)
No auth needed
Prerequisites: Target application must perform insecure Unicode string comparisons for authentication
devstral-2 · analyzed Feb 16, 2026 Full analysis →
nomisec SCANNER
by Moshe-ship · poc
https://github.com/Moshe-ship/bidi-guard

This repository provides a tool called 'bidi-guard' that scans code for invisible bidirectional Unicode characters, which can be used in Trojan Source attacks (CVE-2021-42574). It includes functionality to detect, explain, and remove such characters, as well as integrate with CI pipelines and pre-commit hooks.

Classification
Scanner 95%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: Any source code containing bidirectional Unicode characters
No auth needed
Prerequisites: Source code files to scan
devstral-2 · analyzed Mar 21, 2026 Full analysis →
nomisec SCANNER
by pierDipi · poc
https://github.com/pierDipi/unicode-control-characters-action

This repository provides a GitHub Action and Python script to detect Unicode control characters, specifically targeting CVE-2021-42574 (Trojan Source attacks). It scans source files for bidirectional or non-printable Unicode characters that could be used to manipulate code interpretation.

Classification
Scanner 95%
Attack Type
Other
Complexity
Moderate
Reliability
Reliable
Target: Source code files (any language)
No auth needed
Prerequisites: Access to source code repository · Python environment
devstral-2 · analyzed Feb 16, 2026 Full analysis →

References (18)

Core 18
Core References
Exploit, Mailing List, Mitigation, Third Party Advisory mailing-list
http://www.openwall.com/lists/oss-security/2021/11/01/1
Exploit, Mailing List, Third Party Advisory mailing-list
http://www.openwall.com/lists/oss-security/2021/11/01/4
Mailing List, Third Party Advisory mailing-list
http://www.openwall.com/lists/oss-security/2021/11/01/6
Mailing List, Third Party Advisory mailing-list
http://www.openwall.com/lists/oss-security/2021/11/01/5
Third Party Advisory, US Government Resource third-party-advisory
https://www.kb.cert.org/vuls/id/999008
Third Party Advisory vendor-advisory
https://security.gentoo.org/glsa/202210-09
Release Notes, Vendor Advisory
http://www.unicode.org/versions/Unicode14.0.0/
Exploit, Technical Description, Third Party Advisory
https://trojansource.codes
Exploit, Mitigation, Third Party Advisory
https://www.scyon.nl/post/trojans-in-your-source-code
Technical Description, Vendor Advisory
https://www.unicode.org/reports/tr31/
Technical Description, Vendor Advisory
https://www.unicode.org/reports/tr36/
Technical Description, Vendor Advisory
https://www.unicode.org/reports/tr39/
Technical Description, Vendor Advisory
https://www.unicode.org/reports/tr9/tr9-44.html#HL4

Scores

CVSS v3 8.3
EPSS 0.1221
EPSS Percentile 95.6%
Attack Vector NETWORK
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H

CISA SSVC

Vulnrichment
Exploitation poc
Automatable no
Technical Impact total

Lab Environment

COMMUNITY
Community Lab
docker pull registry.access.redhat.com/ubi9/python-39:1
+5 more repos

Details

CWE
CWE-94
Status published
Products (5)
fedoraproject/fedora 33
fedoraproject/fedora 34
fedoraproject/fedora 35
starwindsoftware/starwind_virtual_san v8r13 14398
unicode/unicode < 14.0.0
Published Nov 01, 2021
Tracked Since Feb 18, 2026