phpwarden 2.0.0__tar.gz

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.
Files changed (53) hide show
  1. phpwarden-2.0.0/LICENSE +202 -0
  2. phpwarden-2.0.0/PKG-INFO +177 -0
  3. phpwarden-2.0.0/README.md +157 -0
  4. phpwarden-2.0.0/pyproject.toml +40 -0
  5. phpwarden-2.0.0/setup.cfg +4 -0
  6. phpwarden-2.0.0/src/phpwarden/__init__.py +8 -0
  7. phpwarden-2.0.0/src/phpwarden/cli.py +448 -0
  8. phpwarden-2.0.0/src/phpwarden/data/php-cve-feed.json +427709 -0
  9. phpwarden-2.0.0/src/phpwarden/deps.py +283 -0
  10. phpwarden-2.0.0/src/phpwarden/detect.py +194 -0
  11. phpwarden-2.0.0/src/phpwarden/engine.py +137 -0
  12. phpwarden-2.0.0/src/phpwarden/env.py +82 -0
  13. phpwarden-2.0.0/src/phpwarden/feed.py +213 -0
  14. phpwarden-2.0.0/src/phpwarden/guard.py +792 -0
  15. phpwarden-2.0.0/src/phpwarden/report.py +206 -0
  16. phpwarden-2.0.0/src/phpwarden/rules.py +152 -0
  17. phpwarden-2.0.0/src/phpwarden/version.py +110 -0
  18. phpwarden-2.0.0/src/phpwarden/vulndb.py +186 -0
  19. phpwarden-2.0.0/src/phpwarden/wordpress.py +155 -0
  20. phpwarden-2.0.0/src/phpwarden.egg-info/PKG-INFO +177 -0
  21. phpwarden-2.0.0/src/phpwarden.egg-info/SOURCES.txt +51 -0
  22. phpwarden-2.0.0/src/phpwarden.egg-info/dependency_links.txt +1 -0
  23. phpwarden-2.0.0/src/phpwarden.egg-info/entry_points.txt +3 -0
  24. phpwarden-2.0.0/src/phpwarden.egg-info/top_level.txt +1 -0
  25. phpwarden-2.0.0/tests/test_accounts.py +170 -0
  26. phpwarden-2.0.0/tests/test_assignment.py +70 -0
  27. phpwarden-2.0.0/tests/test_audit.py +56 -0
  28. phpwarden-2.0.0/tests/test_billing.py +93 -0
  29. phpwarden-2.0.0/tests/test_cli_edges.py +165 -0
  30. phpwarden-2.0.0/tests/test_deps_and_rules.py +84 -0
  31. phpwarden-2.0.0/tests/test_detection_validation.py +70 -0
  32. phpwarden-2.0.0/tests/test_developer.py +137 -0
  33. phpwarden-2.0.0/tests/test_discussion.py +57 -0
  34. phpwarden-2.0.0/tests/test_e2e_readiness.py +325 -0
  35. phpwarden-2.0.0/tests/test_email.py +62 -0
  36. phpwarden-2.0.0/tests/test_engine.py +79 -0
  37. phpwarden-2.0.0/tests/test_feed_license.py +225 -0
  38. phpwarden-2.0.0/tests/test_feed_subscription.py +137 -0
  39. phpwarden-2.0.0/tests/test_fleet.py +74 -0
  40. phpwarden-2.0.0/tests/test_guard_live.py +225 -0
  41. phpwarden-2.0.0/tests/test_mentions.py +34 -0
  42. phpwarden-2.0.0/tests/test_reachability.py +135 -0
  43. phpwarden-2.0.0/tests/test_saas.py +103 -0
  44. phpwarden-2.0.0/tests/test_saas_billing.py +116 -0
  45. phpwarden-2.0.0/tests/test_server.py +115 -0
  46. phpwarden-2.0.0/tests/test_settings.py +124 -0
  47. phpwarden-2.0.0/tests/test_shield.py +63 -0
  48. phpwarden-2.0.0/tests/test_slack.py +62 -0
  49. phpwarden-2.0.0/tests/test_sso.py +183 -0
  50. phpwarden-2.0.0/tests/test_team.py +67 -0
  51. phpwarden-2.0.0/tests/test_triage.py +71 -0
  52. phpwarden-2.0.0/tests/test_webhook_idempotency.py +32 -0
  53. phpwarden-2.0.0/tests/test_wordpress_and_report.py +147 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.4
