Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bidi Trojan Source Linter Bypassed in Format Strings #94945

Closed
brodieG opened this issue Mar 15, 2022 · 1 comment · Fixed by #134956
Closed

Bidi Trojan Source Linter Bypassed in Format Strings #94945

brodieG opened this issue Mar 15, 2022 · 1 comment · Fixed by #134956
Assignees
Labels
A-fmt Area: `core::fmt` A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-security Area: Security (example: address space layout randomization). A-Unicode Area: Unicode C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@brodieG
Copy link

brodieG commented Mar 15, 2022

This relates to the Trojan Source exploit.

I tried this code:

     println!("RLOhello world"); 

Where RLO are the raw bytes representing "\u202e" (or any of the other forbidden stateful bidi control characters) does not trigger the linter, whereas e.g.:

     let var = "RLOhello world";
     println!(var);

Does trigger the linter (as it should).

This was seen with:

$ rustc -V
rustc 1.61.0-nightly (1eb72580d 2022-03-08) 

I discussed this over e-mail with @pietroalbini and he recommended I post this as a regular issue since most editors / code review sites now handle the bidi stateful controls more gracefully than they did when the bidi trojan vulnerability was original disclosed.

@brodieG brodieG added the C-bug Category: This is a bug. label Mar 15, 2022
@pietroalbini
Copy link
Member

This was discussed with the Rust Security Response WG (not just me) and we agreed with making this issue public.

@fmease fmease added A-Unicode Area: Unicode A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-fmt Area: `core::fmt` A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-security Area: Security (example: address space layout randomization). and removed needs-triage-legacy labels Jan 24, 2024
@fmease fmease added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. labels Dec 21, 2024
@compiler-errors compiler-errors self-assigned this Dec 31, 2024
@bors bors closed this as completed in 0c94f63 Dec 31, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Dec 31, 2024
Rollup merge of rust-lang#134956 - compiler-errors:format-args-hidden-chars, r=jieyouxu

Account for C string literals and `format_args` in `HiddenUnicodeCodepoints` lint

This is stacked on rust-lang#134955, and either that can land first or both of them can land together here. I split this out because this is a bit more involved of an impl.

Fixes rust-lang#94945
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-fmt Area: `core::fmt` A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-security Area: Security (example: address space layout randomization). A-Unicode Area: Unicode C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants