Description: Test the taint engine's ability on different builtins.
Source:
Type: ManuallyAdded
Code:
J$$.wrapTaint()
Sink:
Type: XSS
Code:
document.createElement('script').src
Testing Code:
* @Name: array-join-1
* @SourceType: ManuallyAdded
* @SourceCode: J$$.wrapTaint()
* @SinkType: XSS
* @SinkCode: document.createElement('script').src
*/
(function() {
if (typeof J$$ !== 'undefined' && J$$.wrapTaint) {
let taintedValue = J$$.wrapTaint('tainted');
let arr = [taintedValue];
let taintedResult = arr.join('');
if (taintedResult.includes("TaintValue")){
throw new Error("The toString method of TaintValue should not be called.");
}
let scriptEle = document.createElement('script');
scriptEle.src = `https://example.com/${taintedResult}`;
} else {
console.error("J$$ is not defined or does not have wrapTaint method.");
}
})();