Record summary

CVE-2021-42574 has a selected CVSS score of 8.3 (high); EIP currently links 9 repository PoCs and 3 lab environments.

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.

Description source: CVE List

Exploitation context

Available material

Repository PoCs
9
Lab environments
3

CISA SSVC decision

ExploitationPoC
AutomatableNo
Technical impactTotal

CISA Coordinator · SSVC 2.0.3 · Evaluated Jun 11, 2024 · Source: CVE List

Proofs of concept

9

Repository PoCs

GitHubMoshe-ship/bidi-guardRepository PoCby Moshe-shipStars: 5Scanner18 files

1.1 MiB

GitHub

PoC details
Analysisdeepseek-v4-pro:cloud ·

Technical assessment

The artifact is a Python tool named 'bidi-guard' that scans source code files for invisible bidirectional Unicode characters associated with CVE-2021-42574 (Trojan Source). It detects and reports the presence of these characters but does not exploit the vulnerability.

Backdoor review

No backdoor observed in reviewed code

The reviewed source files (README.md, bidi_guard/scanner.py, pyproject.toml) implement a payload withheld for CVE-2021-42574. No backdoor, deceptive payload, or concealed harmful behavior was observed. The code reads files, scans for specific Unicode code points, and reports findings. It does not execute downloaded content, establish persistence, exfiltrate data, or perform any unrelated harmful actions.

ClassificationScanner
Model confidence95%
AuthenticationNot required
LanguagesPython
Target softwaresource code files
Attack typesTrojan Source
Evidence & reasoningClassification basis · observed behavior · safety review
Technical evidence

Classification basis and observed behavior

Classification basis

The code's primary operation is to detect and report the presence of dangerous Unicode bidirectional characters in source files. It does not contain any code that exploits the vulnerability (e.g., crafting or injecting malicious bidi sequences to alter program logic). The README explicitly describes it as a scanner ('Scan code for invisible bidirectional Unicode characters') and the scanner.py module implements detection logic.

README.md:5bidi_guard/scanner.py:1bidi_guard/scanner.py:150-200

Requirements

  • Python 3.9+ environment with bidi-guard installedREADME.md:35pyproject.toml:5
  • Target source code files to scanREADME.md:42-45

Observed behavior

  • Scans files for 16 specific Unicode bidirectional control characters and reports their location, name, and severityREADME.md:48README.md:93-112bidi_guard/scanner.py:150-200
  • Provides a 'ci' command that exits non-zero if dangerous characters are found, suitable for CI/CD pipelinesREADME.md:55README.md:76
  • Offers a 'fix' command to remove all bidi characters from filesREADME.md:56
Safety-review evidence

Behaviors behind the backdoor verdict

Observables

Functionality
Payload withheldThe artifact scans source files for invisible bidirectional Unicode characters to prevent Trojan Source attacks (CVE-2021-42574).README.md:5bidi_guard/scanner.py:150-200
Dependency
Payload withheldThe only declared dependency is 'rich', a common Python library for terminal formatting, which is consistent with the scanner's CLI functionality.pyproject.toml:15-17
Review boundaries

What the analysis did not establish

  • Only 3 of 18 files in the repository were provided as text; the remaining 15 files (including potential CLI, character definitions, and tests) were omitted, limiting full behavioral analysis.
  • The evidence includes 2 non-text media files (1,119,238 bytes) that were not analyzed, which could contain additional context.
  • The analysis is based solely on static source code review; the tool was not executed to confirm runtime behavior.
  • Only 3 of 18 files in the repository were provided as text evidence. The remaining 15 files (13 text, 2 non-text) were omitted and not analyzed.
  • Binary files were flagged as metadata-only and not inspected for embedded payloads.
  • The review is limited to static analysis of the provided source code; runtime behavior was not observed.
Model interpretation

This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.

GitHubLuisCastellanos-dev/cobol-shieldRepository PoCby LuisCastellanos-devStars: 0Scanner5 files

13.4 KiB

GitHub

PoC details
Analysisdeepseek-v4-pro:cloud ·

Technical assessment

The artifact is a security toolkit that detects and cleans invisible Unicode characters in source code and data files. It provides a CI checker (check-invisibles.py) that scans files for dangerous Unicode ranges and exits with a non-zero code on detection, and a sanitizer (clean-invisibles.py) that removes such characters and generates an audit log. The tools are designed to mitigate CVE-2021-42574 (Trojan Source) and related Unicode attacks. No exploit code is present; the tools only identify and report the presence of dangerous characters.

