Skip to content

Commit ae013dd

Browse files
committed
Merge branch 'master' into experiment-bed
2 parents 9fe0e65 + 8f2b11e commit ae013dd

12 files changed

+33
-27
lines changed

.github/scripts/docker-create-and-push.sh

+12-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ echo "buildarg supplied: $buildarg"
3535
echo "check if al required binaries are installed"
3636
source ../../scripts/check-available-commands.sh
3737

38-
checkCommandsAvailable java git docker mvn
38+
checkCommandsAvailable java git docker mvn gsed
3939

4040
echo "Start building assets required for container"
4141

@@ -49,10 +49,11 @@ SECENDKEYPART4=$(openssl rand -base64 3 | tr -d '\n')
4949
echo -n "${SECENDKEYPART1}9${SECENDKEYPART2}6${SECENDKEYPART3}2${SECENDKEYPART4}7" > secondkey.txt
5050
printf "function secret() { \n var password = \"$SECENDKEYPART1\" + 9 + \"$SECENDKEYPART2\" + 6 + \"$SECENDKEYPART3\" + 2 + \"$SECENDKEYPART4\" + 7;\n return password;\n }\n" > ../../js/index.js
5151
echo "generating challenge 17"
52+
rm thirdkey.txt
5253
openssl rand -base64 32 | tr -d '\n' > thirdkey.txt
5354
answer=$(<thirdkey.txt)
54-
answerRegexSafe="$(printf '%s' "$answer" | sed -e 's/[]\/$*.^|[]/\\&/g' | sed ':a;N;$!ba;s,\n,\\n,g')"
55-
sed -i "s/Placeholder Password, find the real one in the history of the container/$answerRegexSafe/g" ../../src/main/resources/.bash_history
55+
answerRegexSafe="$(printf '%s' "$answer" | gsed -e 's/[]\/$*.^|[]/\\&/g' | gsed ':a;N;$!ba;s,\n,\\n,g')"
56+
gsed -i "s/Placeholder Password, find the real one in the history of the container/$answerRegexSafe/g" ../../src/main/resources/.bash_history
5657

5758
# preps for #178:
5859
#echo "Building and publishing to maven central, did you set: a settings.xml file with:"
@@ -69,9 +70,7 @@ sed -i "s/Placeholder Password, find the real one in the history of the containe
6970
echo "Building and updating pom.xml file so we can use it in our docker"
7071
cd ../.. && mvn clean && mvn --batch-mode release:update-versions -DdevelopmentVersion=${tag}-SNAPSHOT && mvn install
7172
git add pom.xml
72-
git commit -am "Update POM file with new version: ${tag}"
73-
cd .github/scripts && git push
74-
#cd .github/scripts
73+
cd .github/scripts
7574
docker buildx create --name mybuilder
7675
docker buildx use mybuilder
7776
echo "creating containers"
@@ -81,13 +80,16 @@ docker buildx build --platform linux/amd64,linux/arm64 -t jeroenwillemsen/addo-e
8180
docker buildx build --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets:$tag-no-vault --build-arg "$buildarg" --build-arg "PORT=8081" --build-arg "argBasedVersion=$tag" --build-arg "spring_profile=without-vault" --push ./../../.
8281
docker buildx build --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets:$tag-local-vault --build-arg "$buildarg" --build-arg "PORT=8081" --build-arg "argBasedVersion=$tag" --build-arg "spring_profile=local-vault" --push ./../../.
8382
docker buildx build --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets:$tag-k8s-vault --build-arg "$buildarg" --build-arg "PORT=8081" --build-arg "argBasedVersion=$tag" --build-arg "spring_profile=kubernetes-vault" --push ./../../.
84-
83+
cd ../..
8584
echo "restoring temporal change"
8685
git restore js/index.js
87-
86+
git restore src/main/resources/.bash_history
87+
echo "committing changes and new pom file with version ${tag}"
88+
git commit -am "Update POM file with new version: ${tag}"
89+
git push
8890
echo "tagging version"
89-
#git tag -a $tag -m "${message}"
90-
#git push --tags
91+
git tag -a $tag -m "${message}"
92+
git push --tags
9193

