basic waf stuff
.innerHTML
treats content as HTML (control)
.innerText
which treats it as datasanitize your input with a library (DOMPurify???)
don’t write vanilla JS, use a framework.
<SCRscriptIPT>
<ScRiPt>
<img onerror=...>
<body onload=...>
‘First, XSS ‘protection’ is about to not be implemented by most browsers…’
‘Worse, the XSS ‘protection’ can be used to create security flaws…’
csrf tokens
Supply a single-use ’nonce’ value.
<input>
Content Security Policy
limits where a site can load content from, e.g.
https://b.com/a/path/
generally blocks iframes, inline scripts, eval()
powerful & hard to bypass (if devs were smart)
policy directives made of directive and value
e.g. script-src: unsafe-inline
script-src
is the directive
unsafe-inline
is the value
read more here
http header
Content-Security-Policy: ???-src <policy directive>
or in a tag
<meta http-equiv="Content-Security-Policy" content="???-src <directive>">
<meta>
tag?what did people do before CORS was available?
json with padding
how do you load the content? you run a function which takes the data as an argument.
since we’re loading the data, we define what function is being used to load it.
callback
parameter<!-- https://melon.com/numbers?callback=load_data -->
load_data([1, 2, 3, 4, 5])
load_data([...])
<script src="https://melon.com/numbers?callback=load_data"></script>
\r\n
(CR\LF
)\r\n
’s\r\n\r\n
?
gl with report & support-v2 lul