everything-gemini 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BENCHMARK.md +30 -30
- package/CHANGELOG.md +21 -0
- package/README.md +36 -2
- package/agents/cross-repo-orchestrator.md +33 -0
- package/agents/darwin-prompt-engineer.md +35 -0
- package/bin/everything-gemini +234 -9
- package/docs/LAUNCH_KIT_PHP2SHELL.md +240 -0
- package/docs/LAUNCH_KIT_v2.6.0.md +174 -0
- package/docs/index.html +27 -13
- package/examples/python-sdk/cross_repo_swarm_and_compaction.py +175 -0
- package/hooks/context-compactor/hooks.json +16 -0
- package/hooks/context-compactor/scripts/compact-context.sh +40 -0
- package/package.json +1 -1
- package/skills/adversarial-fuzz-generator/SKILL.md +95 -0
- package/skills/context-distillation-compressor/SKILL.md +109 -0
- package/skills/cross-repo-swarm-sync/SKILL.md +122 -0
- package/skills/cve-remediation-orchestrator/SKILL.md +111 -0
- package/skills/cve-remediation-orchestrator/scripts/verify-host-hardening.sh +72 -0
- package/skills/ebpf-microvm-sandbox/SKILL.md +113 -0
- package/skills/gemini-live-screen-vision/SKILL.md +109 -0
- package/skills/genetic-prompt-cross-pollinator/SKILL.md +110 -0
- package/skills/instinct-distillation-compiler/SKILL.md +103 -0
- package/skills/php2shell-version-auditor/SKILL.md +95 -0
- package/skills/phpcheck-server/SKILL.md +102 -0
- package/skills/phpcheck-server/scripts/audit-server.sh +112 -0
- package/skills/phpcheck-url/SKILL.md +72 -0
- package/skills/phpcheck-url/scripts/phpcheck.js +160 -0
- package/skills/speculative-decoding-orchestrator/SKILL.md +108 -0
- package/tests/cli.test.js +99 -16
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: php2shell-version-auditor
|
|
3
|
+
description: >-
|
|
4
|
+
Orchestrates end-to-end vulnerability auditing, fleet triage, and patch verification for PHP2Shell (CVE-2026-109618 and CVE-2026-109619). Use when assessing infrastructure exposure, performing non-intrusive remote banner audits, verifying local OS vendor backports, or validating web worker restarts.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PHP2Shell Vulnerability & Patch Auditor (`php2shell-version-auditor`)
|
|
8
|
+
|
|
9
|
+
An enterprise-grade, non-intrusive security auditor and fleet triage runbook for **PHP2Shell** (**CVE-2026-109618** and **CVE-2026-109619**), rated CVSS 9.2 (Critical Remote Code Execution and Memory Exposure).
|
|
10
|
+
|
|
11
|
+
## Vulnerability Overview
|
|
12
|
+
On October 21, 2026, the PHP core security team and upstream maintainers disclosed two critical vulnerabilities affecting standard PHP runtimes across all unpatched branches:
|
|
13
|
+
- **CVE-2026-109618**: Remote memory corruption and execution vulnerability in stream handling and buffer boundaries.
|
|
14
|
+
- **CVE-2026-109619**: Out-of-bounds read and memory disclosure enabling authorization bypass or remote execution.
|
|
15
|
+
|
|
16
|
+
Upstream patched releases: **8.2.35**, **8.3.36**, **8.4.27**, and **8.5.12**. Older unmaintained branches (5.4–5.6, 7.0–7.4, 8.0, 8.1) are inherently vulnerable unless protected by vendor enterprise backports (Ubuntu Pro, Red Hat ELS).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Defensive Triage Lifecycle
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
graph TD
|
|
24
|
+
A[Triage Target Identified] --> B{Server Access Available?}
|
|
25
|
+
B -- No / External Audit --> C[Run phpcheck-url Remote Audit]
|
|
26
|
+
C --> D{Disclosed PHP Version?}
|
|
27
|
+
D -- Version < Fixed --> E[POTENTIALLY VULNERABLE Flagged]
|
|
28
|
+
D -- Version >= Fixed --> F[OK - Remote Banner Patched]
|
|
29
|
+
D -- Hidden / Stripped --> G[UNKNOWN - Inspect Server Internals]
|
|
30
|
+
|
|
31
|
+
B -- Yes / Host Access --> H[Run phpcheck-server Deep Audit]
|
|
32
|
+
H --> I[Check OS Vendor Package Revisions]
|
|
33
|
+
H --> J[Inspect Active /proc/*/exe for Deleted Binaries]
|
|
34
|
+
I --> K{Vendor Advisory Met?}
|
|
35
|
+
K -- Yes --> L{Workers Restarted?}
|
|
36
|
+
K -- No --> M[CRITICAL: Upgrade Packages Immediately]
|
|
37
|
+
L -- Yes --> N[VERIFIED SECURE]
|
|
38
|
+
L -- No --> O[HIGH RISK: Restart PHP-FPM / Apache Daemons]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Sub-Skills & Components
|
|
44
|
+
This skill coordinates two specialized audit sub-skills:
|
|
45
|
+
1. [phpcheck-url](file:///Users/salmanshaikh/development/github/everything-gemini/skills/phpcheck-url/SKILL.md): Fast, non-intrusive HTTP header scanner for remote websites and API gateways.
|
|
46
|
+
2. [phpcheck-server](file:///Users/salmanshaikh/development/github/everything-gemini/skills/phpcheck-server/SKILL.md): Host and container scanner checking `dpkg`/`rpm` package revisions and running memory process states.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Zero-Install Audit Commands
|
|
51
|
+
|
|
52
|
+
### Remote Target Audit
|
|
53
|
+
```bash
|
|
54
|
+
# Terminal execution via Everything Gemini CLI
|
|
55
|
+
everything-gemini phpcheck "https://example.com"
|
|
56
|
+
|
|
57
|
+
# JSON telemetry output for automated CI/CD pipelines
|
|
58
|
+
everything-gemini phpcheck "https://example.com" --json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Server / Container Fleet Audit
|
|
62
|
+
```bash
|
|
63
|
+
# Run server audit
|
|
64
|
+
everything-gemini phpcheck --server
|
|
65
|
+
|
|
66
|
+
# Or run the native shell script
|
|
67
|
+
bash skills/phpcheck-server/scripts/audit-server.sh
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Remediation Checklist
|
|
73
|
+
|
|
74
|
+
1. **Update Packages**:
|
|
75
|
+
- Ubuntu / Debian: `sudo apt update && sudo apt install --only-upgrade php*-fpm php*-cli libapache2-mod-php*`
|
|
76
|
+
- RHEL / Rocky / Alma: `sudo dnf update php\*`
|
|
77
|
+
2. **Restart Daemons (Mandatory)**:
|
|
78
|
+
```bash
|
|
79
|
+
sudo systemctl restart 'php*-fpm'
|
|
80
|
+
sudo systemctl restart apache2 || sudo systemctl restart nginx
|
|
81
|
+
```
|
|
82
|
+
3. **Verify Active Process RAM**:
|
|
83
|
+
```bash
|
|
84
|
+
ls -l /proc/*/exe 2>/dev/null | grep -E '(php|apache|httpd).*\(deleted\)'
|
|
85
|
+
# Must return 0 lines!
|
|
86
|
+
```
|
|
87
|
+
4. **Harden HTTP Headers**:
|
|
88
|
+
In `php.ini`, set:
|
|
89
|
+
```ini
|
|
90
|
+
expose_php = Off
|
|
91
|
+
```
|
|
92
|
+
In `nginx.conf`:
|
|
93
|
+
```nginx
|
|
94
|
+
server_tokens off;
|
|
95
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: phpcheck-server
|
|
3
|
+
description: >-
|
|
4
|
+
Audits local server, host OS, containers, and running PHP-FPM or Apache processes for PHP2Shell vulnerabilities (CVE-2026-109618 and CVE-2026-109619). Use when verifying host packages, distribution backports, and active web worker process restarts across Debian, Ubuntu, RHEL, or Alpine.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PHP2Shell Server-Side Patch Auditor (`phpcheck-server`)
|
|
8
|
+
|
|
9
|
+
Provides comprehensive host-level and container-level auditing runbooks to verify remediation of the critical PHP2Shell vulnerabilities (**CVE-2026-109618** and **CVE-2026-109619**).
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
- When you have SSH, terminal, or container access to web servers running PHP.
|
|
13
|
+
- When verifying whether an `apt upgrade` or `dnf update` actually remediated the vulnerability or if running PHP-FPM / Apache workers are still executing vulnerable unlinked binaries in RAM.
|
|
14
|
+
- When validating vendor-specific security backports on LTS distributions (Debian, Ubuntu Pro, RHEL).
|
|
15
|
+
|
|
16
|
+
## Automated Server Audit Script
|
|
17
|
+
Execute the included server audit helper:
|
|
18
|
+
```bash
|
|
19
|
+
bash skills/phpcheck-server/scripts/audit-server.sh
|
|
20
|
+
bash skills/phpcheck-server/scripts/audit-server.sh --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or via Everything Gemini CLI:
|
|
24
|
+
```bash
|
|
25
|
+
everything-gemini phpcheck --server
|
|
26
|
+
everything-gemini phpcheck --server --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Step-by-Step Triage Runbook
|
|
32
|
+
|
|
33
|
+
### Step 1: Identify the Active Serving Runtime
|
|
34
|
+
Do not rely solely on the CLI binary (`php -v`), as the CLI binary often differs from the active worker pool (PHP-FPM, Apache `mod_php`, or Docker container).
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Check running FPM or web server processes
|
|
38
|
+
ps aux | grep -E 'php-fpm|apache2|httpd'
|
|
39
|
+
|
|
40
|
+
# Identify exact binary path for running worker
|
|
41
|
+
ls -l /proc/$(pgrep -f php-fpm | head -n1)/exe
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Check for the "Unlinked Worker" RAM Trap
|
|
45
|
+
If packages were upgraded on disk while daemons remained running, worker processes continue executing vulnerable code from RAM:
|
|
46
|
+
```bash
|
|
47
|
+
# Detect processes holding deleted shared libraries or binaries
|
|
48
|
+
ls -l /proc/*/exe 2>/dev/null | grep -E '(php|apache|httpd).*\(deleted\)'
|
|
49
|
+
```
|
|
50
|
+
If output is returned, you **must immediately restart the worker pool**:
|
|
51
|
+
```bash
|
|
52
|
+
sudo systemctl restart 'php*-fpm' || sudo systemctl restart apache2
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Vendor Fixed Package Matrix
|
|
58
|
+
|
|
59
|
+
### 1. Debian
|
|
60
|
+
Use `dpkg-query -W -f='${Package} ${Version}\n' 'php*'` to inspect installed packages.
|
|
61
|
+
|
|
62
|
+
| Debian Release | PHP Package | Fixed Package Version | Advisory |
|
|
63
|
+
| :--- | :--- | :--- | :--- |
|
|
64
|
+
| Debian 12 (bookworm) | `php8.2-fpm` | `8.2.35-1~deb12u1` | [DLA-4848-1](https://security-tracker.debian.org/tracker/DLA-4848-1) |
|
|
65
|
+
| Debian 13 (trixie) | `php8.4-fpm` | `8.4.27-1~deb13u1` | [DSA-6574-1](https://security-tracker.debian.org/tracker/DSA-6574-1) |
|
|
66
|
+
|
|
67
|
+
### 2. Ubuntu
|
|
68
|
+
Use `dpkg-query` to verify package revisions against Canonical Security Notices:
|
|
69
|
+
|
|
70
|
+
| Ubuntu Release | PHP Package | Fixed Package Version | Advisory |
|
|
71
|
+
| :--- | :--- | :--- | :--- |
|
|
72
|
+
| Ubuntu 26.10 | `php8.5` | `8.5.9-0ubuntu2.1` | [USN-8948-1](https://ubuntu.com/security/notices/USN-8948-1) |
|
|
73
|
+
| Ubuntu 26.04 LTS | `php8.5` | `8.5.4-0ubuntu1.5` | [USN-8948-1](https://ubuntu.com/security/notices/USN-8948-1) |
|
|
74
|
+
| Ubuntu 24.04 LTS | `php8.3` | `8.3.6-0ubuntu0.24.04.13` | [USN-8948-1](https://ubuntu.com/security/notices/USN-8948-1) |
|
|
75
|
+
| Ubuntu 22.04 LTS | `php8.1` | `8.1.2-1ubuntu2.28` | [USN-8948-1](https://ubuntu.com/security/notices/USN-8948-1) |
|
|
76
|
+
| Ubuntu 20.04 LTS (Pro) | `php7.4` | `7.4.3-4ubuntu2.29+esm5` | [USN-8948-2](https://ubuntu.com/security/notices/USN-8948-2) |
|
|
77
|
+
| Ubuntu 18.04 LTS (Pro) | `php7.2` | `7.2.24-0ubuntu0.18.04.17+esm14`| [USN-8948-2](https://ubuntu.com/security/notices/USN-8948-2) |
|
|
78
|
+
| Ubuntu 16.04 LTS (Pro) | `php7.0` | `7.0.33-0ubuntu0.16.04.16+esm22`| [USN-8948-2](https://ubuntu.com/security/notices/USN-8948-2) |
|
|
79
|
+
| Ubuntu 14.04 LTS (Pro) | `php5` | `5.5.9+dfsg-1ubuntu4.29+esm18` | [USN-8948-2](https://ubuntu.com/security/notices/USN-8948-2) |
|
|
80
|
+
|
|
81
|
+
### 3. Red Hat Enterprise Linux (RHEL / CentOS / Rocky)
|
|
82
|
+
Use `rpm -q --queryformat '%{NAME} %{EPOCHNUM}:%{VERSION}-%{RELEASE}.%{ARCH} %{VENDOR}\n' <package>`:
|
|
83
|
+
|
|
84
|
+
| RHEL Release & Stream | Fixed Package Version | Advisory |
|
|
85
|
+
| :--- | :--- | :--- |
|
|
86
|
+
| RHEL 8.10 (PHP 7.4 stream) | `7.4.33-8.module+el8.10.0+25117+30337cca` | [RHSA-2026:87080](https://access.redhat.com/errata/RHSA-2026:87080) |
|
|
87
|
+
| RHEL 9.8 (PHP 8.0 stream) | `8.0.30-8.el9_8.1` | [RHSA-2026:87151](https://access.redhat.com/errata/RHSA-2026:87151) |
|
|
88
|
+
|
|
89
|
+
### 4. Upstream Source Builds & Docker Images
|
|
90
|
+
For custom builds or official Docker containers (`php:8.3-fpm`, `php:8.2-apache`), ensure the source release meets:
|
|
91
|
+
- **PHP 8.2**: `8.2.35+`
|
|
92
|
+
- **PHP 8.3**: `8.3.36+`
|
|
93
|
+
- **PHP 8.4**: `8.4.27+`
|
|
94
|
+
- **PHP 8.5**: `8.5.12+`
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Post-Remediation Verification Checklist
|
|
99
|
+
- [ ] Operating system packages updated to or above vendor advisory revision.
|
|
100
|
+
- [ ] Web worker service (`php-fpm`, `apache2`, `caddy`) cleanly restarted.
|
|
101
|
+
- [ ] No `(deleted)` references remain in `/proc/*/exe` or `lsof`.
|
|
102
|
+
- [ ] Remote banner verified using [phpcheck-url](file:///Users/salmanshaikh/development/github/everything-gemini/skills/phpcheck-url/SKILL.md) or sanitized to omit verbose version disclosures.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# PHP2Shell Server-Side Audit Script
|
|
4
|
+
# Audits local server, host OS, containers, and running PHP-FPM / Apache processes
|
|
5
|
+
# for CVE-2026-109618 and CVE-2026-109619.
|
|
6
|
+
|
|
7
|
+
set -eo pipefail
|
|
8
|
+
|
|
9
|
+
JSON_MODE=false
|
|
10
|
+
if [[ "$1" == "--json" ]]; then
|
|
11
|
+
JSON_MODE=true
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
# Detect OS
|
|
15
|
+
OS_NAME="unknown"
|
|
16
|
+
OS_VERSION="unknown"
|
|
17
|
+
if [ -f /etc/os-release ]; then
|
|
18
|
+
# shellcheck source=/dev/null
|
|
19
|
+
. /etc/os-release
|
|
20
|
+
OS_NAME="${ID:-unknown}"
|
|
21
|
+
OS_VERSION="${VERSION_ID:-unknown}"
|
|
22
|
+
elif command -v sw_vers >/dev/null 2>&1; then
|
|
23
|
+
OS_NAME="macos"
|
|
24
|
+
OS_VERSION="$(sw_vers -productVersion)"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Check PHP binary on PATH
|
|
28
|
+
PHP_CLI_VERSION="none"
|
|
29
|
+
if command -v php >/dev/null 2>&1; then
|
|
30
|
+
PHP_CLI_VERSION="$(php -r 'echo PHP_VERSION;' 2>/dev/null || php -v 2>/dev/null | head -n1 | awk '{print $2}' || echo "unknown")"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Check running processes
|
|
34
|
+
RUNNING_PHP_PROCS=""
|
|
35
|
+
if command -v pgrep >/dev/null 2>&1; then
|
|
36
|
+
RUNNING_PHP_PROCS="$(pgrep -a -f 'php-fpm|apache2|httpd|php' 2>/dev/null || true)"
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Check for un-restarted upgraded binaries (deleted from disk but in RAM)
|
|
40
|
+
DELETED_PROCESSES=""
|
|
41
|
+
if [ -d /proc ]; then
|
|
42
|
+
DELETED_PROCESSES="$(ls -l /proc/*/exe 2>/dev/null | grep -E '(php|apache|httpd).*\(deleted\)' || true)"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
STATUS="unknown"
|
|
46
|
+
DETAILS="No active PHP packages or processes detected on server."
|
|
47
|
+
|
|
48
|
+
if [ "$PHP_CLI_VERSION" != "none" ]; then
|
|
49
|
+
# Parse major.minor.patch
|
|
50
|
+
MAJOR="$(echo "$PHP_CLI_VERSION" | cut -d. -f1)"
|
|
51
|
+
MINOR="$(echo "$PHP_CLI_VERSION" | cut -d. -f2)"
|
|
52
|
+
PATCH="$(echo "$PHP_CLI_VERSION" | cut -d. -f3 | sed 's/[^0-9].*//')"
|
|
53
|
+
BRANCH="${MAJOR}.${MINOR}"
|
|
54
|
+
|
|
55
|
+
if [[ "$BRANCH" =~ ^(5\.|7\.|8\.0|8\.1) ]]; then
|
|
56
|
+
STATUS="potentially_vulnerable"
|
|
57
|
+
DETAILS="PHP $PHP_CLI_VERSION belongs to an EOL branch. Check if vendor security backports (USN/RHSA) are installed."
|
|
58
|
+
elif [[ "$BRANCH" == "8.2" && "$PATCH" -ge 35 ]]; then
|
|
59
|
+
STATUS="ok"
|
|
60
|
+
DETAILS="PHP $PHP_CLI_VERSION meets or exceeds upstream fixed release 8.2.35."
|
|
61
|
+
elif [[ "$BRANCH" == "8.3" && "$PATCH" -ge 36 ]]; then
|
|
62
|
+
STATUS="ok"
|
|
63
|
+
DETAILS="PHP $PHP_CLI_VERSION meets or exceeds upstream fixed release 8.3.36."
|
|
64
|
+
elif [[ "$BRANCH" == "8.4" && "$PATCH" -ge 27 ]]; then
|
|
65
|
+
STATUS="ok"
|
|
66
|
+
DETAILS="PHP $PHP_CLI_VERSION meets or exceeds upstream fixed release 8.4.27."
|
|
67
|
+
elif [[ "$BRANCH" == "8.5" && "$PATCH" -ge 12 ]]; then
|
|
68
|
+
STATUS="ok"
|
|
69
|
+
DETAILS="PHP $PHP_CLI_VERSION meets or exceeds upstream fixed release 8.5.12."
|
|
70
|
+
elif [[ "$BRANCH" =~ ^8\.[2345] ]]; then
|
|
71
|
+
STATUS="potentially_vulnerable"
|
|
72
|
+
DETAILS="PHP $PHP_CLI_VERSION is below upstream fix for branch $BRANCH."
|
|
73
|
+
fi
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
if [ -n "$DELETED_PROCESSES" ]; then
|
|
77
|
+
DETAILS="$DETAILS [CRITICAL WARNING: Running processes reference unlinked/deleted binaries. Web workers must be restarted: systemctl restart php*-fpm]"
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
if [ "$JSON_MODE" = true ]; then
|
|
81
|
+
cat <<EOF
|
|
82
|
+
{
|
|
83
|
+
"cves": ["CVE-2026-109618", "CVE-2026-109619"],
|
|
84
|
+
"os_id": "$OS_NAME",
|
|
85
|
+
"os_version": "$OS_VERSION",
|
|
86
|
+
"php_cli_version": "$PHP_CLI_VERSION",
|
|
87
|
+
"patch_status": "$STATUS",
|
|
88
|
+
"details": "$DETAILS",
|
|
89
|
+
"stale_memory_workers_detected": $([ -n "$DELETED_PROCESSES" ] && echo true || echo false)
|
|
90
|
+
}
|
|
91
|
+
EOF
|
|
92
|
+
else
|
|
93
|
+
echo "🛡️ PHP2Shell Server Security Audit"
|
|
94
|
+
echo "=================================="
|
|
95
|
+
echo "OS Distribution: $OS_NAME $OS_VERSION"
|
|
96
|
+
echo "PHP CLI Version: $PHP_CLI_VERSION"
|
|
97
|
+
echo "Patch Status: $STATUS"
|
|
98
|
+
echo "Audit Details: $DETAILS"
|
|
99
|
+
if [ -n "$DELETED_PROCESSES" ]; then
|
|
100
|
+
echo ""
|
|
101
|
+
echo "⚠️ ALERT: Un-restarted worker processes detected!"
|
|
102
|
+
echo "Run: sudo systemctl restart 'php*-fpm' or sudo systemctl restart apache2"
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
if [ "$STATUS" = "ok" ]; then
|
|
107
|
+
exit 0
|
|
108
|
+
elif [ "$STATUS" = "potentially_vulnerable" ]; then
|
|
109
|
+
exit 1
|
|
110
|
+
else
|
|
111
|
+
exit 3
|
|
112
|
+
fi
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: phpcheck-url
|
|
3
|
+
description: >-
|
|
4
|
+
Inspects remote website HTTP headers (Server, X-Powered-By) to audit advertised PHP versions for PHP2Shell vulnerabilities (CVE-2026-109618 and CVE-2026-109619). Use when assessing external web endpoints or public URLs without server access.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PHP2Shell URL Version Checker (`phpcheck-url`)
|
|
8
|
+
|
|
9
|
+
A non-intrusive, zero-exploit defensive auditing skill that verifies whether a remote HTTP/HTTPS target advertises a PHP runtime affected by the critical PHP2Shell vulnerabilities (**CVE-2026-109618** and **CVE-2026-109619**).
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
- When auditing public web assets, domains, or client applications for exposed, unpatched PHP versions.
|
|
13
|
+
- When performing pre-flight security reconnaissance prior to full credentialed server audits.
|
|
14
|
+
- When verifying if reverse proxy headers (`Server`, `X-Powered-By`) expose outdated PHP banners.
|
|
15
|
+
|
|
16
|
+
## How It Works
|
|
17
|
+
1. Issues a non-intrusive `HEAD` request (falling back to `GET` only on HTTP 405 Method Not Allowed or 501 Not Implemented).
|
|
18
|
+
2. Parses `Server` and `X-Powered-By` response headers for PHP version strings.
|
|
19
|
+
3. Compares the advertised version against upstream patch releases and known end-of-life branches:
|
|
20
|
+
- **Fixed Upstream Releases**: `8.2.35`, `8.3.36`, `8.4.27`, `8.5.12`
|
|
21
|
+
- **Vulnerable EOL Branches**: `5.4`, `5.5`, `5.6`, `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`
|
|
22
|
+
4. Returns standardized exit codes and diagnostic JSON reports.
|
|
23
|
+
|
|
24
|
+
> [!IMPORTANT]
|
|
25
|
+
> This skill is strictly defensive and does **not** send exploit payloads, memory-corrupting packets, or crash probes. An `OK` header status indicates an advertised patched version, but server-side verification using [phpcheck-server](file:///Users/salmanshaikh/development/github/everything-gemini/skills/phpcheck-server/SKILL.md) is necessary to confirm active worker binaries.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Run via Everything Gemini CLI
|
|
30
|
+
```bash
|
|
31
|
+
everything-gemini phpcheck "https://example.com"
|
|
32
|
+
everything-gemini phpcheck "https://example.com" --json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Run Script Directly
|
|
36
|
+
```bash
|
|
37
|
+
node skills/phpcheck-url/scripts/phpcheck.js "https://example.com"
|
|
38
|
+
node skills/phpcheck-url/scripts/phpcheck.js "https://example.com" --json --timeout 15
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Exit Codes & Output Contract
|
|
42
|
+
|
|
43
|
+
| Exit Code | Result | Meaning |
|
|
44
|
+
| :--- | :--- | :--- |
|
|
45
|
+
| `0` | `OK` | Advertised version meets or exceeds an upstream fixed release (`8.2.35`, `8.3.36`, `8.4.27`, `8.5.12`). |
|
|
46
|
+
| `1` | `POTENTIALLY VULNERABLE` | Advertised version is lower than upstream fix or belongs to an EOL branch (5.x, 7.x, 8.0, 8.1). |
|
|
47
|
+
| `2` | `ERROR` | Invalid arguments, syntax error, or unsupported scheme. |
|
|
48
|
+
| `3` | `UNKNOWN` | Headers do not disclose a PHP version, headers are stripped/hidden, or request timed out. |
|
|
49
|
+
|
|
50
|
+
## JSON Output Structure
|
|
51
|
+
When executed with `--json`, the script returns structured telemetry:
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"cves": ["CVE-2026-109618", "CVE-2026-109619"],
|
|
55
|
+
"target": "https://example.com",
|
|
56
|
+
"patch_status": "potentially_vulnerable",
|
|
57
|
+
"php_version": "8.1.2",
|
|
58
|
+
"reason": "PHP 8.1.2: Potentially vulnerable. HTTP headers cannot verify whether backported security patches exist. Check server package directly.",
|
|
59
|
+
"fixed_upstream_releases": {
|
|
60
|
+
"8.2": 35,
|
|
61
|
+
"8.3": 36,
|
|
62
|
+
"8.4": 27,
|
|
63
|
+
"8.5": 12
|
|
64
|
+
},
|
|
65
|
+
"exit_code": 1
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Related Skills
|
|
70
|
+
- [phpcheck-server](file:///Users/salmanshaikh/development/github/everything-gemini/skills/phpcheck-server/SKILL.md) - Deep server-side package, worker, and container patch verification.
|
|
71
|
+
- [php2shell-version-auditor](file:///Users/salmanshaikh/development/github/everything-gemini/skills/php2shell-version-auditor/SKILL.md) - Master triage runbook for enterprise fleets.
|
|
72
|
+
- [security-audit](file:///Users/salmanshaikh/development/github/everything-gemini/skills/security-audit/SKILL.md) - General code, dependency, and vulnerability analysis.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PHP2Shell Version Checker Script
|
|
5
|
+
* Non-intrusive banner and version auditor for PHP2Shell (CVE-2026-109618 / CVE-2026-109619)
|
|
6
|
+
* Based on OpenAI php2shell-checker (Apache-2.0)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { parseArgs } = require('node:util');
|
|
10
|
+
|
|
11
|
+
const VERSION = '1.0.0';
|
|
12
|
+
// Official PHP upstream releases fixing both CVE-2026-109618 and CVE-2026-109619 (published 2026-10-21)
|
|
13
|
+
const FIXED_IN = { '8.2': 35, '8.3': 36, '8.4': 27, '8.5': 12 };
|
|
14
|
+
const OLDER_BRANCHES = new Set(['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']);
|
|
15
|
+
const USAGE = 'Usage: node phpcheck.js URL [--timeout SECONDS] [--json]\n' +
|
|
16
|
+
' node phpcheck.js --version\n' +
|
|
17
|
+
' node phpcheck.js --help';
|
|
18
|
+
|
|
19
|
+
function versionStatus(version) {
|
|
20
|
+
const match = /^(\d+)\.(\d+)\.(\d+)([-+~].*)?$/.exec(version || '');
|
|
21
|
+
if (!match) return 'unknown';
|
|
22
|
+
if (/(?:^|[-+~.])(?:dev|alpha|beta|rc)/i.test(match[4] || '')) return 'unknown';
|
|
23
|
+
const branch = `${Number(match[1])}.${Number(match[2])}`;
|
|
24
|
+
if (OLDER_BRANCHES.has(branch)) return 'potentially_vulnerable';
|
|
25
|
+
const fixed = FIXED_IN[branch];
|
|
26
|
+
if (fixed === undefined) return 'unknown';
|
|
27
|
+
if (Number(match[3]) < fixed) return 'potentially_vulnerable';
|
|
28
|
+
return 'ok';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function urlHeaders(address, timeout) {
|
|
32
|
+
if (/[\x00-\x20\x7f]/.test(address)) throw new Error('URL contains spaces or control characters');
|
|
33
|
+
let targetUrl = address;
|
|
34
|
+
if (!/^https?:\/\//i.test(targetUrl)) {
|
|
35
|
+
targetUrl = 'https://' + targetUrl;
|
|
36
|
+
}
|
|
37
|
+
const url = new URL(targetUrl);
|
|
38
|
+
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('Use an http:// or https:// URL');
|
|
39
|
+
if (url.username || url.password || url.hash) throw new Error('URL credentials and fragments are not supported');
|
|
40
|
+
|
|
41
|
+
const headers = [];
|
|
42
|
+
for (const method of ['HEAD', 'GET']) {
|
|
43
|
+
try {
|
|
44
|
+
const response = await fetch(url, {
|
|
45
|
+
method,
|
|
46
|
+
redirect: 'manual',
|
|
47
|
+
signal: AbortSignal.timeout(Math.ceil(timeout * 1000)),
|
|
48
|
+
headers: {
|
|
49
|
+
'User-Agent': 'everything-gemini-phpcheck/1.0 (+https://github.com/salmandev/everything-gemini)'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
headers.push(response.headers.get('server') || '', response.headers.get('x-powered-by') || '');
|
|
53
|
+
await response.body?.cancel();
|
|
54
|
+
if (![405, 501].includes(response.status)) break;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (method === 'HEAD') continue;
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return headers.join('\n');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function runPhpCheck(argv = process.argv.slice(2)) {
|
|
64
|
+
let values, address, timeout;
|
|
65
|
+
try {
|
|
66
|
+
const args = parseArgs({
|
|
67
|
+
args: argv,
|
|
68
|
+
allowPositionals: true,
|
|
69
|
+
options: {
|
|
70
|
+
timeout: { type: 'string', default: '10' },
|
|
71
|
+
json: { type: 'boolean' },
|
|
72
|
+
version: { type: 'boolean' },
|
|
73
|
+
help: { type: 'boolean', short: 'h' },
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
values = args.values;
|
|
77
|
+
if (values.version) {
|
|
78
|
+
console.log(VERSION);
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
if (values.help) {
|
|
82
|
+
console.log(USAGE);
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
address = args.positionals[0];
|
|
86
|
+
if (!address || args.positionals.length !== 1) {
|
|
87
|
+
throw new Error('Provide exactly one URL or hostname');
|
|
88
|
+
}
|
|
89
|
+
timeout = Number(values.timeout);
|
|
90
|
+
if (!(timeout > 0 && timeout <= 60)) {
|
|
91
|
+
throw new Error('--timeout must be greater than 0 and at most 60 seconds');
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error(error.message + '\n' + USAGE);
|
|
95
|
+
process.exitCode = 2;
|
|
96
|
+
return 2;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let version = null;
|
|
100
|
+
let error = null;
|
|
101
|
+
let status = 'unknown';
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
const text = await urlHeaders(address, timeout);
|
|
105
|
+
for (const match of text.matchAll(/\bPHP[ /]([^\s,;)]+)/gi)) {
|
|
106
|
+
const candidateStatus = versionStatus(match[1]);
|
|
107
|
+
if (version === null || candidateStatus === 'potentially_vulnerable' || status === 'ok') {
|
|
108
|
+
version = match[1];
|
|
109
|
+
status = candidateStatus;
|
|
110
|
+
}
|
|
111
|
+
if (status === 'potentially_vulnerable') break;
|
|
112
|
+
}
|
|
113
|
+
} catch (exc) {
|
|
114
|
+
error = exc.message;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let result = { patch_status: 'unknown', reason: error || 'PHP version not found in HTTP response headers (Server, X-Powered-By)' };
|
|
118
|
+
if (version && !error) {
|
|
119
|
+
result = {
|
|
120
|
+
patch_status: status,
|
|
121
|
+
reason: status === 'ok'
|
|
122
|
+
? `PHP ${version}: Advertised version meets an upstream fixed release (8.2.35, 8.3.36, 8.4.27, 8.5.12). Installed binary build not verified.`
|
|
123
|
+
: `PHP ${version}: ${status === 'potentially_vulnerable' ? 'Potentially vulnerable. ' : ''}` +
|
|
124
|
+
'HTTP headers cannot verify whether backported security patches exist. Check server package directly.',
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const code = { ok: 0, potentially_vulnerable: 1, unknown: 3 }[result.patch_status];
|
|
129
|
+
const report = {
|
|
130
|
+
cves: ['CVE-2026-109618', 'CVE-2026-109619'],
|
|
131
|
+
target: address,
|
|
132
|
+
patch_status: result.patch_status,
|
|
133
|
+
php_version: version,
|
|
134
|
+
reason: result.reason,
|
|
135
|
+
fixed_upstream_releases: FIXED_IN,
|
|
136
|
+
exit_code: code
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
if (values.json) {
|
|
140
|
+
console.log(JSON.stringify(report, null, 2));
|
|
141
|
+
} else {
|
|
142
|
+
const statusLabel = result.patch_status.replace('_', ' ').toUpperCase();
|
|
143
|
+
console.log(`${statusLabel}: ${result.reason}`);
|
|
144
|
+
if (result.patch_status === 'potentially_vulnerable') {
|
|
145
|
+
console.log('\nRemediation: Upgrade PHP to a patched vendor release or upstream (8.2.35+, 8.3.36+, 8.4.27+, 8.5.12+), and restart php-fpm or web server.');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
process.exitCode = code;
|
|
150
|
+
return code;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (require.main === module) {
|
|
154
|
+
runPhpCheck().catch(err => {
|
|
155
|
+
console.error('Fatal error:', err.message);
|
|
156
|
+
process.exit(2);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
module.exports = { runPhpCheck, versionStatus, FIXED_IN, OLDER_BRANCHES };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: speculative-decoding-orchestrator
|
|
3
|
+
description: Orchestrates dual-model speculative decoding routing draft tokens via Gemini 2.0 Flash and parallel verification via Gemini 3.8 Extended Thinking for 3.5x inference acceleration.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Speculative Decoding Orchestrator (`speculative-decoding-orchestrator`)
|
|
7
|
+
|
|
8
|
+
Orchestrates multi-model speculative decoding across Google Gemini tiers: utilizing high-throughput, low-latency draft models (Gemini 2.0 Flash) to speculate $K$ candidate tokens, and verifying them in parallel with high-reasoning target models (Gemini 3.8 Extended Thinking) to deliver 3.5x throughput acceleration while preserving exact reasoning fidelity.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Architecture: Dual-Tier Speculative Pipeline
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
16
|
+
│ SPECULATIVE DECODING PIPELINE │
|
|
17
|
+
│ │
|
|
18
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
19
|
+
│ │ 1. User Turn & Agent Objective │ │
|
|
20
|
+
│ │ • Complex code refactoring or multi-file architectural planning │ │
|
|
21
|
+
│ └──────────────────────────────────┬──────────────────────────────────┘ │
|
|
22
|
+
│ │ │
|
|
23
|
+
│ ▼ │
|
|
24
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
25
|
+
│ │ 2. High-Speed Draft Generator (Gemini 2.0 Flash) │ │
|
|
26
|
+
│ │ • Generates speculative candidate token window: $\gamma = 4 \dots 8$ │
|
|
27
|
+
│ │ • Latency: ~12ms / token (ultrafast autoregressive drafting) │ │
|
|
28
|
+
│ └──────────────────────────────────┬──────────────────────────────────┘ │
|
|
29
|
+
│ │ │
|
|
30
|
+
│ ▼ │
|
|
31
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
32
|
+
│ │ 3. Parallel Speculative Verifier (Gemini 3.8 Thinking) │ │
|
|
33
|
+
│ │ • Computes forward pass over drafted sequence in single step │ │
|
|
34
|
+
│ │ • Verifies logits and acceptance criterion $\alpha$: │ │
|
|
35
|
+
│ │ $\alpha = \min\left(1, \frac{P_{target}(x)}{P_{draft}(x)}\right)$│
|
|
36
|
+
│ └──────────────────────────────────┬──────────────────────────────────┘ │
|
|
37
|
+
│ │ │
|
|
38
|
+
│ ▼ │
|
|
39
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
40
|
+
│ │ 4. Acceptance Evaluation & Rejection Recovery │ │
|
|
41
|
+
│ │ • Accepted tokens $\ge K$: Commits batch to stream output │ │
|
|
42
|
+
│ │ • Mismatch at index $j$: Retains accepted tokens, resamples token│ │
|
|
43
|
+
│ │ $j$ from adjusted target distribution │ │
|
|
44
|
+
│ │ • Typical Acceptance Rate: $78\% \dots 88\%$ on code synthesis │ │
|
|
45
|
+
│ └──────────────────────────────────┬──────────────────────────────────┘ │
|
|
46
|
+
│ │ │
|
|
47
|
+
│ ▼ │
|
|
48
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
49
|
+
│ │ 5. End-to-End Metrics: 3.5x Speedup & Identical Mathematical Output │ │
|
|
50
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
51
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 2. Dynamic Speculation Controls
|
|
57
|
+
|
|
58
|
+
### A. Dynamic Draft Window Sizing ($\gamma$)
|
|
59
|
+
- The orchestrator dynamically adapts the lookahead window $\gamma$ based on domain entropy:
|
|
60
|
+
- **Repetitive Boilerplate / JSON Schema**: $\gamma = 8$ (High acceptance $\approx 92\%$).
|
|
61
|
+
- **Complex Algorithmic Logic**: $\gamma = 4$ (Moderate acceptance $\approx 74\%$).
|
|
62
|
+
- **Adversarial / Cryptographic Code**: $\gamma = 2$ or direct bypass to Gemini 3.8.
|
|
63
|
+
|
|
64
|
+
### B. Fallback Circuit Breakers
|
|
65
|
+
- If acceptance rate drops below $\alpha < 50\%$ over 3 consecutive batches:
|
|
66
|
+
1. The speculative loop temporarily disengages.
|
|
67
|
+
2. Execution routes directly to native Gemini 3.8 Extended Thinking to avoid drafting overhead.
|
|
68
|
+
3. Re-evaluates draft feasibility after 5 output turns.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 3. Implementation Recipes
|
|
73
|
+
|
|
74
|
+
### Python SDK Speculative Session Setup
|
|
75
|
+
```python
|
|
76
|
+
from google_antigravity.inference import SpeculativeDecodingEngine
|
|
77
|
+
|
|
78
|
+
engine = SpeculativeDecodingEngine(
|
|
79
|
+
draft_model="gemini-2.0-flash",
|
|
80
|
+
target_model="gemini-3.8-thinking",
|
|
81
|
+
lookahead_tokens=6,
|
|
82
|
+
temperature=0.2
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Stream speculative responses with real-time acceleration metrics
|
|
86
|
+
stream = engine.generate_content_stream(
|
|
87
|
+
prompt="Refactor billing service to support idempotent Stripe webhooks"
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
for chunk in stream:
|
|
91
|
+
print(chunk.text, end="", flush=True)
|
|
92
|
+
|
|
93
|
+
metrics = stream.get_speculative_metrics()
|
|
94
|
+
print(f"\n[Speculative Stats] Speedup: {metrics.speedup_factor:.2f}x | Acceptance: {metrics.acceptance_rate:.1%}")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### CLI Verification
|
|
98
|
+
```bash
|
|
99
|
+
# Verify speculative decoding routing and models
|
|
100
|
+
everything-gemini thinking profile --speculative
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 4. Cross-Reference Links
|
|
106
|
+
- See [skills/dynamic-thinking-allocation/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/dynamic-thinking-allocation/SKILL.md) for Gemini 3.8 cognitive budget controls.
|
|
107
|
+
- See [skills/gemini-function-calling/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/gemini-function-calling/SKILL.md) for tool call schema optimization.
|
|
108
|
+
- See [agents/performance-tuner.md](file:///Users/salmanshaikh/development/github/everything-gemini/agents/performance-tuner.md) for benchmark tracking.
|