2
+ Name: phpwarden
3
+ Version: 2.0.0
4
+ Summary: PHP exposure and exploitation guard — assess any PHP host against an evolving CVE feed, and watch PHP-FPM for active exploitation
5
+ Author: localprime
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/localprime/phpwarden
8
+ Keywords: php,php-fpm,security,cve,vulnerability,exploitation,detection,rce
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: System :: Monitoring
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Dynamic: license-file
20
+
21
+ # phpwarden
22
+
23
+ **A unified PHP security platform.** One tool, one feed, covering the full PHP
24
+ attack surface: engine and FPM CVE exposure, Composer dependency CVEs,
25
+ exploitation detection in logs, WAF blocking rules, and continuous worker-level
26
+ containment. Zero runtime dependencies (Python 3.8+).
27
+
28
+ phpwarden is the general successor to the single-CVE php2shell checker. Instead
29
+ of one vulnerability, it tracks many PHP CVEs over time through a **feed** — and
30
+ the feed is the part a subscription keeps current. The engine and the base
31
+ (community) feed are free and open; the maintained channel is the paid product.
32
+
33
+ ## Surfaces it covers
34
+
35
+ | Surface | Command | Competes with |
36
+ |---------|---------|---------------|
37
+ | PHP engine / FPM CVE exposure | `scan` | image & network scanners |
38
+ | Composer dependency CVEs | `deps` | Snyk, `composer audit` |
39
+ | WordPress core, plugin and theme CVEs | `wordpress` | Patchstack, Wordfence |
40
+ | Exploitation signatures in logs | `detect` | SIEM content |
41
+ | WAF blocking rules (PHP-specific) | `rules` | the gap a generic WAF leaves |
42
+ | Fleet exposure dashboard | `report` | the CNAPP's PHP view |
43
+ | Continuous worker containment | guard daemon | nothing — unique |
44
+
45
+ ## Why it is different
46
+
47
+ - **Version-accurate, per branch.** PHP backports fixes per branch, so a flat
48
+ "you're on 8.3, upgrade" is wrong. phpwarden knows the fixed release for each
49
+ branch of each CVE and compares precisely.
50
+ - **It never overclaims.** A CVE that needs a specific SAPI (FPM/CGI), OS, or
51
+ configuration is reported as *possibly* exposed with the exact condition to
52
+ confirm — not flagged as a certain hit, and not silently dismissed.
53
+ - **It covers exposure and exploitation.** `scan` tells you what you're exposed
54
+ to; `detect` scans logs for the signatures of attempts; the guard daemon
55
+ watches PHP-FPM for in-progress memory-corruption attacks.
56
+ - **Honesty over noise.** Validated at zero false positives on 2000 benign
57
+ requests in the test suite.
58
+
59
+ ## Install
60
+
61
+ ```bash
62
+ pip install phpwarden # console command: phpwarden
63
+ ./phpwarden.pyz scan # or no install, single file
64
+ sudo apt install ./phpwarden_2.0.0_all.deb # or the .rpm
65
+ docker run --rm phpwarden:2.0.0 scan --version 8.3.10 --sapi fpm --os linux
66
+ ```
67
+
68
+ Selling it as a subscription: the licensed feed server, key issuance/validation
69
+ and a Stripe webhook are in `server/` (see `server/README.md`).
70
+
71
+ ## Use
72
+
73
+ ```bash
74
+ phpwarden scan # assess this host (auto-detects version/SAPI/OS)
75
+ phpwarden scan --version 8.3.10 --sapi fpm --os linux
76
+ phpwarden scan --json # machine-readable, for CI / dashboards
77
+ phpwarden feed status # which feed is active, and is it licensed
78
+ phpwarden feed update # pull the latest feed (needs a license key)
79
+ phpwarden detect /var/log/nginx/access.log # scan a log for exploit signatures
80
+ phpwarden deps composer.lock # scan Composer dependencies for known CVEs
81
+ phpwarden wordpress /var/www/html # scan a WordPress install: core version, plugins, themes
82
+ phpwarden rules --format modsecurity # emit PHP-specific WAF blocking rules
83
+ phpwarden rules --format nginx --out php-block.conf
84
+ phpwarden report web01.json web02.json --out fleet.html # aggregate a fleet view
85
+ ```
86
+
87
+ Across a fleet, run `scan`, `deps` and `wordpress` with `--json` on each host,
88
+ collect the files, and `report` renders a single HTML dashboard: severity
89
+ tiles, exploited-in-wild count, and every finding by host and source.
90
+
91
+ `scan` exit codes: `0` clear, `1` exposed, `2` possibly exposed, `3` version
92
+ unknown — ready for a CI gate:
93
+
94
+ ```bash
95
+ phpwarden scan || echo "PHP exposure found — see above"
96
+ ```
97
+
98
+ ## The subscription
99
+
100
+ The base feed ships inside the package and works forever, offline. A license key
101
+ unlocks the maintained channel, which adds new PHP CVEs — version ranges,
102
+ exposure conditions, and detection signatures — as they are triaged:
103
+
104
+ ```bash
105
+ export PHPWARDEN_LICENSE=... # from your subscription
106
+ phpwarden feed update
107
+ ```
108
+
109
+ Without a key, `phpwarden` runs the free community feed and says so. Nothing
110
+ phones home unless you run `feed update`.
111
+
112
+ ## Current coverage (feed 2026.10.26.2)
113
+
114
+ - **20,900+ advisories bundled**, offline: ~8,600 Composer (from
115
+ [OSV.dev](https://osv.dev) + [FriendsOfPHP](https://github.com/FriendsOfPHP/security-advisories);
116
+ 84% carry a CVSS-derived severity),
117
+ ~12,300 WordPress advisories (from [NVD](https://nvd.nist.gov): ~11,800 plugin
118
+ across 5,900 slugs, 345 WordPress core, 165 theme — theme classification is
119
+ description-based because NVD's CPE has no plugin/theme flag),
120
+ and the curated PHP engine/FPM CVEs. 19,400+ carry an EPSS exploitation score.
121
+ Every build passes `feedbuilder/check_feed.py` (no open-ended range with a
122
+ known fix, no "fixed" version inside its own affected range, no duplicate
123
+ (package|slug, cve), every slug backed by its CPE product or a wordpress.org
124
+ reference).
125
+ - **License-independent by construction.** Every source is open or
126
+ public-domain (OSV, NVD, FriendsOfPHP, CISA KEV, FIRST EPSS). No commercial
127
+ vendor's licensed feed is used, so coverage can never be revoked or priced
128
+ away. `composer audit`-grade dependency coverage and Patchstack-scale
129
+ WordPress coverage, with no vendor key.
130
+ - **8 hand-curated PHP engine/FPM CVEs** (2019–2026), each with per-branch fixed
131
+ versions, exposure conditions and detection signatures (table below), ranges
132
+ verified against vendor advisories.
133
+ - **Curated WordPress plugin advisories**, extensible to Patchstack scale
134
+ through the maintained subscription channel.
135
+ - **Real-world exploitation enrichment.** Every advisory with a CVE is joined to
136
+ [CISA KEV](https://www.cisa.gov/known-exploited-vulnerabilities-catalog)
137
+ (is it actively exploited, and used in ransomware) and
138
+ [FIRST EPSS](https://www.first.org/epss/) (probability of exploitation).
139
+ Findings are ranked **exploitation-first**, not by CVSS alone — the
140
+ prioritisation commercial scanners charge for, here free and offline.
141
+
142
+ The feed is assembled by `feedbuilder/` from a curated base plus bulk imports
143
+ and enrichment (`feedbuilder/README.md`); curated entries always win over
144
+ imported ones.
145
+
146
+ | CVE | What | Scope |
147
+ |-----|------|-------|
148
+ | CVE-2019-11043 | PHP-FPM env_path_info RCE | FPM + nginx, config-gated |
149
+ | CVE-2023-3824 | PHAR stack overflow RCE | any SAPI, untrusted PHAR |
150
+ | CVE-2024-4577 | PHP-CGI argument injection | Windows + CGI |
151
+ | CVE-2024-8926 / 8927 | cgi.force_redirect bypass | CGI / FPM |
152
+ | CVE-2024-11236 | DB-quoter integer overflow | any SAPI |
153
+ | CVE-2026-109618 / 109619 | php2shell FPM memory RCE | any SAPI |
154
+
155
+ ## Continuous guard
156
+
157
+ `phpwarden scan` and `detect` are point-in-time. For always-on containment of
158
+ in-progress php2shell-class attacks (OOM on a worker, then that worker reused),
159
+ run the guard daemon, which boots in dry-run and never acts until you promote it
160
+ after a burn-in. See the guard's own DESIGN document.
161
+
162
+ ## Honest limits
163
+
164
+ - The deterministic version census is the reliable backbone; behavioral
165
+ detection is best-effort and a clean exploit can leave little trace.
166
+ - `scan` only knows what it can observe. Anything it cannot determine (SAPI, OS,
167
+ app-level conditions) is reported as *possibly* exposed, not safe.
168
+ - Field validation against production traffic requires a live PHP host; the
169
+ test suite validates against synthetic traffic.
170
+
171
+ ## License
172
+
173
+ Open-core. The **engine** (`src/phpwarden/`) and the **bundled community feed**
174
+ are **Apache-2.0** — free to use, inspect, modify and redistribute (see
175
+ [`LICENSE`](LICENSE)). The **hosted service** (`saas/`, `server/`) and the
176
+ **maintained feed** are proprietary/commercial. Full scope in
177
+ [`LICENSING.md`](LICENSING.md).
@@ -0,0 +1,157 @@
1
+ # phpwarden
2
+
3
+ **A unified PHP security platform.** One tool, one feed, covering the full PHP
4
+ attack surface: engine and FPM CVE exposure, Composer dependency CVEs,
5
+ exploitation detection in logs, WAF blocking rules, and continuous worker-level
6
+ containment. Zero runtime dependencies (Python 3.8+).
7
+
8
+ phpwarden is the general successor to the single-CVE php2shell checker. Instead
9
+ of one vulnerability, it tracks many PHP CVEs over time through a **feed** — and
10
+ the feed is the part a subscription keeps current. The engine and the base
11
+ (community) feed are free and open; the maintained channel is the paid product.
12
+
13
+ ## Surfaces it covers
14
+
15
+ | Surface | Command | Competes with |
16
+ |---------|---------|---------------|
17
+ | PHP engine / FPM CVE exposure | `scan` | image & network scanners |
18
+ | Composer dependency CVEs | `deps` | Snyk, `composer audit` |
19
+ | WordPress core, plugin and theme CVEs | `wordpress` | Patchstack, Wordfence |
20
+ | Exploitation signatures in logs | `detect` | SIEM content |
21
+ | WAF blocking rules (PHP-specific) | `rules` | the gap a generic WAF leaves |
22
+ | Fleet exposure dashboard | `report` | the CNAPP's PHP view |
23
+ | Continuous worker containment | guard daemon | nothing — unique |
24
+
25
+ ## Why it is different
26
+
27
+ - **Version-accurate, per branch.** PHP backports fixes per branch, so a flat
28
+ "you're on 8.3, upgrade" is wrong. phpwarden knows the fixed release for each
29
+ branch of each CVE and compares precisely.
30
+ - **It never overclaims.** A CVE that needs a specific SAPI (FPM/CGI), OS, or
31
+ configuration is reported as *possibly* exposed with the exact condition to
32
+ confirm — not flagged as a certain hit, and not silently dismissed.
33
+ - **It covers exposure and exploitation.** `scan` tells you what you're exposed
34
+ to; `detect` scans logs for the signatures of attempts; the guard daemon
35
+ watches PHP-FPM for in-progress memory-corruption attacks.
36
+ - **Honesty over noise.** Validated at zero false positives on 2000 benign
37
+ requests in the test suite.
38
+
39
+ ## Install
40
+
41
+ ```bash
42
+ pip install phpwarden # console command: phpwarden
43
+ ./phpwarden.pyz scan # or no install, single file
44
+ sudo apt install ./phpwarden_2.0.0_all.deb # or the .rpm
45
+ docker run --rm phpwarden:2.0.0 scan --version 8.3.10 --sapi fpm --os linux
46
+ ```
47
+
48
+ Selling it as a subscription: the licensed feed server, key issuance/validation
49
+ and a Stripe webhook are in `server/` (see `server/README.md`).
50
+
51
+ ## Use
52
+
53
+ ```bash
54
+ phpwarden scan # assess this host (auto-detects version/SAPI/OS)
55
+ phpwarden scan --version 8.3.10 --sapi fpm --os linux
56
+ phpwarden scan --json # machine-readable, for CI / dashboards
57
+ phpwarden feed status # which feed is active, and is it licensed
58
+ phpwarden feed update # pull the latest feed (needs a license key)
59
+ phpwarden detect /var/log/nginx/access.log # scan a log for exploit signatures
60
+ phpwarden deps composer.lock # scan Composer dependencies for known CVEs
61
+ phpwarden wordpress /var/www/html # scan a WordPress install: core version, plugins, themes
62
+ phpwarden rules --format modsecurity # emit PHP-specific WAF blocking rules
63
+ phpwarden rules --format nginx --out php-block.conf
64
+ phpwarden report web01.json web02.json --out fleet.html # aggregate a fleet view
65
+ ```
66
+
67
+ Across a fleet, run `scan`, `deps` and `wordpress` with `--json` on each host,
68
+ collect the files, and `report` renders a single HTML dashboard: severity
69
+ tiles, exploited-in-wild count, and every finding by host and source.
70
+
71
+ `scan` exit codes: `0` clear, `1` exposed, `2` possibly exposed, `3` version
72
+ unknown — ready for a CI gate:
73
+
74
+ ```bash
75
+ phpwarden scan || echo "PHP exposure found — see above"
76
+ ```
77
+
78
+ ## The subscription
79
+
80
+ The base feed ships inside the package and works forever, offline. A license key
81
+ unlocks the maintained channel, which adds new PHP CVEs — version ranges,
82
+ exposure conditions, and detection signatures — as they are triaged:
83
+
84
+ ```bash
85
+ export PHPWARDEN_LICENSE=... # from your subscription
86
+ phpwarden feed update
87
+ ```
88
+
89
+ Without a key, `phpwarden` runs the free community feed and says so. Nothing
90
+ phones home unless you run `feed update`.
91
+
92
+ ## Current coverage (feed 2026.10.26.2)
93
+
94
+ - **20,900+ advisories bundled**, offline: ~8,600 Composer (from
95
+ [OSV.dev](https://osv.dev) + [FriendsOfPHP](https://github.com/FriendsOfPHP/security-advisories);
96
+ 84% carry a CVSS-derived severity),
97
+ ~12,300 WordPress advisories (from [NVD](https://nvd.nist.gov): ~11,800 plugin
98
+ across 5,900 slugs, 345 WordPress core, 165 theme — theme classification is
99
+ description-based because NVD's CPE has no plugin/theme flag),
100
+ and the curated PHP engine/FPM CVEs. 19,400+ carry an EPSS exploitation score.
101
+ Every build passes `feedbuilder/check_feed.py` (no open-ended range with a
102
+ known fix, no "fixed" version inside its own affected range, no duplicate
103
+ (package|slug, cve), every slug backed by its CPE product or a wordpress.org
104
+ reference).
105
+ - **License-independent by construction.** Every source is open or
106
+ public-domain (OSV, NVD, FriendsOfPHP, CISA KEV, FIRST EPSS). No commercial
107
+ vendor's licensed feed is used, so coverage can never be revoked or priced
108
+ away. `composer audit`-grade dependency coverage and Patchstack-scale
109
+ WordPress coverage, with no vendor key.
110
+ - **8 hand-curated PHP engine/FPM CVEs** (2019–2026), each with per-branch fixed
111
+ versions, exposure conditions and detection signatures (table below), ranges
112
+ verified against vendor advisories.
113
+ - **Curated WordPress plugin advisories**, extensible to Patchstack scale
114
+ through the maintained subscription channel.
115
+ - **Real-world exploitation enrichment.** Every advisory with a CVE is joined to
116
+ [CISA KEV](https://www.cisa.gov/known-exploited-vulnerabilities-catalog)
117
+ (is it actively exploited, and used in ransomware) and
118
+ [FIRST EPSS](https://www.first.org/epss/) (probability of exploitation).
119
+ Findings are ranked **exploitation-first**, not by CVSS alone — the
120
+ prioritisation commercial scanners charge for, here free and offline.
121
+
122
+ The feed is assembled by `feedbuilder/` from a curated base plus bulk imports
123
+ and enrichment (`feedbuilder/README.md`); curated entries always win over
124
+ imported ones.
125
+
126
+ | CVE | What | Scope |
127
+ |-----|------|-------|
128
+ | CVE-2019-11043 | PHP-FPM env_path_info RCE | FPM + nginx, config-gated |
129
+ | CVE-2023-3824 | PHAR stack overflow RCE | any SAPI, untrusted PHAR |
130
+ | CVE-2024-4577 | PHP-CGI argument injection | Windows + CGI |
131
+ | CVE-2024-8926 / 8927 | cgi.force_redirect bypass | CGI / FPM |
132
+ | CVE-2024-11236 | DB-quoter integer overflow | any SAPI |
133
+ | CVE-2026-109618 / 109619 | php2shell FPM memory RCE | any SAPI |
134
+
135
+ ## Continuous guard
136
+
137
+ `phpwarden scan` and `detect` are point-in-time. For always-on containment of
138
+ in-progress php2shell-class attacks (OOM on a worker, then that worker reused),
139
+ run the guard daemon, which boots in dry-run and never acts until you promote it
140
+ after a burn-in. See the guard's own DESIGN document.
141
+
142
+ ## Honest limits
143
+
144
+ - The deterministic version census is the reliable backbone; behavioral
145
+ detection is best-effort and a clean exploit can leave little trace.
146
+ - `scan` only knows what it can observe. Anything it cannot determine (SAPI, OS,
147
+ app-level conditions) is reported as *possibly* exposed, not safe.
148
+ - Field validation against production traffic requires a live PHP host; the
149
+ test suite validates against synthetic traffic.
150
+
151
+ ## License
152
+
153
+ Open-core. The **engine** (`src/phpwarden/`) and the **bundled community feed**
154
+ are **Apache-2.0** — free to use, inspect, modify and redistribute (see
155
+ [`LICENSE`](LICENSE)). The **hosted service** (`saas/`, `server/`) and the
156
+ **maintained feed** are proprietary/commercial. Full scope in
157
+ [`LICENSING.md`](LICENSING.md).
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "phpwarden"
7
+ version = "2.0.0"
8
+ description = "PHP exposure and exploitation guard — assess any PHP host against an evolving CVE feed, and watch PHP-FPM for active exploitation"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "localprime" }]
14
+ keywords = ["php", "php-fpm", "security", "cve", "vulnerability", "exploitation", "detection", "rce"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: System Administrators",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Topic :: Security",
22
+ "Topic :: System :: Monitoring",
23
+ ]
24
+ dependencies = [] # stdlib only
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/localprime/phpwarden"
28
+
29
+ [project.scripts]
30
+ phpwarden = "phpwarden.cli:main"
31
+ phpwarden-guard = "phpwarden.guard:main"
32
+
33
+ [tool.setuptools]
34
+ package-dir = { "" = "src" }
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
38
+
39
+ [tool.setuptools.package-data]
40
+ phpwarden = ["data/*.json"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """phpwarden — PHP exposure and exploitation guard.
2
+
3
+ A general successor to the single-CVE php2shell checker: it assesses a PHP
4
+ environment against an evolving knowledge base of PHP CVEs (the feed), and can
5
+ watch PHP-FPM for active exploitation. The engine is open; the CVE feed is the
6
+ part a subscription keeps current.
7
+ """
8
+ __version__ = "2.0.0"