9294
echo "Don't forget to update experiment-bed"
9395
echo "git checkout experiment-bed && git merge master --no-edit"

Dockerfile.web

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM jeroenwillemsen/wrongsecrets:1.4.0-no-vault
1+
FROM jeroenwillemsen/wrongsecrets:1.4.1-no-vault
22

3-
ARG argBasedVersion="1.4.0"
3+
ARG argBasedVersion="1.4.1"
44
ARG CANARY_URLS="http://canarytokens.com/terms/about/s7cfbdakys13246ewd8ivuvku/post.jsp,http://canarytokens.com/terms/about/y0all60b627gzp19ahqh7rl6j/post.jsp"
55
ENV APP_VERSION=$argBasedVersion
66
ENV K8S_ENV=Heroku(Docker)

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Welcome to the OWASP WrongSecrets p0wnable app. With this app, we have packed various ways of how to not store your secrets. These can help you to realize whether your secret management is ok. The challenge is to find all the different secrets by means of various tools and techniques.
88

9-
Can you solve all the 16 challenges?
9+
Can you solve all the 17 challenges?
1010
![screenshot.png](screenshot.png)
1111

1212
## Support
@@ -21,7 +21,7 @@ We will keep providing updates to this branch, and you can track the status quo
2121

2222
## Basic docker exercises
2323

24-
_Can be used for challenges 1-4, 8, 12-15_
24+
_Can be used for challenges 1-4, 8, 12-17_
2525

2626
For the basic docker exercises you currently require:
2727

@@ -31,7 +31,7 @@ For the basic docker exercises you currently require:
3131
You can install it by doing:
3232

3333
```bash
34-
docker run -p 8080:8080 jeroenwillemsen/wrongsecrets:1.4.0-no-vault
34+
docker run -p 8080:8080 jeroenwillemsen/wrongsecrets:1.4.1-no-vault
3535
```
3636

