hackerhouse-opensource / exploits

exploits and proof-of-concept vulnerability demonstration files from the team at Hacker House
https://hacker.house
Other
415 stars 107 forks source link

heartbleed-keyscan.py script is broken #4

Open georgikoemdzhiev opened 2 years ago

georgikoemdzhiev commented 2 years ago

Hello,

I have tried to use the heartbleed-keyscan.py script on a server memory dump (following the Hands On Hacking book) but the script raises the following exception:

Key size: 128
Data length: 262162
server_memory_dump_heartbleed_exploit.bin Offset 0x26e8d:
q = 176895773405621116307788280133420039997222041927523934480318688488979297390501409476979381325487723537203899797473386523980759525945000992510418473771155902173861665533756659990531321296655916345221796401613446653288929898078029282412625028093260043133036581197733169859097558754479002499112198768900474336027
p = 151364638100355176693661398024098730528154159832442956085348149483923804360079088674951666688921823944270058619788401459978290166687493918707176668921114637104351859831061576926116485098591107562914922077134214166121123797285938887040317276229708349784252604661316025693481643254971077966517600088960886610599

Traceback (most recent call last):
  File "/home/kali/Downloads/keyscan.py", line 67, in <module>
    sys.exit(main(*sys.argv[1:]))
  File "/home/kali/Downloads/keyscan.py", line 61, in main
    seq.setComponentByPosition (len (seq), Integer (x))
  File "/usr/lib/python3/dist-packages/pyasn1/type/univ.py", line 2267, in __len__
    return len(self._componentValues)
  File "/usr/lib/python3/dist-packages/pyasn1/type/base.py", line 214, in plug
    raise error.PyAsn1Error('Attempted "%s" operation on ASN.1 schema object' % name)
pyasn1.error.PyAsn1Error: Attempted "__len__" operation on ASN.1 schema object

Please find the pem and server_memory file in the attached zip to recreate the issue files.zip

georgikoemdzhiev commented 2 years ago

I found a workaround on the internet which involved downgrading the pyasn1 package:

pip uninstall pyasn1
pip install pyasn1==0.4.5

I was running version 0.4.8

hackerhouse-opensource commented 3 months ago

Thanks for sharing, I have marked this as won't fix for the time being as it's difficult to support changes to packages made by others. I appreciate the information though and will review it the next time I do a book errata review. Anyone else who notices errata in the book, please email us at info@hacker.house rather than raise issues on github as they may not be reviewed as quickly.