php2shell 周:Safeguard 扫出 Laravel 骨架 AGENTS.md 里的「下载即执行」安装句
在社区催促代理升级 PHP 以应对 php2shell 的当周,作者用开源 Safeguard 扫描全新 Laravel 骨架,发现 AGENTS.md/CLAUDE.md 中官方安装器仍是 iex 下载执行模式;工具只读检查依赖、代理规则与密钥,不替你改 PHP。
社区本周大量让编程代理执行「升级 PHP 到 8.4.27」一类指令,背景是 php2shell 相关风险。开发者 @CoderGeeta 用开源工具 Safeguard 扫描一份全新 Laravel 骨架:健康分约 64,高优先级问题 2 条,均落在官方为代理准备的 AGENTS.md / CLAUDE.md——其中包含通过 PowerShell iex 下载并执行 php.new 安装脚本的写法。
作者强调:那是官方安装器而非已知木马,但模式与 ClickFix 一类「下载即跑」诱饵相同,代理若未确认就会直接执行。建议在打补丁同时:把 PHP 升到说明中的安全版本线;先人读 AGENTS.md/CLAUDE.md 再让代理动手;要求代理在 curl | sh 或 iex 前询问;并提交 composer.lock 与 npm 锁文件(骨架默认可能缺失)。Safeguard 自称只读离线扫描依赖、代理规则、密钥与 webshell 迹象,不会替你升级 PHP。
若你维护对外模板仓库,不妨把「代理可读的安装步骤」改成可复核的版本钉扎与本地缓存安装,或强制 -Confirm 类交互;对内部脚手架,则应在 CI 里把 Safeguard 或同类只读扫描当成合并前门禁,专门盯 AGENTS.md、CLAUDE.md、钩子与锁文件是否齐全。
对安全工程读者,重点不是否定官方安装文档,而是把「代理规则文件」纳入与依赖清单同等的攻击面:规则里的远程执行句,等价于给智能体一张可自动签收的安装授权。
Safeguard finds download-and-run patterns in Laravel agent docs
everyone's telling their coding agent "upgrade php to 8.4.27" this week because of php2shell
so i ran safeguard on a fresh laravel skeleton. 2 high findings, both in the AGENTS.md / CLAUDE.md that laravel ships for agents:
iex ((New-Object https://t.co/nC1Q71UnaB.WebClient).DownloadString('https://t.co/oNHC4TCKye'))
that's the official https://t.co/JfeUUViZAZ installer, not malware. but it's the same download-and-run pattern ClickFix uses, and an agent will run it without blinking if the file says so
what i'd do while patching:
- update php to 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35
- read the AGENTS.md / CLAUDE.md in a repo before your agent does
- make your agent ask before any curl | sh or iex
- commit composer.lock and your npm lockfile (the skeleton ships neither)
safeguard won't patch php for you. it checks the stuff around it: composer and npm deps, agent rules, secrets, webshells. open source: https://t.co/cDs3RJWrkS
does your agent ask before running install scripts, or just yolo it?