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

Re-evaluate unicode tricks in comments #10254

Closed
chriseth opened this issue Nov 11, 2020 · 13 comments
Closed

Re-evaluate unicode tricks in comments #10254

chriseth opened this issue Nov 11, 2020 · 13 comments
Assignees
Labels
closed due inactivity The issue/PR was automatically closed due to inactivity. language design :rage4: Any changes to the language, e.g. new features low impact Changes are not very noticeable or potential benefits are limited. medium effort Default level of effort research should have We like the idea but it’s not important enough to be a part of the roadmap. stale The issue/PR was marked as stale because it has been open for too long.

Comments

@chriseth
Copy link
Contributor

We should re-evaluate which unicode characters we disallow in comments and strings. Especially RTL markers come to mind.

@axic
Copy link
Member

axic commented Nov 11, 2020

Here are the lists of different control blocks: https://en.wikipedia.org/wiki/Unicode_control_characters

Perhaps we should disallow control blocks and add some explicit exceptions for the ones we want to allow. As for RTL it possibly is something we want to support.

@christianparpart
Copy link
Member

Interesting site: https://www.compart.com/en/unicode/bidiclass

  • RLO (right-to-left override)
  • LRO (left-to-right override)
  • PDF (pop directional override)

There are some "Isolation" marks that seem to be stackable. I'm not sure yet we should take care about those.

@christianparpart christianparpart self-assigned this Nov 18, 2020
@cameel cameel added the language design :rage4: Any changes to the language, e.g. new features label Nov 21, 2020
@Meekohi
Copy link

Meekohi commented Feb 17, 2021

I assume people have seen the relation to this, but thought I'd re-post it here to emphasize this issue's importance: https://github.com/ethereum/solidity-underhanded-contest/tree/master/submissions_2020/submission11_RobertMCForster

@cameel
Copy link
Member

cameel commented Feb 17, 2021

Yeah, it's this submission that actually prompted the issue :) Thanks for posting the link.

As for the current status, #10326 patched the specific problem with LRO/RLO/PDF and #10607 is a pending proposal of a more general approach to such problems. Feedback is welcome.

@axic
Copy link
Member

axic commented Nov 1, 2021

This was fixed with #10326, wasn't it?

@axic
Copy link
Member

axic commented Nov 1, 2021

Rust (CVE-2021-42574) and Go (issue #20209) is also affected.

@maurelian
Copy link
Contributor

This was fixed with #10326, wasn't it?

Would be nice to get confirmation!

@cameel
Copy link
Member

cameel commented Nov 1, 2021

#10326 added checks against LRO/RLO/PDF but Unicode is a large beast and I'm sure there are other edge cases that can be used maliciously. The issue description/title sounds like it was meant to cover it in general, not just this specific case.

@maurelian
Copy link
Contributor

Hmmm, it sounds like the checks added in #10326 are focused on unbalanced codepoints, which I interpret as similar to imbalanced brackets (ie. () :: RLO LRO)?

FWIW, the attack shown in the Rust release doesn't look to be out of balance.

Either way, given the prominence of the announcement today, it'd be very helpful to get a statement from the Solidity team clarifying the status of compiler WRT to this issue.

@cameel cameel added medium effort Default level of effort low impact Changes are not very noticeable or potential benefits are limited. should have We like the idea but it’s not important enough to be a part of the roadmap. research labels Sep 12, 2022
@tin-z
Copy link

tin-z commented Jan 31, 2023

Hi, i link here a poc of CVE-2021-42574 for solidity and solc https://github.com/tin-z/solidity_CVE-2021-42574-POC

@cameel
Copy link
Member

cameel commented Feb 6, 2023

Hmmm, it sounds like the checks added in #10326 are focused on unbalanced codepoints, which I interpret as similar to imbalanced brackets (ie. () :: RLO LRO)?

Yes. That was the case used in the underhanded contest. Banning unbalanced checks looked like it was enough because it prevented mixing the content of strings/comments with the outside text.

I see that the Rust example uses a slightly different trick - with the isolate characters LRI/RLI. Looks they make possible to just take out a bit of text out of the comment/string and render it at the beginning/end of the line. I think we should disallow these. Created a separate issue covering it: #13936.

Hi, i link here a poc of CVE-2021-42574 for solidity and solc https://github.com/tin-z/solidity_CVE-2021-42574-POC

Yeah, not really sure how far we should take it. Maybe we should just disallow all the override/embed chars like Rust did. What's your opinion?

This should not trick the highlighter so the problem should be easily discovered but I guess you could say the same about the trick from the underhanded contest.

@github-actions
Copy link

github-actions bot commented May 8, 2023

This issue has been marked as stale due to inactivity for the last 90 days.
It will be automatically closed in 7 days.

@github-actions github-actions bot added the stale The issue/PR was marked as stale because it has been open for too long. label May 8, 2023
@github-actions
Copy link

Hi everyone! This issue has been automatically closed due to inactivity.
If you think this issue is still relevant in the latest Solidity version and you have something to contribute, feel free to reopen.
However, unless the issue is a concrete proposal that can be implemented, we recommend starting a language discussion on the forum instead.

@github-actions github-actions bot added the closed due inactivity The issue/PR was automatically closed due to inactivity. label May 15, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed due inactivity The issue/PR was automatically closed due to inactivity. language design :rage4: Any changes to the language, e.g. new features low impact Changes are not very noticeable or potential benefits are limited. medium effort Default level of effort research should have We like the idea but it’s not important enough to be a part of the roadmap. stale The issue/PR was marked as stale because it has been open for too long.
Projects
None yet
Development

No branches or pull requests

7 participants