4 ms·
> non-ASCII constant names This is actually a security risk, avoiding all Unicode security recommendations. See e.g. http://websec.github.io/unicode-security-g
by rurban 8y ago
> non-ASCII constant names
This is actually a security risk, avoiding all Unicode security recommendations. See e.g. http://websec.github.io/unicode-security-guide/visual-spoofing/ http://websec.github.io/unicode-security-guide/visual-spoofi...
All they did was open the floodgates: https://github.com/ruby/ruby/commit/f852af0e59899157ef695edccbe86d51fc04d23b https://github.com/ruby/ruby/commit/f852af0e59899157ef695edc...
no rtl checks, no spoofing, no mixed script checks, no normalization.
- tedunangst 8y agoHow is it it a security risk to name a constant in source code?
- dr_zoidberg 8y agoHe linked a resource that explains visual spoofing, an "attack technique" in which an attacker registers a domain that renders exaclty the same as yours, but actually isn't (because it uses unicode points which render the same --or very similar-- to latin alphabet letters). I woulnd't go as far as saying "it's a security risk", but on some situations it may lead to weird bugs in which you think you're referring to one constant/variable and you're actually referring to another (visually equivalent/the same) const/var.
- pawelmurias 8y agoit can be used to create malicious pull requests that are visually indistinguishable from correct ones
- dragonwriter 8y ago> it can be used to create malicious pull requests that are visually indistinguishable from correct ones If your only check on the correctness of submitted code is visual inspection, you've got a much bigger problem than Unicode confusability.
- saagarjha 8y agoHow do you check your code? Presumably, you’re not able to exercise the full range of inputs, so at some point you will have to look at the code and figure out what it is doing…
- heartbreak 8y agoWhich means you'd notice the value of a constant being exfiltrated, since a maliciously named constant doesn't magically expose secrets outside of the application.
- majewsky 8y agoI suggest you take a look at some of the submissions in e.g. the Underhanded C Contest. Where it can be excruciatingly hard to figure out where the backdoor is even though you know that the code has one.
- phendrenad2 8y agoDo you apply formal verification to your codebases to make sure there are to cleverly-crafted backdoors that still pass all the unit tests? Would be interesting to hear about.
- xiphias2 8y agoIn Ruby it can easily be used to submit malicious source code to a repository (for example the reviewers thinking that a variable is set to some value, when in fact a new variable is created).
- heartbreak 8y agoAn attacker would still have to _do_ something with their new maliciously named constant, which would be as noticeable as any other malicious contribution. This is grasping at straws.
- rileymat2 8y agoThis is probably pretty overblown, but if a function takes a flag, it would be possible to pass in a different value to the function than appears to be passed in at first glance.
- xiphias2 8y agoNot really, just thinking that an operation changes a variable when it in fact doesn't is enough to introduce a security vulnerability.
- backenddev 8y agoI fail to see how so, especially since variable names could contain non-ascii symbols even before that.
- 33degrees 8y agoFor URLs sure. I can’t see the problem for internal constants...
- rurban 8y agoIdentifiers are named identifiers to be identifiable. Unicode spoofs are not identifiable anymore. It's not rockets science. Every name needs to be identifiable. Simply enabling XID_Start + XID_Continue for unicode violates all unicode security recommendations. See the recommended Unicode Security Profiles 1-5, http://www.unicode.org/reports/tr39/#General_Security_Profile http://www.unicode.org/reports/tr39/#General_Security_Profil... ruby violates all of them. so do many other languages. BTW identifiers are not just url's, mail addresses or variable names, but also usernames and paths (filenames, directory names). eg with RTL spoofing you can hide ../ nobody cares so far, esp. not Linux filesystems. Garbage in garbage out is a security risk. The old Apple HPFS at least normalized unicode, the new one is again insecure.
- ascar 8y agoI only skimmed over the linked resource, but non of the mentioned attack vectors and issues seem to be a problem for variable names in source code?
- dragonwriter 8y agoIt enhances risks if you are doing things that are already risky, like using Ruby's dynamic facilities to either expose the user to things based on names in source (“eval” of user-submitted content, or things dynamically constructed from it, for example.) But I can't see much else that is a realistic security risk (readability and code clarity risks are another story.)