Sources
Native JavaScript
document.URLdocument.documentURIdocument.URLUnencodeddocument.baseURIlocationlocation.hreflocation.searchlocation.pathnamelocation.hashdocument.cookiedocument.referrerwindow.namehistory.pushStatehistory.replaceStatelocalStorage.getItemsessionStorage.getItemsessionStorage.key
Others
- Ajax (XMLHTTPRequest/Fetch)
- IndexedDB (mozIndexedDB, webkitIndexedDB, msIndexedDB)
- Database
- Window Messaging
Sinks
DOM-XSS Sinks
document.write()document.writeln()document.domainelement.innerHTMLelement.outerHTMLelement.insertAdjacentHTML()element.onevent
JQuery:
add()attr()after()append()appendTo()animate()insertAfter()insertBefore()before()html()prepend()prependTo()prop()replaceAll()replaceWith()wrap()wrapInner()wrapAll()has()constructor()init()index()val()jQuery.parseHTML()$.parseHTML()
Open-Redirection Sinks
Các sinks sau đây vừa có thể gây ra open redirect vừa có thể gây ra XSS:
locationlocation.hostlocation.hostnamelocation.hreflocation.pathnamelocation.searchlocation.protocollocation.assign()location.replace()
Các sinks khác:
open()element.srcdocXMLHttpRequest.open()XMLHttpRequest.send()jQuery.ajax()$.ajax()
Cookie Manipulation Sink
document.cookie
JavaScript Injection Sinks
eval()Function()setTimeout()setInterval()setImmediate()execCommand()execScript()msSetImmediate()range.createContextualFragment()crypto.generateCRMFRequest()<script>PAYLOAD</script><div onclick='PAYLOAD'>
Document-Domain Manipulation Sink
document.domain
WebSocket-URL Poisoning Sink
WebSocket
Link Manipulation Sinks
element.hrefelement.srcelement.action
Ajax Request-Header Manipulation Sinks
XMLHttpRequest.setRequestHeader()XMLHttpRequest.open()XMLHttpRequest.send()jQuery.globalEval()$.globalEval()
Local File-Path Manipulation Sinks
FileReader.readAsArrayBuffer()FileReader.readAsBinaryString()FileReader.readAsDataURL()FileReader.readAsText()FileReader.readAsFile()FileReader.root.getFile()
Client-Side SQL-Injection Sink
executeSql()
HTML5 Storage Manipulation Sinks
sessionStorage.setItem()localStorage.setItem()
XPath Injection Sinks
document.evaluate()element.evaluate()
Client-Side JSON Injection Sinks
JSON.parse()jQuery.parseJSON()$.parseJSON()
DOM-Data Manipulation Sinks
script.srcscript.textscript.textContentscript.innerTextelement.setAttribute()element.searchelement.textelement.textContentelement.innerTextelement.outerTextelement.valueelement.nameelement.targetelement.methodelement.typeelement.backgroundImageelement.cssTextelement.codebasedocument.titledocument.implementation.createHTMLDocument()history.pushState()history.replaceState()
Denial Of Service Sinks
requestFileSystem()RegExp()
Attribute Manipulation Sinks
element.setAttribute('href', notLiteralSource);. Element có thể làimg,iframe,scripthoặca.element.setAttribute('src', notLiteralSource);. Element có thể làimg,iframe,scripthoặca.script.setAttribute('text', notLiteralSource);script.setAttribute('innerText', notLiteralSource);element.setAttribute('on*', source);element.setAttribute('value', source);