![]()
---
name: php2shell-inventory
description: Inventory where PHP runs across GitLab groups and projects to assess exposure to PHP2Shell (CVE-2026-109618, CVE-2026-109619), for example "where are we affected by PHP2Shell?". Use it for PHP2Shell triage and patch prioritization, read-only through GitLab Duo Agent Platform, the GitLab MCP server, or the glab CLI, plus GitLab Orbit when available. Do not use it to fix, upgrade, or deploy anything, or for other vulnerabilities.
---
# PHP2Shell Inventory
Find where a PHP runtime is declared in GitLab, separate what the code declares from what actually runs, and hand over a cited, prioritized list of projects that may be exposed to PHP2Shell.
## Advisory
- **PHP2Shell:** CVE-2026-109618, CVE-2026-109619, CVSS 9.2 (v4.0). Unauthenticated remote code execution.
- **Source:** [PHP security advisory, 2026-10-21](https://www.php.net/archive/2026.php#2026-10-21-5).
- **Fixed versions** (anything older on the same branch is affected):
| Branch | Fixed in |
|---|---|
| 8.5 | 8.5.12 |
| 8.4 | 8.4.27 |
| 8.3 | 8.3.36 |
| 8.2 | 8.2.35 |
| 8.1 and older | No release (EOL). The PHP security team published minimal source backports for [7.4](https://github.com/php/php-src/tree/PHP-7.4-CVE-2026-109618-109619), [8.0](https://github.com/php/php-src/tree/PHP-8.0-CVE-2026-109618-109619), and [8.1](https://github.com/php/php-src/tree/PHP-8.1-CVE-2026-109618-109619); vendors may ship backported packages. |
The table tracks known fixes from the [PHP advisory](https://www.php.net/archive/2026.php#2026-10-21-5). Use web search to verify older patch levels in different distributions.
- **Risk order** (highest first): web-facing mod_php (`php:<v>-apache`, `libapache2-mod-php`), then PHP-FPM, php-cgi, FrankenPHP, and LiteSpeed serving web requests, then CLI-only use (cron jobs, CI jobs). Within each level, rank internet-facing, credential-holding, unmaintained, and EOL-branch deployments first.
- **Temporary mitigations** (not a fix): disable `session.upload_progress`, restart workers, and review `memory_limit` and `post_max_size` per the advisory.
## Requirements
Check for GitLab access in this order and use the first one found:
1. **GitLab Duo Agent Platform.** Inside a Duo agent or flow, use its built-in GitLab tools. They act with the user's permissions; no MCP server, glab, or token is needed.
2. **GitLab MCP server** (search, files, CI lint).
3. **glab CLI** (`glab api` for REST calls). If `glab auth status` fails, ask the user to run `glab auth login`.
In addition, use **GitLab Orbit** when it's available: the Orbit MCP server (`https://gitlab.com/api/v4/orbit/mcp`, [setup](https://docs.gitlab.com/orbit/remote/access/mcp/)), or the Orbit tools in Duo Agent Platform (`orbit_list_commands`, `orbit_invoke_command`) when an administrator enabled Orbit ([setup](https://docs.gitlab.com/orbit/remote/access/duo/)). Orbit is a graph of the group's projects, pipelines, deployments, vulnerabilities, and default-branch code, including definitions and cross-file imports. It complements search and CI lint; it doesn't replace them. See [Orbit queries](#orbit-queries).
Results only cover projects the user can access. Advanced search across groups needs Premium or Ultimate; exact code search (regex) only works where it is enabled.
If no access option is available, stop and tell the user how to set one up. Don't scrape the web UI. If advanced or exact code search isn't available, ask the user to inspect a local Git clone or to provide another search option, or fall back to per-project tree listings and file reads through the API (`glab api` or `curl`). Report the reduced coverage as a gap.
## Inputs
| Input | Example |
|---|---|
| Scope | GitLab group `gitlab-com` including subgroups, or a list of projects |
| Due date | Patch due date set by the security team |
| IaC tool (optional) | Ansible, Salt, Puppet, Chef, AWS Systems Manager, kubectl |
| IaC MCP server (optional) | The MCP server for that tool, for example for Kubernetes, AWS, or Ansible |
Ask for the scope and the due date if they are missing. Don't ask for the IaC tool or its MCP server; use them only when the user names them:
- **MCP server named and available:** run the [actual-state checks](#actual-state-checks) through it.
- **Only the tool named, or the MCP server unavailable:** write the actual-state commands for that tool.
- **Neither named:** skip the actual-state commands.
## Steps
1. **List the projects in scope** with ID, path, default branch, archived, and empty-repository state. Use the list to map `project_id` to `path_with_namespace` and to run CI lint per project. Report empty or unreadable projects as gaps; label hits in archived projects as noise.
2. **Search the declared state.** Run every query in [Search syntax](#search-syntax) across the scope. They cover these layers: container images and images that bundle PHP, OS packages (including templated names), third-party repositories, configuration management variables, version pins, PaaS runtimes, and the `upload_progress` mitigation. For templated package names, read the variables that fill them.
3. **Resolve the CI configuration.** Run CI lint for every project in scope, because includes can add PHP to projects without PHP code. [Parse `merged_yaml`](#parse-the-merged-ci-configuration) and collect only `image:`, `image.name`, and `services:` values that contain `php` or an image that bundles PHP, including top-level and `default:`. Don't grep the raw YAML: SAST rules, `$PHPIZE_DEPS`, and `docker-php-ext-*` scripts add noise. `valid: false` with "Please provide content of .gitlab-ci.yml" means the project has no CI configuration; report it as a gap.
4. **Read the evidence.** Open the matching files and extract the exact PHP version, the deployment type (container, VM, PaaS, Kubernetes), and the SAPI:
- `php:<v>-apache` images run mod_php, `php:<v>-fpm` images and `phpX.Y-fpm` packages run PHP-FPM, `php:<v>-cli` is CLI only.
- A floating image tag (`php:8.3`, `php:latest`) is only patched after a rebuild.
- The dependency list doesn't show the PHP version: Dependency Scanning SBOMs from `composer.lock` omit the `php` runtime and its extensions.
- Mitigation: check whether FPM pools, `php.ini` templates, or Dockerfiles set `session.upload_progress.enabled = Off`.
5. **Collect deployment evidence in GitLab** for every project with a finding: environments (production first), their deployments and deploy jobs, container registry tags of images built from a Dockerfile with PHP, and Container Scanning findings for CVE-2026-109618 or CVE-2026-109619 (Orbit, or the project's vulnerability report). Choose the calls yourself with your GitLab tools, and don't print secrets from job logs. A deploy job defined in YAML is not evidence that it ran, and a deployment record without a linked job (created through the API) is weak evidence: it shows that something was recorded, not what runs. Missing evidence, or evidence that only points to example hosts, is a gap, not proof that nothing runs.
6. **Classify each finding** against the fixed versions:
- **Status:** affected, fixed, or unknown (for example a floating tag, or a package whose fix isn't confirmed).
- **Confidence:** high (exact version in a deployed config), medium (version range or floating tag), low (documentation or unclear context).
- Official `php:` Docker images are built from upstream source and never carry distribution backports.
- **Missing Container Scanning findings are not proof of a fix.** If Container Scanning reports no PHP2Shell finding for an image that runs PHP, don't mark it fixed. Some scanners, for example Trivy, only match packages recorded by the OS package manager and may miss PHP compiled from source, as in the official `php:` images (installed under `/usr/local`). The scan may also predate the advisory data. Classify by the PHP version in the Dockerfile or the image's `PHP_VERSION` instead, and mention in the gaps that the scanner may not cover this image. Add a follow-up check for humans: read `PHP_VERSION` from the image config (`docker inspect`, `crane config`), or scan the image with a tool that reads PHP binaries, such as Syft or Grype.
- Distributions and third-party repositories (Ubuntu, Debian, RHEL, `ppa:ondrej/php`, sury, remi) may backport the fix without changing the upstream version number. Check which repository URI is actually configured: the Launchpad PPA (`ppa.launchpadcontent.net/ondrej/php`) and `packages.sury.org` are separate archives and can publish fixes at different times. Use web search, if available, to check the package's support or EOL status and whether the packaged version contains the fix, and cite the sources. Without a confirmed fix, keep the status unknown.
7. **Rank** the findings by the risk order in the [Advisory](#advisory).
8. **Hand over the actual-state check.** Code shows what should run, not what does run. Mark VMs and hosts as unconfirmed instead of assuming the version. Example inventories and example hosts (`*.example.*`, `example.com`, "no real hosts") are gaps, not host lists. Add the [actual-state checks](#actual-state-checks) according to the Inputs.
## Search syntax
Code search only covers the **default branch**. Always pass the search type explicitly: without it, GitLab may pick exact code search, where the advanced syntax (`|`, `filename:`) doesn't apply and OR queries return 0 hits.
**Advanced search** (`search_type=advanced`):
```text
"FROM php" filename:Dockerfile*
php7.4-fpm | php8.0-fpm | php8.1-fpm | php8.2-fpm | php8.3-fpm | php8.4-fpm | php8.5-fpm | libapache2-mod-php
ondrej | sury | rpms.remirepo.net | remi-release
"runtime: php" | buildpack
```
- Returns one snippet per file: treat a hit as "this file matches" and read the whole file.
- Tokenizes on `_` and drops quotes and colons, so use exact code search for variable names and JSON keys.
- Quote multi-word terms: unquoted `FROM php` matches any file that contains both words.
- Don't search a bare `remi`: it matches inside words.
**Exact code search** (`search_type=zoekt`):
```text
FROM\s+\S*php:(5|7|8\.[0-5])\b file:Dockerfile
FROM\s+\S*(composer|wordpress|drupal|nextcloud|serversideup|laravel|sail|bitnami/php-fpm|frankenphp)\S* file:Dockerfile
image:\s*\S*(php|composer|wordpress|drupal|nextcloud|serversideup|laravel|sail|bitnami/php-fpm)\S*:
php(5\.\d|7\.\d|8\.[0-5])-(fpm|cgi|cli)
php\{\{\s*\w+\s*\}\}-(fpm|cgi|cli)
php\$\{?\w+\}?-(fpm|cgi|cli)
\w*php_(version|packages)\b
\"php\"\s*: file:composer\.json$
libapache2-mod-php
frankenphp|lsphp
file:\.php-version$ .
php file:\.tool-versions$
upload_progress
```
- The query is a regex. Over REST, don't add a `regex` parameter: it made queries with alternation groups return 0 hits.
- Escape double quotes (`\"`); unescaped quotes return 0 hits.
- The `image:` query has no `file:` filter, so it also covers Compose files and Kubernetes manifests.
- Returns one result per matching line, with `ref` set to the branch name. Deduplicate by `project_id` and `path` before you count files.
- Lowercase queries match case-insensitively, so `PHP_VERSION` in templates also matches. Pages that print it help humans verify the running version; they aren't findings.
- Before you trust a 0-hit result, test the regex on a file you know contains the pattern, or simplify it until it matches.
**Calls** (see the [Search API](https://docs.gitlab.com/api/search/) for result fields):
- GitLab Duo Agent Platform: the built-in search (blobs) and file-reading tools with the same queries.
- GitLab MCP server: `search` with `scope: blobs` and `group_id`; `get_repository_file` to read files.
- glab (`<group>` is the numeric ID or the URL-encoded full path):
```shell
glab api "groups/<group>/projects?include_subgroups=true&per_page=100" --paginate \
| jq -r '.[] | [.id, .path_with_namespace, .default_branch, .archived, .empty_repo] | @tsv'
q=$(jq -rn --arg q 'ondrej | sury | rpms.remirepo.net | remi-release' '$q|@uri')
glab api "groups/<group>/search?scope=blobs&search_type=advanced&search=${q}&per_page=100" --paginate \
| jq -r '.[] | "\(.project_id)\t\(.path):\(.startline)"'
q=$(jq -rn --arg q 'FROM\s+\S*php:(5|7|8\.[0-5])\b file:Dockerfile' '$q|@uri')
glab api "groups/<group>/search?scope=blobs&search_type=zoekt&search=${q}&per_page=100" --paginate
glab api "projects/<project-id>/ci/lint?dry_run=false" | jq -r '.merged_yaml' > merged.yml
```
**Rate limits:** URL-encode every query, pause about 3 seconds between searches, retry once on a 5xx response, and back off on HTTP 429. The `Ratelimit-*` headers show the general API throttle, not the lower search limit.
**Links:** resolve the default branch HEAD once per project (`glab api "projects/<id>/repository/branches/<default>" | jq -r .commit.id`) and link every finding as `-/blob/<sha>/<path>#L<line>`. Don't use the search result `ref`: advanced search can return older commit SHAs. `startline` can point before the matching line, in advanced search and exact code search: snippets include leading context; add the index of the matching line in `data`, or open the file and link the exact line.
### Parse the merged CI configuration
`jq` can't read YAML. Check which parser actually runs (`yq --version`, `ruby -v`, `python3 -c 'import yaml'`) and use the first one that works; a version manager shim on `PATH` can exist and still fail.
- **yq** (mikefarah, v4): `brew install yq`, `apt install yq` (Ubuntu 24.04+), `snap install yq`, or `docker run --rm -i mikefarah/yq:4 -r '<expression>' < merged.yml`.
```shell
yq -r '[.. | select(tag == "!!map" and has("image")) | .image | select(tag == "!!str") // .name]
+ [.. | select(tag == "!!map" and has("services")) | .services[] | select(tag == "!!str") // .name]
| map(select(. != null)) | unique | .[]' merged.yml
```
- **Ruby** (preinstalled on macOS, `apt install ruby`):
```shell
ruby -ryaml -e '
imgs = []
seen = {}
walk = ->(n) {
next if seen[n.object_id]
seen[n.object_id] = true
case n
when Hash
i = n["image"]; imgs << (i.is_a?(Hash) ? i["name"] : i) if i
n["services"].each { |s| imgs << (s.is_a?(Hash) ? s["name"] : s) } if n["services"].is_a?(Array)
n.each_value { |v| walk.(v) }
when Array then n.each { |v| walk.(v) }
end
}
walk.(YAML.safe_load(ARGF.read, aliases: true))
puts imgs.compact.uniq' merged.yml
```
The walker skips objects it already visited: YAML anchors in projects you don't own can otherwise make it run for an exponentially long time.
If no parser works, read the merged YAML and list the `image:` and `services:` entries manually, and say so in the gaps. Values such as `$SAST_ANALYZER_IMAGE` are template variables, not PHP images.
## Orbit queries
Orbit answers group-wide questions in one query instead of one search or API call per project. The Orbit MCP server exposes `list_commands` and `invoke_command` (`orbit_list_commands` and `orbit_invoke_command` in Duo Agent Platform); run queries with the `query_graph` command.
1. **Discover first.** Run `list_commands`: its `query_graph` description names the query language for your account and its syntax limits. Then run `get_graph_schema`, and `CALL db.schema('<Node>')` (openCypher) or `get_query_dsl` (DSL) for the nodes you query. Don't guess node, property, or relationship names.
2. **Stay in scope.** Orbit returns everything the user can access, not only the scope. Get the project IDs with `(g:Group)-[:CONTAINS*1..3]->(p:Project)` and filter every query with `project_id IN [...]`.
3. **Query these questions.** The queries below are openCypher examples; adapt them to the language and limits that discovery returns.
- **Scanner findings:** the CVE ID is `VulnerabilityIdentifier.external_id`. `VulnerabilityOccurrence.cve` is a deduplication fingerprint, not a CVE ID. Occurrence names include the image and package, for example `CVE-… in registry…/app:php-8.5`.
```cypher
MATCH (o:VulnerabilityOccurrence)-[:HAS_IDENTIFIER]->(i:VulnerabilityIdentifier)
WHERE i.external_id IN ['CVE-2026-109618', 'CVE-2026-109619'] AND o.project_id IN [<ids>]
RETURN o.project_id, o.name, o.report_type, o.severity LIMIT 1000
```
Container Scanning findings come from built images and are stronger evidence than a declared version. If there are no findings, see the Container Scanning guidance in [Steps](#steps), step 6.
- **PHP code without a Dockerfile:** `MATCH (f:File) WHERE f.project_id IN [<ids>] AND f.language = 'php' RETURN f.project_id, count(f)` catches PHP that runtime searches miss.
- **Cross-references:** `(f:File)-[:CALLS]->(d:Definition)` and `(f:File)-[:IMPORTS]->(s:ImportedSymbol)` show which files use which classes and functions, for example code that calls `session_start`.
- **Deployments:** `(d:Deployment)-[:IN_PROJECT]->(p:Project)` and `Environment` nodes for projects with findings, with status, ref, SHA, and `external_url`.
4. Link each result to the project, file, or vulnerability in GitLab. Orbit code only covers the default branch, like code search.
5. If Orbit isn't enabled, isn't authenticated, or a query fails, continue without it.
## Actual-state checks
**With an IaC MCP server:**
- Run read-only queries directly: inventories, `get`/`describe`, image lists, package facts.
- Before any command that executes on hosts or in containers (for example `php -v` through Run Command or `kubectl exec`), show the command and target list and wait for the user's approval.
- Never change state: no deploys, restarts, package installs, or config changes.
- Mark results from the MCP server as "confirmed running", with the query as evidence.
**Check the SAPI that serves requests, not only the CLI.** `php -v` reports php-cli, which distributions package separately from PHP-FPM (`php<X.Y>-fpm`) and mod_php (`libapache2-mod-php<X.Y>`). Their versions can diverge, for example after a partial upgrade, and `update-alternatives` can point `php` to another branch than the one Apache or FPM loads. Check the package and binary of each serving SAPI, and which PHP module or FPM socket the web server actually uses. The mod_php module carries its version as a string: `grep -aoE "X-Powered-By: PHP/[0-9.]+" /usr/lib/apache2/modules/libphp*.so`. Each SAPI also reads its own `php.ini` (on Debian and Ubuntu, `/etc/php/<X.Y>/fpm/` and `/etc/php/<X.Y>/apache2/`), so check mitigations per SAPI. A running FPM master or Apache process keeps the old code until it restarts, so compare the process start time with the package install time.
**Without an MCP server,** write the check for the named tool. Target the host group from the playbook's `hosts:` with the real inventory. Example with Ansible, ad hoc:
```shell
ansible <group> -i <inventory> -b -m shell -a 'php -v | head -n1; php-fpm<X.Y> -v | head -n1; dpkg-query -W -f="\${Package} \${Version}\n" "php<X.Y>*" "libapache2-mod-php*" 2>/dev/null; apt-cache policy php<X.Y>-fpm | grep -E "Installed|500 "'
ansible <group> -i <inventory> -b -m shell -a 'apache2ctl -M 2>/dev/null | grep -i php; grep -aoE "X-Powered-By: PHP/[0-9.]+" /usr/lib/apache2/modules/libphp*.so | head -n1; ls -l /run/php/ 2>/dev/null; ps -o pid,lstart,cmd -C php-fpm<X.Y>,apache2 | head -n5; ls -l --time-style=long-iso /var/lib/dpkg/info/php<X.Y>-fpm.list /var/lib/dpkg/info/libapache2-mod-php<X.Y>.list 2>/dev/null'
ansible <group> -i <inventory> -b -m shell -a 'apt changelog php<X.Y>-fpm 2>/dev/null | grep -E "CVE-2026-10961[89]" || zgrep -hE "CVE-2026-10961[89]" /usr/share/doc/php<X.Y>-*/changelog.Debian.gz || echo "no PHP2Shell backport entry"'
ansible <group> -i <inventory> -b -m shell -a 'php-fpm<X.Y> -i 2>/dev/null | grep -E "^session.upload_progress.enabled"; grep -Hs "^session.upload_progress.enabled" /etc/php/<X.Y>/fpm/php.ini /etc/php/<X.Y>/apache2/php.ini'
```
If `dpkg-query` lists no PHP packages but `php` runs, PHP was built from source (for example the official `php:` images under `/usr/local`, with `PHP_VERSION` in the environment). The package and backport checks don't apply then; use the binary and module versions.
`apt-cache policy` shows whether the package comes from the distribution or a third-party repository. Wrap Go templates such as `docker ps --format '{{.Image}}'` in `{% raw %}…{% endraw %}` inside Ansible commands. For other tools, use the equivalent, for example Kubernetes (`kubectl get pods` for images, `kubectl exec … php-fpm -v`), AWS Systems Manager Inventory, or osquery. Terraform or OpenTofu state only provides the host list, not the installed packages.
## Documentation
Look up syntax and parameters here instead of guessing, and link the relevant page when you explain a search or a gap.
| Area | Links |
|---|---|
| GitLab search | [Advanced search](https://docs.gitlab.com/user/search/advanced_search/), [exact code search](https://docs.gitlab.com/user/search/exact_code_search/), [Search API](https://docs.gitlab.com/api/search/) |
| CI and deployments | [CI Lint API](https://docs.gitlab.com/api/lint/), [Environments API](https://docs.gitlab.com/api/environments/), [Container registry API](https://docs.gitlab.com/api/container_registry/) |
| Access | [GitLab Duo Agent Platform](https://docs.gitlab.com/user/duo_agent_platform/), [GitLab MCP server](https://docs.gitlab.com/user/gitlab_duo/model_context_protocol/mcp_server/), [glab CLI](https://docs.gitlab.com/cli/), [`glab api`](https://docs.gitlab.com/cli/api/) |
| GitLab Orbit | [Orbit](https://docs.gitlab.com/orbit/), [Orbit MCP access](https://docs.gitlab.com/orbit/remote/access/mcp/), [Orbit schema](https://docs.gitlab.com/orbit/remote/schema/) |
| Security follow-ups | [Dependency list](https://docs.gitlab.com/user/application_security/dependency_list/), [Container scanning](https://docs.gitlab.com/user/application_security/container_scanning/) |
| PHP2Shell | [PHP advisory](https://www.php.net/archive/2026.php#2026-10-21-5), [NCSC-NL PHP2Shell](https://github.com/NCSC-NL/php2shell) (detection, affected products) |
## Rules
- **Read-only.** Never create, change, or delete anything: no commits, MRs, issues, pipelines, or settings in GitLab, and no state changes through an IaC MCP server. Fixes are a separate, reviewed step.
- **Cite every finding** with project path, file path, and a link.
- **Separate "declared in code" from "confirmed running".** Mark anything unverified as unconfirmed. Never invent versions or hosts.
- **Make gaps visible.** List projects you couldn't read (permissions, empty default branch, no CI configuration), example-only inventories, reduced search coverage, and failed searches, instead of skipping them silently.
- **No secrets in the output.** If a file contains tokens or passwords, say so without printing the values.
- **Label noise.** Mark hits in documentation, test fixtures, examples, and archived projects as noise. Hits in `skills/**/SKILL.md` (including this skill) are always noise.
- **Stay on PHP2Shell.** Don't report other vulnerabilities or unrelated outdated dependencies.
## Output
1. **Findings table**, ranked by risk:
| Project | File | PHP version | Deployment | Status | Evidence | Confidence | Next step |
|---|---|---|---|---|---|---|---|
2. **Summary:** number of affected projects; the highest-risk findings; days remaining until the due date and which findings can realistically be fixed or mitigated by then; gaps in the search.
3. **Next steps the agent can run with approval:** read-only checks this run skipped because they need the user's approval, for example commands on hosts or in containers through the IaC MCP server. List each command with its targets. Omit the section when there are none.
4. **Follow-up checks for humans,** grouped by project or owner. Include the exact commands for the named IaC tool to confirm the running PHP version, unless the IaC MCP server already confirmed it. Without an IaC tool, only list what needs confirming.
5. **Data sources:** a short list of the sources this run used, for example Duo Agent Platform tools, GitLab MCP server, glab, Orbit, advanced or exact code search, CI lint, vulnerability report, IaC MCP server, and web search.
If the report lists next steps that need approval, end it with one question asking which of them to run, after the data sources.
This file is included in the downloadable package, but it can't be previewed as text.
MIT License
Copyright (c) 2026 GitLab B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Find PHP2Shell exposure across your GitLab projects
Ask an agent to find where PHP runs across your GitLab projects and help you decide what to patch first. The `php2shell-inventory` skill investigates PHP2Shell (`CVE-2026-109618` and `CVE-2026-109619`) without changing your code or deployments.
For the wider investigation and remediation process, see GitLab's [PHP2Shell guide](https://about.gitlab.com/blog/gitlab-helps-remediate-critical-php-flaws/).
## Install the skill and start an investigation
You'll need an agent with GitLab access. With GitLab Duo Agent Platform, the skill uses the agent's available GitLab tools. In your terminal, you can use GitLab Duo CLI with an authenticated `glab` session (`glab auth login`). Other agents can connect through the GitLab MCP server or `glab`. Orbit is optional.
1. Download the package from **Download package**. Put `php2shell-inventory.zip` in the repository where you'll start your agent, then extract it into the project's `skills` directory:
```shell
mkdir -p skills/php2shell-inventory
unzip php2shell-inventory.zip -d skills/php2shell-inventory
```
The agent instructions will be at `skills/php2shell-inventory/SKILL.md`.
2. Start GitLab Duo CLI from that repository:
```shell
glab duo cli
```
For another agent that supports Skills, place the package in that agent's skill discovery directory instead.
3. Ask the agent to use the skill. The public PHP Status Board project gives you a concrete starting point:
```text
Use the php2shell-inventory skill to review the
gitlab-da/demo-environments/tanuki-iot-platform/frontend/php-status-board project.
Our patch deadline is next Friday.
Tell me which PHP versions are declared, which deployments or scans support
those findings, and what still needs checking. Keep the investigation read-only.
```
For your own investigation, substitute a project or group path, say whether to include subgroups, and give your team's patch deadline.
## Work through the findings
The agent returns a prioritized table of PHP versions, affected projects, source links, and next checks. It separates versions declared in code from those confirmed in running workloads. Floating image tags, unconfirmed distribution backports, and missing deployment records may leave findings marked `unknown`. An empty scanner report alone doesn't establish that PHP is patched.
Follow up on anything the agent couldn't confirm. For example:
```text
Which projects couldn't you inspect? We manage our hosts with Ansible.
Suggest read-only checks to confirm the PHP versions serving web requests.
```
Substitute your infrastructure tool if you use something else. If a connected tool can execute checks on hosts or containers, the skill asks for approval first. Patching and deployment remain separate tasks; afterward, repeat the inventory to see what still needs attention.
## Further reading
- [PHP's security advisory](https://www.php.net/archive/2026.php#2026-10-21-5) lists affected versions, fixes, and mitigations.
- [The original skill](https://gitlab.com/gitlab-da/demo-environments/tanuki-iot-platform/frontend/php-status-board/-/tree/main/skills/php2shell-inventory) by GitLab's Developer Advocacy team is available under the [MIT license](LICENSE).
---
name: php2shell-inventory
description: Inventory where PHP runs across GitLab groups and projects to assess exposure to PHP2Shell (CVE-2026-109618, CVE-2026-109619), for example "where are we affected by PHP2Shell?". Use it for PHP2Shell triage and patch prioritization, read-only through GitLab Duo Agent Platform, the GitLab MCP server, or the glab CLI, plus GitLab Orbit when available. Do not use it to fix, upgrade, or deploy anything, or for other vulnerabilities.
---
# PHP2Shell Inventory
Find where a PHP runtime is declared in GitLab, separate what the code declares from what actually runs, and hand over a cited, prioritized list of projects that may be exposed to PHP2Shell.
## Advisory
- **PHP2Shell:** CVE-2026-109618, CVE-2026-109619, CVSS 9.2 (v4.0). Unauthenticated remote code execution.
- **Source:** [PHP security advisory, 2026-10-21](https://www.php.net/archive/2026.php#2026-10-21-5).
- **Fixed versions** (anything older on the same branch is affected):
| Branch | Fixed in |
|---|---|
| 8.5 | 8.5.12 |
| 8.4 | 8.4.27 |
| 8.3 | 8.3.36 |
| 8.2 | 8.2.35 |
| 8.1 and older | No release (EOL). The PHP security team published minimal source backports for [7.4](https://github.com/php/php-src/tree/PHP-7.4-CVE-2026-109618-109619), [8.0](https://github.com/php/php-src/tree/PHP-8.0-CVE-2026-109618-109619), and [8.1](https://github.com/php/php-src/tree/PHP-8.1-CVE-2026-109618-109619); vendors may ship backported packages. |
The table tracks known fixes from the [PHP advisory](https://www.php.net/archive/2026.php#2026-10-21-5). Use web search to verify older patch levels in different distributions.
- **Risk order** (highest first): web-facing mod_php (`php:<v>-apache`, `libapache2-mod-php`), then PHP-FPM, php-cgi, FrankenPHP, and LiteSpeed serving web requests, then CLI-only use (cron jobs, CI jobs). Within each level, rank internet-facing, credential-holding, unmaintained, and EOL-branch deployments first.
- **Temporary mitigations** (not a fix): disable `session.upload_progress`, restart workers, and review `memory_limit` and `post_max_size` per the advisory.
## Requirements
Check for GitLab access in this order and use the first one found:
1. **GitLab Duo Agent Platform.** Inside a Duo agent or flow, use its built-in GitLab tools. They act with the user's permissions; no MCP server, glab, or token is needed.
2. **GitLab MCP server** (search, files, CI lint).
3. **glab CLI** (`glab api` for REST calls). If `glab auth status` fails, ask the user to run `glab auth login`.
In addition, use **GitLab Orbit** when it's available: the Orbit MCP server (`https://gitlab.com/api/v4/orbit/mcp`, [setup](https://docs.gitlab.com/orbit/remote/access/mcp/)), or the Orbit tools in Duo Agent Platform (`orbit_list_commands`, `orbit_invoke_command`) when an administrator enabled Orbit ([setup](https://docs.gitlab.com/orbit/remote/access/duo/)). Orbit is a graph of the group's projects, pipelines, deployments, vulnerabilities, and default-branch code, including definitions and cross-file imports. It complements search and CI lint; it doesn't replace them. See [Orbit queries](#orbit-queries).
Results only cover projects the user can access. Advanced search across groups needs Premium or Ultimate; exact code search (regex) only works where it is enabled.
If no access option is available, stop and tell the user how to set one up. Don't scrape the web UI. If advanced or exact code search isn't available, ask the user to inspect a local Git clone or to provide another search option, or fall back to per-project tree listings and file reads through the API (`glab api` or `curl`). Report the reduced coverage as a gap.
## Inputs
| Input | Example |
|---|---|
| Scope | GitLab group `gitlab-com` including subgroups, or a list of projects |
| Due date | Patch due date set by the security team |
| IaC tool (optional) | Ansible, Salt, Puppet, Chef, AWS Systems Manager, kubectl |
| IaC MCP server (optional) | The MCP server for that tool, for example for Kubernetes, AWS, or Ansible |
Ask for the scope and the due date if they are missing. Don't ask for the IaC tool or its MCP server; use them only when the user names them:
- **MCP server named and available:** run the [actual-state checks](#actual-state-checks) through it.
- **Only the tool named, or the MCP server unavailable:** write the actual-state commands for that tool.
- **Neither named:** skip the actual-state commands.
## Steps
1. **List the projects in scope** with ID, path, default branch, archived, and empty-repository state. Use the list to map `project_id` to `path_with_namespace` and to run CI lint per project. Report empty or unreadable projects as gaps; label hits in archived projects as noise.
2. **Search the declared state.** Run every query in [Search syntax](#search-syntax) across the scope. They cover these layers: container images and images that bundle PHP, OS packages (including templated names), third-party repositories, configuration management variables, version pins, PaaS runtimes, and the `upload_progress` mitigation. For templated package names, read the variables that fill them.
3. **Resolve the CI configuration.** Run CI lint for every project in scope, because includes can add PHP to projects without PHP code. [Parse `merged_yaml`](#parse-the-merged-ci-configuration) and collect only `image:`, `image.name`, and `services:` values that contain `php` or an image that bundles PHP, including top-level and `default:`. Don't grep the raw YAML: SAST rules, `$PHPIZE_DEPS`, and `docker-php-ext-*` scripts add noise. `valid: false` with "Please provide content of .gitlab-ci.yml" means the project has no CI configuration; report it as a gap.
4. **Read the evidence.** Open the matching files and extract the exact PHP version, the deployment type (container, VM, PaaS, Kubernetes), and the SAPI:
- `php:<v>-apache` images run mod_php, `php:<v>-fpm` images and `phpX.Y-fpm` packages run PHP-FPM, `php:<v>-cli` is CLI only.
- A floating image tag (`php:8.3`, `php:latest`) is only patched after a rebuild.
- The dependency list doesn't show the PHP version: Dependency Scanning SBOMs from `composer.lock` omit the `php` runtime and its extensions.
- Mitigation: check whether FPM pools, `php.ini` templates, or Dockerfiles set `session.upload_progress.enabled = Off`.
5. **Collect deployment evidence in GitLab** for every project with a finding: environments (production first), their deployments and deploy jobs, container registry tags of images built from a Dockerfile with PHP, and Container Scanning findings for CVE-2026-109618 or CVE-2026-109619 (Orbit, or the project's vulnerability report). Choose the calls yourself with your GitLab tools, and don't print secrets from job logs. A deploy job defined in YAML is not evidence that it ran, and a deployment record without a linked job (created through the API) is weak evidence: it shows that something was recorded, not what runs. Missing evidence, or evidence that only points to example hosts, is a gap, not proof that nothing runs.
6. **Classify each finding** against the fixed versions:
- **Status:** affected, fixed, or unknown (for example a floating tag, or a package whose fix isn't confirmed).
- **Confidence:** high (exact version in a deployed config), medium (version range or floating tag), low (documentation or unclear context).
- Official `php:` Docker images are built from upstream source and never carry distribution backports.
- **Missing Container Scanning findings are not proof of a fix.** If Container Scanning reports no PHP2Shell finding for an image that runs PHP, don't mark it fixed. Some scanners, for example Trivy, only match packages recorded by the OS package manager and may miss PHP compiled from source, as in the official `php:` images (installed under `/usr/local`). The scan may also predate the advisory data. Classify by the PHP version in the Dockerfile or the image's `PHP_VERSION` instead, and mention in the gaps that the scanner may not cover this image. Add a follow-up check for humans: read `PHP_VERSION` from the image config (`docker inspect`, `crane config`), or scan the image with a tool that reads PHP binaries, such as Syft or Grype.
- Distributions and third-party repositories (Ubuntu, Debian, RHEL, `ppa:ondrej/php`, sury, remi) may backport the fix without changing the upstream version number. Check which repository URI is actually configured: the Launchpad PPA (`ppa.launchpadcontent.net/ondrej/php`) and `packages.sury.org` are separate archives and can publish fixes at different times. Use web search, if available, to check the package's support or EOL status and whether the packaged version contains the fix, and cite the sources. Without a confirmed fix, keep the status unknown.
7. **Rank** the findings by the risk order in the [Advisory](#advisory).
8. **Hand over the actual-state check.** Code shows what should run, not what does run. Mark VMs and hosts as unconfirmed instead of assuming the version. Example inventories and example hosts (`*.example.*`, `example.com`, "no real hosts") are gaps, not host lists. Add the [actual-state checks](#actual-state-checks) according to the Inputs.
## Search syntax
Code search only covers the **default branch**. Always pass the search type explicitly: without it, GitLab may pick exact code search, where the advanced syntax (`|`, `filename:`) doesn't apply and OR queries return 0 hits.
**Advanced search** (`search_type=advanced`):
```text
"FROM php" filename:Dockerfile*
php7.4-fpm | php8.0-fpm | php8.1-fpm | php8.2-fpm | php8.3-fpm | php8.4-fpm | php8.5-fpm | libapache2-mod-php
ondrej | sury | rpms.remirepo.net | remi-release
"runtime: php" | buildpack
```
- Returns one snippet per file: treat a hit as "this file matches" and read the whole file.
- Tokenizes on `_` and drops quotes and colons, so use exact code search for variable names and JSON keys.
- Quote multi-word terms: unquoted `FROM php` matches any file that contains both words.
- Don't search a bare `remi`: it matches inside words.
**Exact code search** (`search_type=zoekt`):
```text
FROM\s+\S*php:(5|7|8\.[0-5])\b file:Dockerfile
FROM\s+\S*(composer|wordpress|drupal|nextcloud|serversideup|laravel|sail|bitnami/php-fpm|frankenphp)\S* file:Dockerfile
image:\s*\S*(php|composer|wordpress|drupal|nextcloud|serversideup|laravel|sail|bitnami/php-fpm)\S*:
php(5\.\d|7\.\d|8\.[0-5])-(fpm|cgi|cli)
php\{\{\s*\w+\s*\}\}-(fpm|cgi|cli)
php\$\{?\w+\}?-(fpm|cgi|cli)
\w*php_(version|packages)\b
\"php\"\s*: file:composer\.json$
libapache2-mod-php
frankenphp|lsphp
file:\.php-version$ .
php file:\.tool-versions$
upload_progress
```
- The query is a regex. Over REST, don't add a `regex` parameter: it made queries with alternation groups return 0 hits.
- Escape double quotes (`\"`); unescaped quotes return 0 hits.
- The `image:` query has no `file:` filter, so it also covers Compose files and Kubernetes manifests.
- Returns one result per matching line, with `ref` set to the branch name. Deduplicate by `project_id` and `path` before you count files.
- Lowercase queries match case-insensitively, so `PHP_VERSION` in templates also matches. Pages that print it help humans verify the running version; they aren't findings.
- Before you trust a 0-hit result, test the regex on a file you know contains the pattern, or simplify it until it matches.
**Calls** (see the [Search API](https://docs.gitlab.com/api/search/) for result fields):
- GitLab Duo Agent Platform: the built-in search (blobs) and file-reading tools with the same queries.
- GitLab MCP server: `search` with `scope: blobs` and `group_id`; `get_repository_file` to read files.
- glab (`<group>` is the numeric ID or the URL-encoded full path):
```shell
glab api "groups/<group>/projects?include_subgroups=true&per_page=100" --paginate \
| jq -r '.[] | [.id, .path_with_namespace, .default_branch, .archived, .empty_repo] | @tsv'
q=$(jq -rn --arg q 'ondrej | sury | rpms.remirepo.net | remi-release' '$q|@uri')
glab api "groups/<group>/search?scope=blobs&search_type=advanced&search=${q}&per_page=100" --paginate \
| jq -r '.[] | "\(.project_id)\t\(.path):\(.startline)"'
q=$(jq -rn --arg q 'FROM\s+\S*php:(5|7|8\.[0-5])\b file:Dockerfile' '$q|@uri')
glab api "groups/<group>/search?scope=blobs&search_type=zoekt&search=${q}&per_page=100" --paginate
glab api "projects/<project-id>/ci/lint?dry_run=false" | jq -r '.merged_yaml' > merged.yml
```
**Rate limits:** URL-encode every query, pause about 3 seconds between searches, retry once on a 5xx response, and back off on HTTP 429. The `Ratelimit-*` headers show the general API throttle, not the lower search limit.
**Links:** resolve the default branch HEAD once per project (`glab api "projects/<id>/repository/branches/<default>" | jq -r .commit.id`) and link every finding as `-/blob/<sha>/<path>#L<line>`. Don't use the search result `ref`: advanced search can return older commit SHAs. `startline` can point before the matching line, in advanced search and exact code search: snippets include leading context; add the index of the matching line in `data`, or open the file and link the exact line.
### Parse the merged CI configuration
`jq` can't read YAML. Check which parser actually runs (`yq --version`, `ruby -v`, `python3 -c 'import yaml'`) and use the first one that works; a version manager shim on `PATH` can exist and still fail.
- **yq** (mikefarah, v4): `brew install yq`, `apt install yq` (Ubuntu 24.04+), `snap install yq`, or `docker run --rm -i mikefarah/yq:4 -r '<expression>' < merged.yml`.
```shell
yq -r '[.. | select(tag == "!!map" and has("image")) | .image | select(tag == "!!str") // .name]
+ [.. | select(tag == "!!map" and has("services")) | .services[] | select(tag == "!!str") // .name]
| map(select(. != null)) | unique | .[]' merged.yml
```
- **Ruby** (preinstalled on macOS, `apt install ruby`):
```shell
ruby -ryaml -e '
imgs = []
seen = {}
walk = ->(n) {
next if seen[n.object_id]
seen[n.object_id] = true
case n
when Hash
i = n["image"]; imgs << (i.is_a?(Hash) ? i["name"] : i) if i
n["services"].each { |s| imgs << (s.is_a?(Hash) ? s["name"] : s) } if n["services"].is_a?(Array)
n.each_value { |v| walk.(v) }
when Array then n.each { |v| walk.(v) }
end
}
walk.(YAML.safe_load(ARGF.read, aliases: true))
puts imgs.compact.uniq' merged.yml
```
The walker skips objects it already visited: YAML anchors in projects you don't own can otherwise make it run for an exponentially long time.
If no parser works, read the merged YAML and list the `image:` and `services:` entries manually, and say so in the gaps. Values such as `$SAST_ANALYZER_IMAGE` are template variables, not PHP images.
## Orbit queries
Orbit answers group-wide questions in one query instead of one search or API call per project. The Orbit MCP server exposes `list_commands` and `invoke_command` (`orbit_list_commands` and `orbit_invoke_command` in Duo Agent Platform); run queries with the `query_graph` command.
1. **Discover first.** Run `list_commands`: its `query_graph` description names the query language for your account and its syntax limits. Then run `get_graph_schema`, and `CALL db.schema('<Node>')` (openCypher) or `get_query_dsl` (DSL) for the nodes you query. Don't guess node, property, or relationship names.
2. **Stay in scope.** Orbit returns everything the user can access, not only the scope. Get the project IDs with `(g:Group)-[:CONTAINS*1..3]->(p:Project)` and filter every query with `project_id IN [...]`.
3. **Query these questions.** The queries below are openCypher examples; adapt them to the language and limits that discovery returns.
- **Scanner findings:** the CVE ID is `VulnerabilityIdentifier.external_id`. `VulnerabilityOccurrence.cve` is a deduplication fingerprint, not a CVE ID. Occurrence names include the image and package, for example `CVE-… in registry…/app:php-8.5`.
```cypher
MATCH (o:VulnerabilityOccurrence)-[:HAS_IDENTIFIER]->(i:VulnerabilityIdentifier)
WHERE i.external_id IN ['CVE-2026-109618', 'CVE-2026-109619'] AND o.project_id IN [<ids>]
RETURN o.project_id, o.name, o.report_type, o.severity LIMIT 1000
```
Container Scanning findings come from built images and are stronger evidence than a declared version. If there are no findings, see the Container Scanning guidance in [Steps](#steps), step 6.
- **PHP code without a Dockerfile:** `MATCH (f:File) WHERE f.project_id IN [<ids>] AND f.language = 'php' RETURN f.project_id, count(f)` catches PHP that runtime searches miss.
- **Cross-references:** `(f:File)-[:CALLS]->(d:Definition)` and `(f:File)-[:IMPORTS]->(s:ImportedSymbol)` show which files use which classes and functions, for example code that calls `session_start`.
- **Deployments:** `(d:Deployment)-[:IN_PROJECT]->(p:Project)` and `Environment` nodes for projects with findings, with status, ref, SHA, and `external_url`.
4. Link each result to the project, file, or vulnerability in GitLab. Orbit code only covers the default branch, like code search.
5. If Orbit isn't enabled, isn't authenticated, or a query fails, continue without it.
## Actual-state checks
**With an IaC MCP server:**
- Run read-only queries directly: inventories, `get`/`describe`, image lists, package facts.
- Before any command that executes on hosts or in containers (for example `php -v` through Run Command or `kubectl exec`), show the command and target list and wait for the user's approval.
- Never change state: no deploys, restarts, package installs, or config changes.
- Mark results from the MCP server as "confirmed running", with the query as evidence.
**Check the SAPI that serves requests, not only the CLI.** `php -v` reports php-cli, which distributions package separately from PHP-FPM (`php<X.Y>-fpm`) and mod_php (`libapache2-mod-php<X.Y>`). Their versions can diverge, for example after a partial upgrade, and `update-alternatives` can point `php` to another branch than the one Apache or FPM loads. Check the package and binary of each serving SAPI, and which PHP module or FPM socket the web server actually uses. The mod_php module carries its version as a string: `grep -aoE "X-Powered-By: PHP/[0-9.]+" /usr/lib/apache2/modules/libphp*.so`. Each SAPI also reads its own `php.ini` (on Debian and Ubuntu, `/etc/php/<X.Y>/fpm/` and `/etc/php/<X.Y>/apache2/`), so check mitigations per SAPI. A running FPM master or Apache process keeps the old code until it restarts, so compare the process start time with the package install time.
**Without an MCP server,** write the check for the named tool. Target the host group from the playbook's `hosts:` with the real inventory. Example with Ansible, ad hoc:
```shell
ansible <group> -i <inventory> -b -m shell -a 'php -v | head -n1; php-fpm<X.Y> -v | head -n1; dpkg-query -W -f="\${Package} \${Version}\n" "php<X.Y>*" "libapache2-mod-php*" 2>/dev/null; apt-cache policy php<X.Y>-fpm | grep -E "Installed|500 "'
ansible <group> -i <inventory> -b -m shell -a 'apache2ctl -M 2>/dev/null | grep -i php; grep -aoE "X-Powered-By: PHP/[0-9.]+" /usr/lib/apache2/modules/libphp*.so | head -n1; ls -l /run/php/ 2>/dev/null; ps -o pid,lstart,cmd -C php-fpm<X.Y>,apache2 | head -n5; ls -l --time-style=long-iso /var/lib/dpkg/info/php<X.Y>-fpm.list /var/lib/dpkg/info/libapache2-mod-php<X.Y>.list 2>/dev/null'
ansible <group> -i <inventory> -b -m shell -a 'apt changelog php<X.Y>-fpm 2>/dev/null | grep -E "CVE-2026-10961[89]" || zgrep -hE "CVE-2026-10961[89]" /usr/share/doc/php<X.Y>-*/changelog.Debian.gz || echo "no PHP2Shell backport entry"'
ansible <group> -i <inventory> -b -m shell -a 'php-fpm<X.Y> -i 2>/dev/null | grep -E "^session.upload_progress.enabled"; grep -Hs "^session.upload_progress.enabled" /etc/php/<X.Y>/fpm/php.ini /etc/php/<X.Y>/apache2/php.ini'
```
If `dpkg-query` lists no PHP packages but `php` runs, PHP was built from source (for example the official `php:` images under `/usr/local`, with `PHP_VERSION` in the environment). The package and backport checks don't apply then; use the binary and module versions.
`apt-cache policy` shows whether the package comes from the distribution or a third-party repository. Wrap Go templates such as `docker ps --format '{{.Image}}'` in `{% raw %}…{% endraw %}` inside Ansible commands. For other tools, use the equivalent, for example Kubernetes (`kubectl get pods` for images, `kubectl exec … php-fpm -v`), AWS Systems Manager Inventory, or osquery. Terraform or OpenTofu state only provides the host list, not the installed packages.
## Documentation
Look up syntax and parameters here instead of guessing, and link the relevant page when you explain a search or a gap.
| Area | Links |
|---|---|
| GitLab search | [Advanced search](https://docs.gitlab.com/user/search/advanced_search/), [exact code search](https://docs.gitlab.com/user/search/exact_code_search/), [Search API](https://docs.gitlab.com/api/search/) |
| CI and deployments | [CI Lint API](https://docs.gitlab.com/api/lint/), [Environments API](https://docs.gitlab.com/api/environments/), [Container registry API](https://docs.gitlab.com/api/container_registry/) |
| Access | [GitLab Duo Agent Platform](https://docs.gitlab.com/user/duo_agent_platform/), [GitLab MCP server](https://docs.gitlab.com/user/gitlab_duo/model_context_protocol/mcp_server/), [glab CLI](https://docs.gitlab.com/cli/), [`glab api`](https://docs.gitlab.com/cli/api/) |
| GitLab Orbit | [Orbit](https://docs.gitlab.com/orbit/), [Orbit MCP access](https://docs.gitlab.com/orbit/remote/access/mcp/), [Orbit schema](https://docs.gitlab.com/orbit/remote/schema/) |
| Security follow-ups | [Dependency list](https://docs.gitlab.com/user/application_security/dependency_list/), [Container scanning](https://docs.gitlab.com/user/application_security/container_scanning/) |
| PHP2Shell | [PHP advisory](https://www.php.net/archive/2026.php#2026-10-21-5), [NCSC-NL PHP2Shell](https://github.com/NCSC-NL/php2shell) (detection, affected products) |
## Rules
- **Read-only.** Never create, change, or delete anything: no commits, MRs, issues, pipelines, or settings in GitLab, and no state changes through an IaC MCP server. Fixes are a separate, reviewed step.
- **Cite every finding** with project path, file path, and a link.
- **Separate "declared in code" from "confirmed running".** Mark anything unverified as unconfirmed. Never invent versions or hosts.
- **Make gaps visible.** List projects you couldn't read (permissions, empty default branch, no CI configuration), example-only inventories, reduced search coverage, and failed searches, instead of skipping them silently.
- **No secrets in the output.** If a file contains tokens or passwords, say so without printing the values.
- **Label noise.** Mark hits in documentation, test fixtures, examples, and archived projects as noise. Hits in `skills/**/SKILL.md` (including this skill) are always noise.
- **Stay on PHP2Shell.** Don't report other vulnerabilities or unrelated outdated dependencies.
## Output
1. **Findings table**, ranked by risk:
| Project | File | PHP version | Deployment | Status | Evidence | Confidence | Next step |
|---|---|---|---|---|---|---|---|
2. **Summary:** number of affected projects; the highest-risk findings; days remaining until the due date and which findings can realistically be fixed or mitigated by then; gaps in the search.
3. **Next steps the agent can run with approval:** read-only checks this run skipped because they need the user's approval, for example commands on hosts or in containers through the IaC MCP server. List each command with its targets. Omit the section when there are none.
4. **Follow-up checks for humans,** grouped by project or owner. Include the exact commands for the named IaC tool to confirm the running PHP version, unless the IaC MCP server already confirmed it. Without an IaC tool, only list what needs confirming.
5. **Data sources:** a short list of the sources this run used, for example Duo Agent Platform tools, GitLab MCP server, glab, Orbit, advanced or exact code search, CI lint, vulnerability report, IaC MCP server, and web search.
If the report lists next steps that need approval, end it with one question asking which of them to run, after the data sources.