0

I am trying to implement a function, let's say in Python to compute Pairwise Master Key Identifier (PMKID) after reading the previously discovered bug in WPA2. Googling gave me this logical statement:

PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)

However, the problem is i am not able to compute the right hash. I've tried various possibilities, tried converting data to binary, tried various versions of MAC but still no chance.

The Question is how do I implement the function for computing PMKID, preferably in Python. Here's what i've doing a bit:

import hashlib, binascii, hmac
from pbkdf2 import PBKDF2

print "Required hash: 2a416a999af0a6bf454684269afb06ef"
apmac = '34:bf:90:4a:bb:57'
clmac = '98:de:d0:1a:97:c2'
pmk = PBKDF2('786 5555', 'unknown', 4096).read(32)
print "PMK: "+binascii.hexlify(pmk)
pmkid = hmac.new(pmk, "PMK Name"+apmac+clmac, hashlib.sha1).hexdigest()
print pmkid
0

Your code is ok, but you need to put the MACs in hex:

'\x34\xbf\x90\x4a\xbb\x57' instead of '34:bf:90:4a:bb:57'

  • Your answer is right. However, it's late now. I've figured this out after spending another day on google. – Shiri Aug 26 '18 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.