Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A website authenticates its users by asking for a login / password , and sends them a cookie C , valid for one minute, to

A website authenticates its users by asking for a login/password, and sends them a cookie C, valid for one minute, to keep track of their authentication status. The cookie C is formed such as C =
Enc("user=username, tmstmp=timestamp"), with username = "anonymous" for unauthenticated users,
or the name of the user when authenticated; and timestamp is a Unix-formated timestamp' representing the time up to which the user is authenticated (current time plus one minute). Enc(:) designates the AES256 encryption in OFB-mode using i as a random IV and k as a random key; both k and iv are unknown to us. The OFB mode of operation for encryption is described in Figure 1.
In this exercise, we consider cookies delivered on February 1st,2024 at 00:00am UTC. At that time, an unauthenticated user coming to the website will receive a cookie:
Cu = AES256-OFBk, iv("user=anonymous, tmstmp=1706745660")
The value 1706745660 corresponds to 00:01am on February 1st. We denote by Pu the plaintext version of the cookie.
Denoted PA, that corresponds to the authenticated admin user if he logged in at the same timeYou may rethink about the value of Pa so that Pu and Pa have the same length. Note that the cookie may authenticate the user admin for as long as you want (but at least the original one minute duration).
A )Implement in Python the attack that would turn CU into a valid CA for at least the original duration. Prepare a single Python file named exercise1.py that contains a function modifycookie() that takes as argument a base64-encoded cookie and returns the base64-encoded modified cookie. Your attack should work for different timestamps.You will get full marks if, given an encrypted cookieissued at any later date than February 1st this year, you are able to turn this cookie into a valid admin cookie for at least the original duration. Make sure your code uses meaningful variable names, consistent indenting scheme, and comments.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

What is a savings schedule?

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago