Advanced Web Application



Download 2,34 Mb.
Pdf ko'rish
bet23/26
Sana24.07.2021
Hajmi2,34 Mb.
#127117
1   ...   18   19   20   21   22   23   24   25   26
Bog'liq
116 Advanced Web Application Exploitation

 

 

On to the index.js file now, we notice that the /login functionality checks if a password is set. Then it 

creates a Buffer() from the password and converts the Buffer to a base64 string, which can then be 

compared to secret_password. If this operation is successful, the session would set admin = 'yes'.



 

 

That Buffer class is the root cause of a memory-leaking vulnerability that exists. When Buffer is 

called with a string, it will create a Buffer containing those bytes. But if it's called with a number, 

NodeJS will allocate an n byte big Buffer. But if you look closely, the buffer is not simply 

00 00 00>. It seems to always contain different values. That is because Buffer(number) doesn't zero 

the memory, and it can leak data that was previously allocated on the heap. You can read more 

about this issue here, 

https://github.com/nodejs/node/issues/4660

 

Since we have a JSON middleware (app.use(bodyParser.json())), we can actually send POST data that 



contains a number. And when we do that, the API will return some memory that is leaked from the 

heap. 


 

If we now remember that crypto creates a Buffer from the key, this means that an old session key 

could be leaked from memory. 

 

The attack can be performed, as follows. 



curl http://127.0.0.1:3000/login -X POST -H "Content-Type: application/json" 

--data "{\"password\": 100}" | hexdump -C 

 



 

 

© 2020 Caendra Inc. | WAPTXv2 



56 

After multiple attempts, you will notice session keys being leaked.

 

 

With a legitimate session key, it is pretty much game over. You can now create a  {"admin": "yes"} 



cookie with a valid signature. 


Download 2,34 Mb.

Do'stlaringiz bilan baham:
1   ...   18   19   20   21   22   23   24   25   26




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish