Conversation
|
QHelp previews: go/ql/src/experimental/CWE-176/UnicodeBypassValidation.qhelpBypass Logical Validation Using Unicode CharactersSecurity checks bypass due to a Unicode transformation If ever a unicode tranformation is performed after some security checks or logical validation, the latter could be bypassed due to a potential Unicode characters collision. The validation of concern are any character escaping, any regex validation or any string verification. RecommendationPerform a Unicode normalization before the logical validation. ExampleThe following example showcases the bypass of all checks performed by For instance: the character U+FE64 ( package main
import (
"fmt"
"html"
"net/http"
"golang.org/x/text/unicode/norm"
)
func main() {}
func bad() {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
unicode_input := req.URL.Query().Get("unicode_input")
escaped := html.EscapeString(unicode_input)
unicode_norm := norm.NFKC.String(escaped)
fmt.Println(w, "Results: %q", unicode_norm)
})
}References
|
|
Sorry about the delay, I will be working on this query this weekend. |
Co-authored-by: Chris Smowton <smowton@github.com>
Co-authored-by: Chris Smowton <smowton@github.com>
Co-authored-by: Chris Smowton <smowton@github.com>
smowton
left a comment
There was a problem hiding this comment.
Mostly looks good, couple more adjustments
Co-authored-by: Chris Smowton <smowton@github.com>
Co-authored-by: Chris Smowton <smowton@github.com>
|
A regex match function calls could be used as a barrier guard, commit a64a998. |
smowton
left a comment
There was a problem hiding this comment.
This is looking good now! I note the bounty application wants you to submit a Golang CVE -- once that's done I think securitylab will now proceed to check his query's accuracy.
|
Thanks, no problem @smowton |

This pull request adds a Unicode Bypass Validation (UBV) query, tests, and the help file.
The UBV query checks for a Post-Unicode Normalization in a Golang codebase that leads to some security issues such as the bypasses of a String validation, regex verification, and escape functions.