Question: Task 2 : Limits of confidentiality - In this task, you will explore some of the limits of block ciphers in their use within a

Task 2: Limits of confidentiality - In this task, you will explore some of the limits of block ciphers in their use within a secure system. Based on the PKCS#7 padding and CBC encryption code from Task 1, write two "oracle" functions that emulate a web server that wants to use cryptography to protect access to a site administration page. First, at the start of your program generate a random AES key and IV, which will be used in both functions, keeping it constant for the execution of your program (do not generate a new key or IV for every encryption and decryption). The first function, called submit(), should take an arbitrary string provided by the user, and prepend the string:
userid =456; userdata =
and append the string:
;session-id=31337
For example, if the user provides the string
You're the man now, dog (Use this exact string)
submit() would create the string:
userid =456; userdata = You're the man now, dog;session-id=31337
In addition, submit() should: (1) URL encode any ';' and '=' characters that appear in the user provided string; (2) pad the final string (using PKCS#7), and (3) encrypt the padded string using the AES-128-CBC you implemented in Task 1. Submit() should return the resulting ciphertext.
The second function, called verify(), should: (1) decrypt the string (you may use a AES-CBC decrypt library or implement your own CBC decrypt); (2) parse the string for the pattern ";admin=true;" and, (3) return true or false based on whether that string exists. If you've written submit() correctly, it should be impossible for a user to provide input to submit() that will result in verify() returning true.
Now the fun part: use your knowledge of the way CBC mode works to modify the ciphertext returned by submit() to get verify() to return true. Hint: Flipping one bit in ciphertext block ci will result in a scrambled plaintext block mi, but will flip the same bit in plaintext block mi+1.
Task 2 : Limits of confidentiality - In this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!