3737
Now you can try to find the secrets by means of solving the challenge offered at:
@@ -46,6 +46,7 @@ Now you can try to find the secrets by means of solving the challenge offered at
4646
- [localhost:8080/challenge/14](http://localhost:8080/challenge/14)
4747
- [localhost:8080/challenge/15](http://localhost:8080/challenge/15)
4848
- [localhost:8080/challenge/16](http://localhost:8080/challenge/16)
49+
- [localhost:8080/challenge/17](http://localhost:8080/challenge/17)
4950

5051
Note that these challenges are still very basic, and so are their explanations. Feel free to file a PR to make them look better ;-).
5152

@@ -62,7 +63,7 @@ You can test them out at [https://wrongsecrets.herokuapp.com/](https://wrongsecr
6263

6364
## Basic K8s exercise
6465

65-
_Can be used for challenges 1-6, 8, 12-16_
66+
_Can be used for challenges 1-6, 8, 12-17_
6667

6768
### Minikube based
6869

@@ -109,7 +110,7 @@ now you can use the provided IP address and port to further play with the K8s va
109110

110111
## Vault exercises with minikube
111112

112-
_Can be used for challenges 1-8, 12-16_
113+
_Can be used for challenges 1-8, 12-17_
113114
Make sure you have the following installed:
114115

115116
- minikube with docker (or comment out line 8 and work at your own k8s setup),
@@ -120,13 +121,13 @@ Make sure you have the following installed:
120121
- vault [Install from here](https://www.vaultproject.io/downloads),
121122
- grep, Cat, and Sed
122123

123-
Run `./k8s-vault-minkube-start.sh`, when the script is done, then the challenges will wait for you at <http://localhost:8080> . This will allow you to run challenges 1-8, 12-15.
124+
Run `./k8s-vault-minkube-start.sh`, when the script is done, then the challenges will wait for you at <http://localhost:8080> . This will allow you to run challenges 1-8, 12-17.
124125

125126
When you stopped the `k8s-vault-minikube-start.sh` script and want to resume the port forward run: `k8s-vault-minikube-resume.sh`. This is because if you run the start script again it will replace the secret in the vault and not update the secret-challenge application with the new secret.
126127

127128
## Cloud Challenges
128129

129-
_Can be used for challenges 1-16_
130+
_Can be used for challenges 1-17_
130131

131132
**READ THIS**: Given that the exercises below contain IAM privilege escalation exercises,
132133
never run this on an account which is related to your production environment or can influence your account-over-arching resources.

aws/k8s/secret-challenge-vault-deployment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ spec:
3737
volumeAttributes:
3838
secretProviderClass: "wrongsecrets-aws-secretsmanager"
3939
containers:
40-
- image: jeroenwillemsen/wrongsecrets:1.4.0-k8s-vault
40+
- image: jeroenwillemsen/wrongsecrets:1.4.1-k8s-vault
4141
imagePullPolicy: IfNotPresent
4242
ports:
4343
- containerPort: 8080

azure/k8s/secret-challenge-vault-deployment.yml.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ spec:
3535
volumeAttributes:
3636
secretProviderClass: "azure-wrongsecrets-vault"
3737
containers:
38-
- image: jeroenwillemsen/wrongsecrets:1.4.0-k8s-vault
38+
- image: jeroenwillemsen/wrongsecrets:1.4.1-k8s-vault
3939
imagePullPolicy: IfNotPresent
4040
ports:
4141
- containerPort: 8080

gcp/k8s/secret-challenge-vault-deployment.yml.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ spec:
3737
volumeAttributes:
3838
secretProviderClass: "wrongsecrets-gcp-secretsmanager"
3939
containers:
40-
- image: jeroenwillemsen/wrongsecrets:1.4.0-k8s-vault
40+
- image: jeroenwillemsen/wrongsecrets:1.4.1-k8s-vault
4141
imagePullPolicy: IfNotPresent
4242
ports:
4343
- containerPort: 8080

js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
function secret() {
2-
var password = "kY3HAYM=" + 9 + "iKBa" + 6 + "vQo=" + 2 + "VpEk" + 7;
2+
var password = "jLJIQZM=" + 9 + "aG7l" + 6 + "LAQ=" + 2 + "UdiM" + 7;
33
return password;
44
}

k8s/secret-challenge-deployment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
runAsGroup: 2000
2929
fsGroup: 2000
3030
containers:
31-
- image: jeroenwillemsen/wrongsecrets:1.4.0-no-vault
31+
- image: jeroenwillemsen/wrongsecrets:1.4.1-no-vault
3232
imagePullPolicy: IfNotPresent
3333
ports:
3434
- containerPort: 8080

k8s/secret-challenge-vault-deployment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
runAsNonRoot: true
3131
serviceAccountName: vault
3232
containers:
33-
- image: jeroenwillemsen/wrongsecrets:1.4.0-k8s-vault
33+
- image: jeroenwillemsen/wrongsecrets:1.4.1-k8s-vault
3434
imagePullPolicy: IfNotPresent
3535
ports:
3636
- containerPort: 8080

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</parent>
1010
<groupId>org.owasp</groupId>
1111
<artifactId>wrongsecrets</artifactId>
12-
<version>1.4.1-dev-SNAPSHOT</version>
12+
<version>1.4.1-SNAPSHOT</version>
1313
<name>OWASP WrongSecrets</name>
1414
<description>Examples with how to not use secrets</description>
1515
<url>https://owasp.org/www-project-wrongsecrets/</url>

secretscache/curl.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
curl -H Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== https://en.wikipedia.org/wiki/Basic_access_authentication

src/main/resources/.bash_history

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,4 +709,4 @@ w
709709
pinky
710710
history
711711
pwd
712-
cat .bash_history
712+
cat .bash_history

0 commit comments

Comments
 (0)