-
-
Couldn't load subscription status.
- Fork 485
Challenge 54 & Challenge55 hidden secrets in gitignore and .ssh #1929
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
8302690
Challenge54 & Challenge55
70bfd91
Merge branch 'OWASP:master' into fix/issue613
Pastekitoo a2f7fac
Update challenge54.adoc
Pastekitoo 0c9697b
Update challenge54_hint.adoc
Pastekitoo e25d7a1
Update challenge54_reason.adoc
Pastekitoo 6087a68
Update challenge55.adoc
Pastekitoo e0bb40c
Update challenge55_hint.adoc
Pastekitoo e8daa04
Update challenge54.adoc
Pastekitoo d5639b7
Update challenge55.adoc
Pastekitoo 622e1a9
Merge branch 'OWASP:master' into fix/issue613
Pastekitoo 504180b
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] b28fcce
Update src/main/resources/wrong-secrets-configuration.yaml
Pastekitoo 81999ef
Update src/main/resources/wrong-secrets-configuration.yaml
Pastekitoo f0d5429
Merge branch 'master' into fix/issue613
Pastekitoo 161eb6f
Rename Challenge55.java to Challenge55Test.java
Pastekitoo 06a65d1
Update Challenge54Test.java
Pastekitoo 13408c7
Update Challenge54Test.java
Pastekitoo 6a8cb83
Update Challenge54.java
Pastekitoo 0f0983b
Update Challenge54.java
Pastekitoo 98fed75
Update Challenge55Test.java
Pastekitoo 9a764c9
Update Challenge55.java
Pastekitoo f03f8d8
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 28d0260
Update Challenge55.java
Pastekitoo 907e35a
Update Challenge55.java
Pastekitoo b5ba75a
Update Challenge55.java
Pastekitoo fab6156
Update Challenge54.java
Pastekitoo 0e3849e
Update wrong-secrets-configuration.yaml
Pastekitoo 3b85c52
Merge branch 'OWASP:master' into fix/issue613
Pastekitoo 7284ea6
add encryption of the input in test
d654405
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 5d2c90f
Update .gitignore
Pastekitoo 6269a33
Update config
Pastekitoo 4aa3c17
Merge branch 'OWASP:master' into fix/issue613
Pastekitoo cc78605
Merge branch 'master' into fix/issue613
commjoen 612bed5
Compacted challenge54 to match encrytped secrets with less internal c…
commjoen 919683f
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 56d15c9
corrected challenge 54
commjoen 879fba7
Merge branch 'fix/issue613' of github.com:Pastekitoo/wrongsecrets int…
commjoen 1355433
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 384ab0f
rewrite of challenge55
commjoen 18fb831
Merge branch 'fix/issue613' of github.com:Pastekitoo/wrongsecrets int…
commjoen f64f61a
Cleanup unused imports
commjoen df131f6
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] dd986fb
Merge branch 'master' into fix/issue613
commjoen 262d524
Merge branch 'master' into fix/issue613
commjoen f6baf43
suppress stuff and fix a bug
commjoen 2866290
Merge branch 'fix/issue613' of github.com:Pastekitoo/wrongsecrets int…
commjoen 684ff4c
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 5a97460
final fixes to make it green again
commjoen 5c7e464
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] dc99106
remove lines
commjoen 0be7dff
Merge branch 'fix/issue613' of github.com:Pastekitoo/wrongsecrets int…
commjoen f29911b
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 9cddab4
Added missing instructions
commjoen 3167b6a
Merge branch 'master' into fix/issue613
commjoen 811c827
update readme to reflect 55 challenges
commjoen 91aab2a
updated challenge54
commjoen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Host dev | ||
| HostName 127.0.0.1 | ||
| User wrongsecrets | ||
| Port 4444 | ||
| # Cha-llen-ge 5-5 (to avoid detection by scanning tools) | ||
| # Se-cret en-cry-pted : U2FsdGVkX18Z71msuvueMq5Tyioi7zYt6FJM/z6qJIvXM8q587ZT4ogr49ccs9Mv | ||
15 changes: 15 additions & 0 deletions
15
src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge54.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package org.owasp.wrongsecrets.challenges; | ||
Pastekitoo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| /** Challenge with a secret in .gitignore */ | ||
| @Component | ||
| public class Challenge54 extends FixedAnswerChallenge { | ||
|
|
||
| private final String secret = "(<:GITIGN0RE_SECRET:>)"; | ||
Pastekitoo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @Override | ||
| public String getAnswer() { | ||
| return secret; | ||
| } | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge55.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package org.owasp.wrongsecrets.challenges; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| /** Challenge with a secret in .ssh */ | ||
| @Component | ||
| public class Challenge55 extends FixedAnswerChallenge { | ||
|
|
||
| private final String secret = "(<:SSH_SECRET:>)"; | ||
Pastekitoo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @Override | ||
| public String getAnswer() { | ||
| return secret; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| === Hidden Secret Challenge | ||
|
|
||
| Sometimes developers mistakenly add sensitive data or secrets as comments or hidden entries in files. | ||
|
|
||
| In this challenge, a developer left behind an encrypted secret in a file comment. This challenge highlights how easy it is to forget critical secrets in accessible file. | ||
Pastekitoo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Your goal is to find and decrypt this forgotten secret. | ||
|
|
||
| ==== Note | ||
| The secret is encrypted using AES-256-CBC and base64 format. Use the following passphrase "key_to_decrypt_the_secret" to decrypt it. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| The secret is hidden within the `.gitignore` file as an AES-256-CBC encrypted, base64-encoded comment. | ||
|
|
||
| Follow these steps to decrypt the secret: | ||
|
|
||
| 1. Locate the encrypted comment in `.gitignore`. | ||
| 2. Use OpenSSL to decrypt: | ||
| + | ||
| [source,bash] | ||
| ---- | ||
| echo "<encrypted_base64_secret_here>" | openssl enc -aes-256-cbc -a -d -pass pass:"key_to_decrypt_the_secret" | ||
| ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Developers regularly update configuration files like `.gitignore`, occasionally leaving sensitive information behind, such as passwords, tokens, or critical file paths. | ||
|
|
||
| Forgotten secrets in public files indicate poor security practices and weak secret management. | ||
|
|
||
| This challenge demonstrates the importance of code reviews and ensuring secrets are never accidentally committed or left behind. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| === Hidden Secret Challenge | ||
|
|
||
| Sometimes developers mistakenly add sensitive data or secrets as comments or hidden entries in files. | ||
|
|
||
| In this challenge, a developer left behind an encrypted secret in a file comment. This challenge highlights how easy it is to forget critical secrets in accessible file. | ||
|
|
||
| Find and decrypt this forgotten secret. | ||
|
|
||
| ==== Hint | ||
| The secret is encrypted using AES-256-CBC and base64 format. Use the provided passphrase to decrypt it. | ||
|
|
||
| The passphrase is "key_to_decrypt_the_secret". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| The secret is AES-256-CBC encrypted and base64-encoded in a comment within the `.ssh/config` file. | ||
|
|
||
| Decrypt the secret using these steps: | ||
|
|
||
| 1. Open `.ssh/config` and locate the encrypted secret comment. | ||
| 2. Decrypt the encrypted comment using OpenSSL: | ||
| + | ||
| [source,bash] | ||
| ---- | ||
| echo "<encrypted_base64_secret_here>" | openssl enc -aes-256-cbc -a -d -pass pass:"key_to_decrypt_the_secret" | ||
| ---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| === Risks of sensitive data in SSH configuration files | ||
|
|
||
| Developers frequently store SSH connection configurations in `.ssh/config` files. However, this convenience may lead to the accidental inclusion of sensitive information, such as passwords or keys, which could become forgotten over time. | ||
|
|
||
| Forgotten secrets indicate inadequate security checks and poor secret management practices. | ||
|
|
||
| This challenge emphasizes the importance of secure storage practices and periodic auditing of sensitive configuration files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/test/java/org/owasp/wrongsecrets/challenges/docker/Challenge54Test.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package org.owasp.wrongsecrets.challenges; | ||
|
|
||
| import org.assertj.core.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class Challenge54Test { | ||
|
|
||
| @Test | ||
| void rightAnswerShouldSolveChallenge() { | ||
| var challenge = new Challenge54(); | ||
| Assertions.assertThat(challenge.solved("wrong answer")).isFalse(); | ||
| Assertions.assertThat(challenge.solved(challenge.spoiler().solution())).isTrue(); | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
src/test/java/org/owasp/wrongsecrets/challenges/docker/Challenge55.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package org.owasp.wrongsecrets.challenges; | ||
|
|
||
| import org.assertj.core.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class Challenge55Test { | ||
|
|
||
| @Test | ||
| void rightAnswerShouldSolveChallenge() { | ||
| var challenge = new Challenge55(); | ||
| Assertions.assertThat(challenge.solved("wrong answer")).isFalse(); | ||
| Assertions.assertThat(challenge.solved(challenge.spoiler().solution())).isTrue(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.