phar:// deserialization
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-ce4fbfd491ab398bd58639023728b416b0758bc1%252Fi3.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=2f3375b4&sv=1)
Bug bounty tip: jiandikishe kwa Intigriti, jukwaa la bug bounty la kiwango cha juu lililotengenezwa na hackers, kwa hackers! Jiunge nasi kwenye https://go.intigriti.com/hacktricks leo, na uanze kupata zawadi hadi $100,000!
Phar files (PHP Archive) files zina metadata katika muundo wa serialized, hivyo, wakati zinapochambuliwa, hii metadata inakuwa deserialized na unaweza kujaribu kutumia udhaifu wa deserialization ndani ya PHP code.
Jambo bora kuhusu sifa hii ni kwamba deserialization hii itatokea hata kwa kutumia kazi za PHP ambazo hazifanyi eval PHP code kama file_get_contents(), fopen(), file() au file_exists(), md5_file(), filemtime() au filesize().
Hivyo, fikiria hali ambapo unaweza kufanya PHP web ipate ukubwa wa faili isiyo na mipaka kwa kutumia phar://
protocol, na ndani ya code unapata class inayofanana na ifuatayo:
Unaweza kuunda faili la phar ambalo linapoload litafanya kudhulumu darasa hili ili kutekeleza amri zisizo na mipaka kwa kitu kama:
Kumbuka jinsi bajeti za kichawi za JPG (\xff\xd8\xff
) zinavyoongezwa mwanzoni mwa faili la phar ili kupita vizuizi vya kupakia faili vinavyoweza.
Tengeneza faili la test.phar
kwa:
Na kutekeleza amri ya whoami
kwa kutumia nambari iliyo hatarini na:
References
![](https://book.hacktricks.xyz/~gitbook/image?url=https%3A%2F%2F3018635170-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FCtGnfY5n0YCGcWtBkgwe%252Fuploads%252Fgit-blob-ce4fbfd491ab398bd58639023728b416b0758bc1%252Fi3.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=2f3375b4&sv=1)
Nasaha ya bug bounty: jiandikishe kwa Intigriti, jukwaa la bug bounty la kiwango cha juu lililotengenezwa na hackers, kwa hackers! Jiunge nasi kwenye https://go.intigriti.com/hacktricks leo, na uanze kupata zawadi hadi $100,000!
Jifunze & fanya mazoezi ya AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Jifunze & fanya mazoezi ya GCP Hacking:
HackTricks Training GCP Red Team Expert (GRTE)
Last updated