Backdoor review

No backdoor observed in reviewed code

The repository contains a security toolkit for detecting and cleaning invisible Unicode characters in COBOL source code, addressing CVE-2021-42574. The provided Python scripts perform local file scanning and sanitization as documented. No concealed, deceptive, or harmful behavior targeting the operator or unrelated systems was found.

ClassificationScanner
Model confidence98%
AuthenticationNot required
LanguagesPythonCOBOL
Target softwareGnuCOBOLZowe APICOBOL legacy systems
Attack typesUnicode Bidirectional Algorithm manipulationTrojan Source
Evidence & reasoningClassification basis · observed behavior · safety review
Technical evidence

Classification basis and observed behavior

Classification basis

The primary artifact is a scanner. The check-invisibles.py script is explicitly described as a 'CI checker' that 'exits 1 on detection' (README.md line 32). It scans files for dangerous Unicode characters and reports their locations without modifying the target or exercising a vulnerability. The clean-invisibles.py script is a sanitizer that removes dangerous characters, which is a defensive tool, not an exploit. No code in the artifact attempts to exploit CVE-2021-42574 or any other vulnerability; it only detects and cleans the presence of dangerous Unicode sequences.

README.md:32tools/check-invisibles.py:1-14tools/check-invisibles.py:37-43

Requirements

  • Python 3 interpretertools/check-invisibles.py:1
  • Read access to target filestools/check-invisibles.py:66-74

Observed behavior

  • Scans files with specific extensions for Unicode characters in predefined dangerous rangestools/check-invisibles.py:20-28tools/check-invisibles.py:34
  • Reports the file, line, column, and hex bytes of any dangerous character foundtools/check-invisibles.py:54-62
  • Exits with code 1 if any dangerous characters are detected, 0 otherwisetools/check-invisibles.py:85-94
  • Sanitizer removes dangerous characters and creates a backup of the original filetools/clean-invisibles.py:82-86
Safety-review evidence

Behaviors behind the backdoor verdict

Observables

File Scanning Behavior
Payload withheldThis is the disclosed functionality of the PoC, acting as a CI checker.tools/check-invisibles.py:46-63tools/check-invisibles.py:85-91
File Sanitization Behavior
Payload withheldThis is the disclosed functionality of the PoC, acting as a sanitizer with forensic logging.tools/clean-invisibles.py:34-89
Network Activity
Payload withheldThe scripts operate solely on the local filesystem, reading and writing files as specified by the user-provided path argument.tools/check-invisibles.py:1-98tools/clean-invisibles.py:1-135
Review boundaries

What the analysis did not establish

  • Two files (src/AUDITOR-INVISIBLE.cob and .github/workflows/unicode-check.yml) are referenced in the README but not included in the evidence packet; their content is unknown.
  • The evidence packet reports complete_artifact_coverage as false, indicating that not all files from the repository snapshot are included.
  • The analysis is based solely on the provided text content; no code was executed, and the behavior described is inferred from static analysis.
  • Two files (src/AUDITOR-INVISIBLE.cob and .github/workflows/unicode-check.yml) were not provided as text and were not reviewed.
  • The review is limited to the supplied text evidence and does not include execution or analysis of the compiled COBOL program.
Model interpretation

This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.

GitHubshiomiyan/CVE-2021-42574Repository PoCby shiomiyanStars: 1Not analyzed6 files

796 B

GitHub

PoC details
GitHubhffaust/CVE-2021-42574_and_CVE-2021-42694Repository PoCby hffaustStars: 1Not analyzed1 file

35 B · linked to 2 vulnerabilities

GitHub

PoC details
GitHubsimplylu/CVE-2021-42574Repository PoCby js-onStars: 8Not analyzed21 files

109.3 KiB

GitHub

PoC details
GitHubmaweil/bidi_char_detectorRepository PoCby maweilStars: 6Not analyzed14 files

25.5 KiB

GitHub

PoC details
GitHubpierDipi/unicode-control-characters-actionRepository PoCby pierDipiStars: 0Not analyzed11 files

13.9 KiB · linked to 2 vulnerabilities

GitHub

PoC details
GitHubwaseeld/CVE-2021-42574Repository PoCby waseeldStars: 1Not analyzed4 files

169.3 KiB

GitHub

PoC details
GitHubtin-z/solidity_CVE-2021-42574-POCRepository PoCby tin-zStars: 3Not analyzed8 files

146.5 KiB

GitHub

PoC details

