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

Challenge 54 & Challenge55 hidden secrets in gitignore and .ssh #1929

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

Pastekitoo
Copy link
Contributor

@Pastekitoo Pastekitoo commented Mar 14, 2025

What kind of changes does this PR include?

  • Fixes or refactors
  • A new challenge
  • Additional documentation
  • Something else

Description

Challenge 54 is about a hidden secret in gitignore and Challenge 55 is about a hidden secret in .ssh.
Both secrets are encrypted and in base64 format to hide them from detection engines.
You can decrypt them with openssl and the passphrase given in the Description of the challenge.
The passphrase has to be available to all users in main page of the challenges.

Relations

Closes #613

Checklist:

  • All the contributions made are solely the work of me and my co-authors
  • I tested the changes in this PR (if applicable)
  • I added unit tests to ensure my change works (when change in Java or on front-end code)
  • I added UI tests to ensure my UI changes work (when change in the overall UI, not needed if just adding a challenge)
  • The PR passes pre-commit hooks and automated tests

Sorry, something went wrong.

Copy link
Collaborator

@commjoen commjoen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the challenges, can you fix the feedback, the pipeline and maybe add the plain pubkey and privatekwy in the same ssh config conmit by mistake challenge please?

.ssh/config Outdated
User wrongsecrets
Port 4444
# Cha-llen-ge 5-5 (to avoid detection by scanning tools)
# Se-cret en-cry-pted : U2FsdGVkX18Z71msuvueMq5Tyioi7zYt6FJM/z6qJIvXM8q587ZT4ogr49ccs9Mv
Copy link
Collaborator

@commjoen commjoen Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we make this just an ssh pubkey instead? (Or add a pubkey as another challenge)
Because I have not seen a secret like that in real life: I did see the “why doesn’t it work let’s put both public and private key here”. So let’s make this a “the pub and private key are here by mistake” challenge.

Pastekitoo and others added 3 commits March 16, 2025 23:54
Co-authored-by: Jeroen Willemsen <jeroenwillemsen2001@gmail.com>
Co-authored-by: Jeroen Willemsen <jeroenwillemsen2001@gmail.com>
Pastekitoo and others added 11 commits March 17, 2025 15:00
Pastekitoo and others added 5 commits March 18, 2025 12:56

public static String encryptAES(String input) throws Exception {
SecretKeySpec secretKey = getKeyFromPassphrase(passphrase);
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");

Check failure

Code scanning / CodeQL

Use of a broken or risky cryptographic algorithm High

Cryptographic algorithm
AES/ECB/PKCS5Padding
is insecure. ECB mode, as in AES/ECB/NoPadding for example, is vulnerable to replay and other attacks. Consider using GCM instead.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to use a insecure padding to have an deterministic function. Else, the tests will always fail because we encrypt the user input and compare with the encrypted secret we already have to test if the user give the correct answer.


public static String encryptAES(String input) throws Exception {
SecretKeySpec secretKey = getKeyFromPassphrase(passphrase);
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");

Check failure

Code scanning / CodeQL

Use of a broken or risky cryptographic algorithm High

Cryptographic algorithm
AES/ECB/PKCS5Padding
is insecure. ECB mode, as in AES/ECB/NoPadding for example, is vulnerable to replay and other attacks. Consider using GCM instead.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to use a insecure padding to have an deterministic function. Else, the tests will always fail because we encrypt the user input and compare with the encrypted secret we already have to test if the user give the correct answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have a secret in .gitignore /.ssh
2 participants