Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-42694 PoC — Unicode 安全漏洞

Source
Associated Vulnerability
Title:Unicode 安全漏洞 (CVE-2021-42694)
Description:Unicode(通用字符集)是美国统一码联盟(Unicode Consortium)组织的一种通用字符编码标准。用于为世界上每种语言的每个字符和符号分配一个代码。 Unicode Specification 14.0 版本及之前版本存在安全漏洞,该漏洞源于该规范允许攻击者使用在视觉上与目标标识符相同的同形文字生成源代码标识符,例如函数名称。 攻击者可以利用这一点,通过在下游软件中欺骗性地调用的上游软件依赖项中的对抗标识符定义来注入代码。
Description
Generate malicious files using recently published homoglyphic-attack (CVE-2021-42694)
Readme
# CVE-2021-42694
Generate malicious files using recently published homoglyph-attack vulnerability, which was discovered at least in C, C++, C#, Go, Python, Rust, JS, ...

Cite from [cve.mitre.org](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42694)
> An issue was discovered in the character definitions of the Unicode Specification through 14.0. The specification allows an adversary to produce source code identifiers such as function names using homoglyphs that render visually identical to a target identifier. Adversaries can leverage this to inject code via adversarial identifier definitions in upstream software dependencies invoked deceptively in downstream software.

Raw data for homoglyphs (`homoglyphs.txt`) taken from [here](https://github.com/codebox/homoglyph) and cleaned data to sort out italic and dissimilar characters.

See the original source from Camebridge University:<br>
https://www.trojansource.codes/trojan-source.pdf

## Usage
`python3 codegen.py [-h] [-i INFILE] [-o OUTFILE] [-r] [-a]`
| arg | long arg | param | descrption |
|-----|----------|-------|------------|
| -h | --help | none | show this help message and exit |
| -i | --infile | INFILE | Input file containing homoglyph placeholders |
| -o | --outfile | OUTFILE | Output file to store the final code |
| -r | --random | none | SET flag to choose random homoglyph; take first one if not set |
| -a | --about | none | Print about text |

## Examples
Examples were created by me or are takem from the referenced PDF. To run these examples, execute `codegen.py` with the required arguments:

`python3 codegen.py -i infile.xyz -o outfile.xyz` and run/compile `outfile.xyz`.

## Create own template
Currently are only digits [0-9], as well as lower- and uppercase characters [a-zA-Z] supported. To replace a supported char within your template with a (random) homoglyph, simply enclose the char with dollar signs `$`. See the examples to have a first impression on how a template could look like.
File Snapshot

[4.0K] /data/pocs/dde452673e98c7ac6f561fccdfa0a71d773ac3c3 ├── [2.7K] codegen.py ├── [4.0K] examples │   ├── [ 201] hello_world.cpp │   └── [ 119] hello_world.py ├── [1.5K] homoglyphs.txt ├── [1.2K] LICENSE └── [1.9K] README.md 1 directory, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.