Docker lab environments

3
GitHub

Repository root

pierDipi/unicode-control-characters-actionCreated
Vuln labCVE-2021-42574CVE-2021-42694Dockerfile

1 Dockerfile

Analysisdeepseek-v4-pro:cloud ·

Environment assessment

A containerized GitHub Action that scans source code for Unicode control characters, based on a Red Hat diagnostic tool. The Dockerfile builds an image from a UBI9 Python 3.9 base, copies a Python script, an entrypoint script, and a license, and sets the entrypoint to run the script with user-supplied arguments.

Dockerfile:1-11entrypoint.sh:1-9src/find_unicode_control2.py:1-248

Lab assessment

Vulnerability lab

The README explicitly states the action detects 'Trojan source attacks (CVE-2021-42574,CVE-2021-42694)' and references a Red Hat vulnerability advisory. The included Python script is designed to find Unicode bidirectional control characters, which are the basis for these CVEs. The environment is a tool for identifying the vulnerability, not a target to be exploited, but it is directly associated with vulnerability research.

README.md:3-5src/find_unicode_control2.py:1-9
Lab shapeDockerfile
ServicesUnknown
Compose manifests0
Dockerfiles1
Evidence & reasoningComponents · CVE assessment · exercise context · review boundaries
Components

Services and files described by the evidence

Dockerfile

builds the container image

Defines the image based on registry.access.redhat.com/ubi9/python-39:1, copies local files (LICENSE, src directory, entrypoint.sh) into the image, and sets the entrypoint to /entrypoint.sh with a default argument of '.'.

Dockerfile:1-11

entrypoint.sh

container entrypointpasses arguments to the Python scanner

A bash script that prints the received arguments and then executes /src/find_unicode_control2.py with all arguments passed to the container.

entrypoint.sh:1-9

find_unicode_control2.py

scans files for Unicode control charactersdetects Trojan Source attacks

A Python script that recursively scans files and directories for Unicode control characters, including bidirectional control characters. It can be configured to look for all non-printable characters or only bidirectional ones, and outputs findings with file and line information. It is the core tool for detecting CVE-2021-42574 and CVE-2021-42694.

src/find_unicode_control2.py:1-248

run-tests.sh

tests the containerized action

A test script that builds the Docker image and runs it with the argument '-d /src'. It expects the script to find Unicode control characters in its own source (causing a non-zero exit), and reports success or failure accordingly.

tests/run-tests.sh:1-16
CVE assessment

How the supplied evidence relates each vulnerability

CVE-2021-42574

Supported by supplied evidence

The README associates the action with CVE-2021-42574 (Trojan Source attacks). The Python script specifically scans for Unicode bidirectional control characters (e.g., U+202A-U+202E, U+2066-U+2069), which are the mechanism for CVE-2021-42574. The script's purpose aligns with detecting this vulnerability.

README.md:3-5src/find_unicode_control2.py:1-9src/find_unicode_control2.py:218-222

CVE-2021-42694

Supported by supplied evidence

The README also lists CVE-2021-42694 alongside CVE-2021-42574. CVE-2021-42694 is a related issue involving homoglyph attacks using Unicode characters. The script's ability to scan for all non-printable Unicode characters (with the '-p all' option) covers the broader class of Unicode-based attacks, including homoglyphs. The tool is designed to detect such characters, supporting the association.

README.md:3-5src/find_unicode_control2.py:1-9src/find_unicode_control2.py:210-216
Exercise context

Requirements and sequence described by the evidence

Prerequisites

  • Docker must be installed to build and run the container.tests/run-tests.sh:5
  • The source code to be scanned must be mounted or accessible inside the container (e.g., via a volume mount or by copying into the image). The default CMD is '.', which scans the current working directory.Dockerfile:10

Evidence-described exercise path

  1. Build the Docker image using the provided Dockerfile.tests/run-tests.sh:5
  2. Run the container with arguments specifying the path to scan and options (e.g., '-d /src' for detailed scan of the /src directory). The entrypoint executes find_unicode_control2.py with the given arguments.tests/run-tests.sh:9entrypoint.sh:8
  3. The script scans the specified files/directories for Unicode control characters and outputs any findings. A non-zero exit code indicates the presence of such characters.src/find_unicode_control2.py:240-248
Safety-review evidence

Behaviors behind the stored safety assessment

No harmful behavior observed

The container runs a Python script that reads and analyzes text files for Unicode control characters. It does not modify files, connect to external networks, or perform any destructive actions. The test script builds and runs the container locally, expecting a non-zero exit from the scanner when it finds characters in its own source. There is no evidence of host escape, persistence, credential theft, or backdoor behavior.

src/find_unicode_control2.py:1-248tests/run-tests.sh:1-16
Review boundaries

What the analysis did not establish

  • The packet does not include the action.yml or .github/workflows/tests.yaml files, which might provide additional context on how the action is used in CI/CD, but their absence does not affect the analysis of the containerized environment.
  • The file src/unicode_characters.py contains only a single comment line and its purpose is unclear; it may be a leftover or placeholder, but it is not executed by the entrypoint.
Model interpretation

This review is limited to the supplied lab evidence packet. It does not assert that the environment runs, reproduces a vulnerability, or is safe to execute. Contract: eip-docker-lab-analysis-v1.

GitHub

Repository root

maweil/bidi_char_detectorCreated
Vuln labCVE-2021-42574Dockerfile

1 Dockerfile

Analysisdeepseek-v4-pro:cloud ·

Environment assessment

A Rust-based tool (bidi_detector) that scans files for Unicode BIDI characters to detect potential Trojan Source attacks (CVE-2021-42574). It is packaged as a minimal Docker container using a multi-stage build (rust:alpine builder, scratch runtime). The tool reads a TOML config file and uses glob patterns to include/exclude files. A test file with embedded BIDI characters is included.

Dockerfile:1-24README.md:1-4src/main.rs:1-176

Lab assessment

Vulnerability lab

The README explicitly states the tool checks for Unicode BIDI characters to mitigate CVE-2021-42574, references the Trojan Source paper, and includes a test file (example-commenting-out.js) that demonstrates the vulnerability. The code implements detection logic for the specific BIDI characters associated with the attack.

README.md:1-4src/lib.rs:1-141test/example-commenting-out.js:1-6
Lab shapeDockerfile
ServicesUnknown
Compose manifests0
Dockerfiles1
Evidence & reasoningComponents · CVE assessment · exercise context · review boundaries
Components

Services and files described by the evidence

bidi_detector binary

BIDI character scannervulnerability detection tool

The main application built from src/main.rs and src/lib.rs. It reads a configuration file (bidi_config.toml), uses glob patterns to find files, scans them for specific Unicode BIDI characters (e.g., U+202A, U+202B, U+202D, U+202E, U+2066, U+2067, U+2068, U+202C, U+2069), and reports occurrences. It exits with code 1 if any BIDI characters are found.

src/main.rs:1-176src/lib.rs:1-141

Dockerfile

container build definition

Multi-stage Dockerfile that builds the Rust project in a rust:alpine builder stage and copies the statically linked binary into a scratch image. The entrypoint runs the bidi_detector binary. The working directory is /data, where a volume mount is expected for scanning.

Dockerfile:1-24

test/example-commenting-out.js

test fixturevulnerability demonstration

A JavaScript file containing hidden Unicode BIDI characters (RLO, LRI, PDI) that visually alter code logic, demonstrating the Trojan Source attack. Used in unit tests to verify detection.

test/example-commenting-out.js:1-6src/lib.rs:120-141

bidi_config.toml

configuration file

A TOML configuration file that defines include/exclude glob patterns and display settings for the scanner. Not included in the evidence text, but referenced in the code and README.

src/main.rs:7README.md:30
CVE assessment

How the supplied evidence relates each vulnerability

CVE-2021-42574

Supported by supplied evidence

The tool is explicitly designed to detect Unicode BIDI characters that enable the Trojan Source attack described in CVE-2021-42574. The README links to the CVE, the code checks for the specific characters listed in the vulnerability research, and the test file demonstrates the attack vector.

README.md:1-4src/lib.rs:1-141test/example-commenting-out.js:1-6
Exercise context

Requirements and sequence described by the evidence

Prerequisites

  • A directory containing files to scan must be mounted to /data in the container (e.g., via -v $(pwd):/data).README.md:18-20Dockerfile:22
  • Optionally, a bidi_config.toml file must be present in the mounted directory to customize scan patterns.src/main.rs:7README.md:30

Evidence-described exercise path

  1. Build the Docker image using the provided Dockerfile.Dockerfile:1-24
  2. Run the container with a volume mount pointing to a directory containing source code or the included test file.README.md:18-20
  3. The tool scans files according to the configuration, detects BIDI characters, and reports them. The test file example-commenting-out.js will trigger detection of 6 BIDI characters.src/main.rs:1-176src/lib.rs:120-141
Safety-review evidence

Behaviors behind the stored safety assessment

No harmful behavior observed

The tool only reads files from a user-mounted volume, scans for specific Unicode characters, and prints results to stdout/stderr. It does not modify files, connect to external networks, persist data, or execute any code from scanned files. The Dockerfile uses a scratch base image with no shell or additional utilities, and the binary is statically compiled. No hidden or unnecessary behavior is observed.

src/main.rs:1-176Dockerfile:1-24
Review boundaries

What the analysis did not establish

  • The bidi_config.toml file is referenced but its content is not included in the evidence text, so its exact configuration cannot be verified.
  • The Dockerfile uses a scratch base image, which is minimal and safe, but the binary's behavior is only inferred from the provided Rust source code; no binary analysis was performed.
Model interpretation

This review is limited to the supplied lab evidence packet. It does not assert that the environment runs, reproduces a vulnerability, or is safe to execute. Contract: eip-docker-lab-analysis-v1.

GitHub

Repository root

shiomiyan/CVE-2021-42574Created
Vuln labCVE-2021-42574Dockerfile

1 Dockerfile

Analysisdeepseek-v4-pro:cloud ·

Environment assessment

A single Dockerfile builds a Rust binary named CVE-2021-42574 from local source and runs it. The README notes compiler version differences, and the source contains Unicode bidirectional control characters in a string comparison, consistent with a CVE-2021-42574 demonstration.

Dockerfile:1-7README.md:1-3src/main.rs:1-9

Lab assessment

Vulnerability lab

The repository name, binary name, and source code all reference CVE-2021-42574. The source demonstrates a Unicode bidirectional attack via a string comparison, and the README describes compiler version behavior relevant to the vulnerability. This is a minimal reproduction environment for the CVE.

Dockerfile:1-7src/main.rs:1-9README.md:1-3
Lab shapeDockerfile
ServicesUnknown
Compose manifests0
Dockerfiles1
Evidence & reasoningComponents · CVE assessment · exercise context · review boundaries
Components

Services and files described by the evidence

rust:1.56 base image

build environmentruntime environment

Provides the Rust 1.56 toolchain to compile the source and run the resulting binary.

Dockerfile:1

CVE-2021-42574 binary

vulnerability demonstration target

A Rust binary built from src/main.rs that prints 'admin' or 'user' based on a string comparison containing Unicode bidirectional override characters, illustrating CVE-2021-42574.

Dockerfile:5-7src/main.rs:1-9

src/main.rs

source codevulnerability demonstration logic

Contains a main function that compares a hardcoded string against a string with Unicode bidirectional characters, demonstrating how source code can appear to have a different logical flow than what is executed.

src/main.rs:1-9
CVE assessment

How the supplied evidence relates each vulnerability

CVE-2021-42574

Supported by supplied evidence

The source code directly implements a Unicode bidirectional attack (Trojan Source) by using Unicode control characters in a string comparison, which is the core of CVE-2021-42574. The README confirms the vulnerability is present in Rust 1.56 and fixed in 1.56.1.

src/main.rs:3-5README.md:1-3
Exercise context

Requirements and sequence described by the evidence

Prerequisites

  • Docker must be installed to build the image.Dockerfile:1-7
  • The Rust 1.56 base image must be pullable from Docker Hub.Dockerfile:1

Evidence-described exercise path

  1. Build the Docker image using the Dockerfile, which compiles the Rust source.Dockerfile:1-5
  2. Run a container from the built image, which executes the binary and prints 'admin' or 'user' based on the Unicode attack.Dockerfile:7src/main.rs:1-9
Safety-review evidence

Behaviors behind the stored safety assessment

No harmful behavior observed

The Dockerfile only builds and runs a local binary that prints to stdout. There are no network connections, volume mounts, privilege escalations, or host modifications. The behavior is entirely contained within the container and directly serves the vulnerability demonstration.

Dockerfile:1-7src/main.rs:1-9
Review boundaries

What the analysis did not establish

  • The binary is compiled but not inspected; its runtime behavior is inferred only from the provided source code.
  • No Docker Compose or orchestration files are present, so multi-service interactions cannot be assessed.
  • The packet does not include the actual binary, only the source and build instructions.
Model interpretation

This review is limited to the supplied lab evidence packet. It does not assert that the environment runs, reproduces a vulnerability, or is safe to execute. Contract: eip-docker-lab-analysis-v1.

References

Showing 12 of 18