Home Lab Setup SEED Labs Books Lectures Workshops
SEED Logo

Hash Length Extension Attack Lab

Overview

In this lab we will cover how the length extension attack works. Students will gain first hand experience how a Message Authentication Code (MAC) is calculated using one-way hash using a key and message. The lab explores how an attacker can intercept a client request, expand the message and calculate a correct MAC without knowing the key. Students will apply this knowledge to attack a server program. Students will also learn how to correctly generate a MAC using HMAC.

Activities: Students are given a server program that accepts a list of commands. The client and server share a secret key. The server expects a MAC argument in the request. This MAC is calculated in an insecure way by concatenating the key and request arguments. Students will exploit the insecure MAC calculation to add an additional command to a client request. Students will then fix the server program by calculating the MAC using HMAC.

Tasks (PDF)

Time (Suggested)

  • Supervised (closely-guided lab session): 2 hours
  • Unsupervised (take-home project): 1 week

SEED Videos

SEED Books (English)

Feedback and Help

Please give us your feedback on this lab using this feedback form.
The SEED Labs project is open source. If you are interested in contributing to this project, please check out our Github page: https://github.com/seed-labs/seed-labs.