Skip to content

Commit

Permalink
Merge pull request #951 from OWASP/hotfix-challenge-17
Browse files Browse the repository at this point in the history
Fixes for Challenge17 generation
  • Loading branch information
commjoen authored Aug 31, 2023
2 parents f4465bb + f0ef115 commit a0094ec
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/scripts/docker-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ generate_test_data() {
openssl rand -base64 32 | tr -d '\n' > thirdkey.txt
answer=$(<thirdkey.txt)
answerRegexSafe="$(printf '%s' "$answer" | $findAndReplace -e 's/[]\/$*.^|[]/\\&/g' | $findAndReplace ':a;N;$!ba;s,\n,\\n,g')"
$findAndReplace -i "s/Placeholder Password, find the real one in the history of the container/$answerRegexSafe/g" ../../src/main/resources/.bash_history
cp ../../src/main/resources/.bash_history .
$findAndReplace -i "s/Placeholder Password, find the real one in the history of the container/$answerRegexSafe/g" .bash_history
}

build_update_pom() {
Expand Down Expand Up @@ -343,6 +344,7 @@ restore_temp_change() {
git restore ../../js/index.js
git restore ../../pom.xml
git restore ../../src/main/resources/.bash_history
rm .bash_history
}

commit_and_tag() {
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN useradd -u 2000 -m wrongsecrets

COPY --chown=wrongsecrets target/wrongsecrets-${argBasedVersion}-SNAPSHOT.jar /application.jar
COPY --chown=wrongsecrets .github/scripts/ /var/tmp/helpers
COPY --chown=wrongsecrets src/main/resources/.bash_history /home/wrongsecrets/
COPY --chown=wrongsecrets .github/scripts/.bash_history /home/wrongsecrets/
COPY --chown=wrongsecrets src/main/resources/executables/ /home/wrongsecrets/
COPY --chown=wrongsecrets src/test/resources/alibabacreds.kdbx /var/tmp/helpers
COPY --chown=wrongsecrets src/test/resources/RSAprivatekey.pem /var/tmp/helpers/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ Testers:
- [Dave van Stein @davevs](https://github.com/davevs)
- [Marcin Nowak @MarcinNowak-codes](https://github.com/MarcinNowak-codes)
- [Marc Chang Sing Pang @mchangsp](https://github.com/mchangsp)
- [Vineeth Jagadeesh @djvinnie](https://github.com/djvinnie)

Special mentions for helping out:

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/.bash_history
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ rm -rf jdk-18_linux-x64_bin.deb
git rebase -i main
git rebase -i master
git stash
export tempPassword="Dn3BtvzV7+j2IyRUsEsuVciTPStgxn3GRQsqsnqIXiE="
export tempPassword="Placeholder Password, find the real one in the history of the container"
mvn run tempPassword
k6
npx k6
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/explanations/challenge17_hint.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ As the challenge states you need to look for Bash commands that have been execut
You can solve this challenge using the following steps:

1. Use `bash` within the container to access the history and find the secret:
- Access the bash shell of the container, this can be done with `docker exec -it jeroenwillemsen/wrongsecrets: bash` (Replace with the version of the container you want to use).
- Access the bash shell of the container, this can be done with `docker exec -it jeroenwillemsen/wrongsecrets:<version> bash` (Replace `<version> with the version of the container you want to use).
- Type `history` to list the commands that have been used within the container
2. Print contents of any .bash_history file within a running container:
- Start the container with `docker run -it --entrypoint bash jeroenwillemsen/wrongsecrets:`
- Start the container with `docker run -it --entrypoint bash jeroenwillemsen/wrongsecrets:<version>` (Replace `<version> with the version of the container you want to use)
- cat the contents of the file: `cat ~/.bash_history`. Once you have this file you can use grep or any other search tool to narrow down the answer.
1 change: 1 addition & 0 deletions src/main/resources/templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<a href="https://github.com/MarcinNowak-codes">Marcin Nowak @MarcinNowak-codes</a>
</li>
<li><a href="https://github.com/mchangsp">Marc Chang Sing Pang @mchangsp</a></li>
<li><a href="https://github.com/djvinnie">Vineeth Jagadeesh @djvinnie</a></li>
</ul>
Special mentions for helping out:
<ul>
Expand Down

0 comments on commit a0094ec

Please sign in to comment.