Programming Riddle/Challenge (Timestamp/HMAC)

  • Thread starter Thread starter jegues
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
The discussion revolves around a user participating in an online hacking challenge, specifically struggling with a question about the Fibonacci sequence. The challenge requires submitting the correct Fibonacci number for a randomly generated element x, but the user is consistently met with a "Didn't answer fast enough" message despite rapid submissions. Upon inspecting the source code of the challenge page, the user identifies key elements including a timestamp, a number, and an HMAC. Attempts to manipulate the URL parameters, particularly the timestamp and number, lead to a response indicating that the HMAC must match the original parameters. The conversation shifts to how to calculate a new HMAC hash that aligns with the modified parameters. Suggestions include using Python to generate the HMAC with SHA-512, emphasizing the need to experiment with the answer, timestamp, and number to find the correct HMAC. The user seeks further guidance on how to effectively calculate the HMAC, noting their lack of experience with this cryptographic function.
jegues
Messages
1,085
Reaction score
3
I'm doing an online "hacking" challenge and I'm trying to get to the next level.

On the current level, we're given the Caption "Think fast", asked the following question,

"What is element x in the Fibonacci sequence, where element zero is 0?"

Where x is randomly generated.

When I compute the answer and submit it, it prompts me with another itteration of the question above (with a different value for x) and it says "Didn't answer fast enough". I've tried submitting answers as fast as I can with no avail, so there must be another way.

If we view the source code of the page, we see the following:
(I'm only going to post the portion I think is interesting/relevant)

Code:
<form action="herecomes9.php" method="get">
  <input type="text" name="answer" />
  <input type="hidden" name="timestamp" value="1311528704" />
  <input type="hidden" name="number" value="274" />
  <input type="hidden" name="hmac" value="6d423e4405ceb79022662fbf5d1d2885c51b6ada2ad5e99500a3fbc4d0170b4fd9c7fd22af9a7e542617a5924586ca7e41860e17289120d1a899f1bcac007df3" />
  <input type="submit" value="Answer" />
</form>

So my next idea was to edit the timestamp by changing the information contained in the url, like so

(Just an example to explain my doing, may not match answer, timestamp, hmac listed above in code)

http ://www.skullspace.net/2011/08-batman/herecomes9.php?answer=1&timestamp=1&number=1&hmac=e41bd1f9093a67b70ce9316b19abc1862ec35c5c0f746444d8018286bf19d9adb05a652c46b5de53b2d4fd6bfb2c1f848c8dc92a54e84d042953d6b48b30b0f9

If I submit that into my browser, we are given the caption, "Don't try to be clever, the HMAC has to match the parameters you were given."

This is where I'm stuck.

Does anyone have any ideas or hints as to how I can proceed to the next level? Can I somehow make the HMAC match? Is there another way entirely?

Thanks for the ideas/input/help!
 
Technology news on Phys.org
Not particularly my area of expertise, but if you haven't already maybe try and calculate a new HMAC hash using your new timestamp and the number as the key? Based on the length maybe it's HMAC-SHA512?
 
jhae2.718 said:
Not particularly my area of expertise, but if you haven't already maybe try and calculate a new HMAC hash using your new timestamp and the number as the key? Based on the length maybe it's HMAC-SHA512?

How do I go about calculating the new HMAC hash, using the timestamp and number?
 
Last edited:
The Wikipedia article has links to some implementations, as well as descriptions: http://en.wikipedia.org/wiki/HMAC

I've never personally played around with HMACs before.
 
This should do an HMAC with SHA-512 in Python:
Code:
[B]import[/B] hashlib
[B]import[/B] hmac

key = 'the string that is your key'
msg = 'the string that is your message'

[B]print[/B](hmac.new(key, msg, hashlib.sha512).hexdigest())

I'm not sure what they're suing as the parameters for their HMAC. You'll want to play around with the answer, timestamp, and number.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top