Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Challenge: use weak KDF to protect a secret #713

Closed
commjoen opened this issue Mar 18, 2023 · 9 comments · Fixed by #1651
Closed

New Challenge: use weak KDF to protect a secret #713

commjoen opened this issue Mar 18, 2023 · 9 comments · Fixed by #1651
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed New Challenge Adding a new Challenge

Comments

@commjoen
Copy link
Collaborator

commjoen commented Mar 18, 2023

Context

This is a Docker challenge focused on using the wrong KDF to protect a secret.
In crypto-js there is an AES encryption mechanism, which uses MD5 as its KDF. This library is often used on mobile for encryption in hybrid apps. So what if we make a challenge in which the user has to find the right "pin"to be able to decrypt a secret offered on screen? (E.g. a 4-8 digit pin with md5 based KDF, and a secret fitting in 128 bytes.
We need to relate it to the MSTG on how to use (P)KDF with additional entropy and contextual binding.

Did you encounter this in real life? Could you tell us more about the scenario?

See https://github.com/brix/crypto-js/blob/c8a2312474ae60c823f3c00b4d7aac2da460bbfc/test/config-test.js for test defaults.

@commjoen commjoen added help wanted Extra attention is needed good first issue Good for newcomers New Challenge Adding a new Challenge labels Mar 18, 2023
@EmperialX
Copy link

Hello @commjoen , I came across this good first issue and I would like to work on fixing it and would appreciate your guidance as I work on this issue. Let me know if you have any suggestions. can you assign me on this.

@commjoen
Copy link
Collaborator Author

commjoen commented Apr 1, 2023

Hi @EmperialX sure, I will assign it to you :).

  1. Basically the steps are as follows: choose a number between 0 and 99999 of which you create the md-5 hash
  2. use the hash to encrypt "the answer"
  3. take the ciphertext of 2 and store it in the code
  4. now create the answer validation code that takes a string, test if it is a number, convert it to an int between 0 and 99999 and then takes the hash of it to decrypt the ciphertext you hardcoded in 3
  5. if the decrypted result of 4 matches "the answer" the user found the right "pin".
  6. explain in the challengetext that protecting keys is all about the keying material and why choosing a bad key derivation function (KDF) can be not so helpful (reference to https://github.com/brix/crypto-js/blob/c8a2312474ae60c823f3c00b4d7aac2da460bbfc/test/config-test.js) in combination with just only a plain number.

@EmperialX
Copy link

EmperialX commented Apr 1, 2023 via email

@commjoen
Copy link
Collaborator Author

commjoen commented Apr 1, 2023

No rush sir :) . Feel free to connect via Slack where you can find likeminded contributors :) . (See the readme for the links ;-) )

@commjoen
Copy link
Collaborator Author

Hi @EmperialX do you have any updates on this :) ?

@CaduRoriz
Copy link
Contributor

/assign

CaduRoriz added a commit to CaduRoriz/wrongsecrets-fork that referenced this issue Nov 9, 2023
@commjoen
Copy link
Collaborator Author

Hello @CaduRoriz ! How are you doing? Do you have any progress on this issue isr?

@commjoen
Copy link
Collaborator Author

Removed assignees based on inactivity. Feel free to have a go at it!

@adarsh-a-tw
Copy link
Contributor

Hi @commjoen, Can you assign this to me? I would like to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed New Challenge Adding a new Challenge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants