From ec41111b0d0131c980ffc0ec6e5ba8b1b69032ea Mon Sep 17 00:00:00 2001 From: Jeroen Willemsen Date: Wed, 9 Oct 2024 00:06:57 +0200 Subject: [PATCH 1/4] .net container support --- Dockerfile_webdesktop | 9 +++++---- wrongsecret-desktop-resources/startwm.sh | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile_webdesktop b/Dockerfile_webdesktop index bd6c406c8..35f0b8db6 100644 --- a/Dockerfile_webdesktop +++ b/Dockerfile_webdesktop @@ -18,15 +18,16 @@ RUN \ rm -rf /tmp/* RUN \ + export DOTNET_INSTALL_DIR="/etc/dotnet" && \ echo "installing dotnet" && \ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \ chmod +x dotnet-install.sh && \ ./dotnet-install.sh --version latest && \ - export DOTNET_ROOT=$HOME/.dotnet && \ + export DOTNET_ROOT=/etc/dotnet && \ export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools && \ - dotnet tool install --global ilspycmd && \ - dotnet tool install -g sfextract - + export PATH="$PATH:/config/.dotnet/tools" &&\ + dotnet tool install --global ilspycmd --version 9.0.0.7660-preview2 + WORKDIR /config/Desktop COPY src/main/resources/executables/*linux* /var/tmp/wrongsecrets/ diff --git a/wrongsecret-desktop-resources/startwm.sh b/wrongsecret-desktop-resources/startwm.sh index e3d982c0c..1ac3d3747 100755 --- a/wrongsecret-desktop-resources/startwm.sh +++ b/wrongsecret-desktop-resources/startwm.sh @@ -1,7 +1,9 @@ #!/bin/bash -export DOTNET_ROOT=$HOME/.dotnet -export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools +export DOTNET_ROOT=/etc/dotnet +export DOTNET_INSTALL_DIR="/etc/dotnet" +export PATH="$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools" +export PATH="$PATH:/config/.dotnet/tools" /startpulse.sh & ln -s -r /var/tmp/wrongsecrets /config/Desktop/wrongsecrets ln -s /var/tmp/wrongsecrets/welcome.md /config/Desktop/welcome.md From 8514db9ec4e85dfd57e0bbfba1e7960e24e75f9d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:11:37 +0000 Subject: [PATCH 2/4] [pre-commit.ci lite] apply automatic fixes --- Dockerfile_webdesktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile_webdesktop b/Dockerfile_webdesktop index 35f0b8db6..c5381b5cc 100644 --- a/Dockerfile_webdesktop +++ b/Dockerfile_webdesktop @@ -27,7 +27,7 @@ RUN \ export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools && \ export PATH="$PATH:/config/.dotnet/tools" &&\ dotnet tool install --global ilspycmd --version 9.0.0.7660-preview2 - + WORKDIR /config/Desktop COPY src/main/resources/executables/*linux* /var/tmp/wrongsecrets/ From 2b1d15a3007dc6f3640322a285d36abe4cf424cb Mon Sep 17 00:00:00 2001 From: Jeroen Willemsen Date: Wed, 9 Oct 2024 00:34:32 +0200 Subject: [PATCH 3/4] webtop fixes part 2 (including challenge instructions changes) --- Dockerfile_webdesktopk8s | 17 +++++++++-------- .../explanations/challenge50_hint.adoc | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Dockerfile_webdesktopk8s b/Dockerfile_webdesktopk8s index bbb2778d9..5bda883fe 100644 --- a/Dockerfile_webdesktopk8s +++ b/Dockerfile_webdesktopk8s @@ -23,14 +23,15 @@ RUN echo "**** clone wrongsecrets.git for webtop in k8s ****" && \ git clone https://github.com/OWASP/wrongsecrets.git RUN \ - echo "installing dotnet" && \ - wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \ - chmod +x dotnet-install.sh && \ - ./dotnet-install.sh --version latest && \ - export DOTNET_ROOT=$HOME/.dotnet && \ - export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools && \ - dotnet tool install --global ilspycmd && \ - dotnet tool install -g sfextract + export DOTNET_INSTALL_DIR="/etc/dotnet" && \ + echo "installing dotnet" && \ + wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \ + chmod +x dotnet-install.sh && \ + ./dotnet-install.sh --version latest && \ + export DOTNET_ROOT=/etc/dotnet && \ + export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools && \ + export PATH="$PATH:/config/.dotnet/tools" &&\ + dotnet tool install --global ilspycmd --version 9.0.0.7660-preview2 WORKDIR /config/Desktop diff --git a/src/main/resources/explanations/challenge50_hint.adoc b/src/main/resources/explanations/challenge50_hint.adoc index 61bd3e448..b7549ea19 100644 --- a/src/main/resources/explanations/challenge50_hint.adoc +++ b/src/main/resources/explanations/challenge50_hint.adoc @@ -8,7 +8,7 @@ You can solve this challenge using the following alternative solutions: - download it from the https://github.com/OWASP/wrongsecrets-binaries/releases[Wrongsecrets Binaries] - Install .NET8 and .NET8 SDK - Install https://github.com/icsharpcode/ILSpy/tree/master/ICSharpCode.ILSpyCmd[ilspycmd] -- Install `sfextract`: `dotnet tool install -g sfextract` -- Unpack the self-contained binary: `sfextract wrongsecrets-dotnet -o \./tmp`. +- optionally: Install `sfextract`: `dotnet tool install -g sfextract` +- Unpack the self-contained binary: `sfextract wrongsecrets-dotnet -o \./tmp`. or use ilspy: `mkdir tmp && ilspycmd -d wrongsecrets-dotnet-linux -o ~/tmp` - Go to the tmp folder and do `ilspycmd dotnetproject.dll` to decompile the dll and find the secret. Don't want to install the tools? check the https://github.com/OWASP/wrongsecrets/tree/master?tab=readme-ov-file#want-to-play-but-are-not-allowed-to-install-the-tools[WrongSecrets Desktop container]! From 22b86cb76ccf72cc5d1e5f5b13f0e987277f3ec1 Mon Sep 17 00:00:00 2001 From: Jeroen Willemsen Date: Wed, 9 Oct 2024 06:08:23 +0200 Subject: [PATCH 4/4] Fix for tooling --- Dockerfile_webdesktop | 4 ++-- Dockerfile_webdesktopk8s | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile_webdesktop b/Dockerfile_webdesktop index c5381b5cc..ba3dfc9e4 100644 --- a/Dockerfile_webdesktop +++ b/Dockerfile_webdesktop @@ -26,11 +26,11 @@ RUN \ export DOTNET_ROOT=/etc/dotnet && \ export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools && \ export PATH="$PATH:/config/.dotnet/tools" &&\ - dotnet tool install --global ilspycmd --version 9.0.0.7660-preview2 + dotnet tool install ilspycmd --version 9.0.0.7660-preview2 --tool-path /etc/dotnet/tools WORKDIR /config/Desktop -COPY src/main/resources/executables/*linux* /var/tmp/wrongsecrets/ +COPY src/main/resources/executables/*linux-mus* /var/tmp/wrongsecrets/ COPY src/main/resources/executables/decrypt/ /var/tmp/wrongsecrets/decrypt/ COPY src/main/resources/executables/wrongsecrets-advanced-c-windows.exe /var/tmp/wrongsecrets/ COPY src/main/resources/executables/secrchallenge.md /var/tmp/wrongsecrets/ diff --git a/Dockerfile_webdesktopk8s b/Dockerfile_webdesktopk8s index 5bda883fe..179c3fde1 100644 --- a/Dockerfile_webdesktopk8s +++ b/Dockerfile_webdesktopk8s @@ -31,11 +31,11 @@ RUN \ export DOTNET_ROOT=/etc/dotnet && \ export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools && \ export PATH="$PATH:/config/.dotnet/tools" &&\ - dotnet tool install --global ilspycmd --version 9.0.0.7660-preview2 + dotnet tool install ilspycmd --version 9.0.0.7660-preview2 --tool-path /etc/dotnet/tools WORKDIR /config/Desktop -COPY src/main/resources/executables/*linux* /var/tmp/wrongsecrets/ +COPY src/main/resources/executables/*linux-mus* /var/tmp/wrongsecrets/ COPY src/main/resources/executables/decrypt/ /var/tmp/wrongsecrets/decrypt/ COPY src/main/resources/executables/wrongsecrets-advanced-c-windows.exe /var/tmp/wrongsecrets/ COPY src/main/resources/executables/secrchallenge.md /var/tmp/wrongsecrets/