-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
questionFurther information is requestedFurther information is requested
Description
I've been trying to track this simple Code Injection Vulnerability with CodeQL and I've noticed its having problems tracking the taint through a closure boundary:
function process(input) {
const tokens = [{ text: input }];
return {
execute() {
for (const token of tokens) {
eval(token.text);
}
}
};
}
let userInput = location.hash.substring(1);
const result = process(userInput);
result.execute();
I ran the CodeInjection query for JS against this and got nothing.
I made a simple flow tracking query where I set the CodeInjection sink to any() and I noticed taint tracking stops at const tokens = [{ text: input }];
I made a simpler example without the closure:
function process(input) {
const tokens = [{ text: input }];
for (const token of tokens) {
eval(token.text);
}
}
let userInput = location.hash.substring(1);
process(userInput);
the CodeInjection query catches this so it can't be the for loop causing this miss on its own.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested