|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for helping make PHP2Shell reproducible. Contributions are reviewed for |
| 4 | +correctness, safety and evidence. |
| 5 | + |
| 6 | +## Scope |
| 7 | + |
| 8 | +Welcome: |
| 9 | + |
| 10 | +- new build profiles with a real command proof and the exact image/tag; |
| 11 | +- offset extraction for new distributions and architectures; |
| 12 | +- laboratory fixes and calibration improvements; |
| 13 | +- tests, documentation, detection guidance and defensive tooling; |
| 14 | +- fixes for the open configurations (`display_errors=Off`, `expose_php=Off`, |
| 15 | + FPM). |
| 16 | + |
| 17 | +Not welcome: |
| 18 | + |
| 19 | +- target lists, mass-exploitation tooling or automation against third parties; |
| 20 | +- data from systems you do not own (hostnames, IPs, cookies, credentials); |
| 21 | +- changes that make remote saturation pinning a default; |
| 22 | +- unverified "RCE" claims. |
| 23 | + |
| 24 | +## Adding a profile |
| 25 | + |
| 26 | +1. Use an exact image tag and the matching architecture. |
| 27 | +2. Run `tools/php2shell_calibrate.py` against a local lab. |
| 28 | +3. Confirm a real proof (`uid=...`), not just a successful response. |
| 29 | +4. Add `profiles/<build>.json` with the offsets, heap parameters and |
| 30 | + `rce: true` only when the proof is reproducible. |
| 31 | +5. If stage 3 is probabilistic, say so in the profile and in the README table. |
| 32 | +6. Update `docs/profile-inventory.md` and the README status table together. |
| 33 | + |
| 34 | +Profiles must not contain target data. `rce: false` is a valid and useful |
| 35 | +result: negative data prevents false positives. |
| 36 | + |
| 37 | +## Code style |
| 38 | + |
| 39 | +- Python 3.11+ with the standard library; avoid new runtime dependencies. |
| 40 | +- Keep the dispatcher's safe defaults: loopback automatic, remote opt-in. |
| 41 | +- Error messages must not print secrets or raw target data. |
| 42 | +- Run the tests before opening a pull request: |
| 43 | + |
| 44 | +```sh |
| 45 | +python3 -m unittest discover -s tests -v |
| 46 | +gitleaks detect --source . --no-git --redact -v |
| 47 | +``` |
| 48 | + |
| 49 | +## Pull request checklist |
| 50 | + |
| 51 | +- [ ] Tests pass and new logic has a test. |
| 52 | +- [ ] Profile changes include the exact image/tag and a proof. |
| 53 | +- [ ] README/inventory tables are updated and accurate. |
| 54 | +- [ ] No secrets, personal paths or third-party target data. |
| 55 | +- [ ] Credits are preserved (9bie, Karasawa2025, WoYinDao, PHP team). |
| 56 | +- [ ] The change does not weaken the authorization gates. |
| 57 | + |
| 58 | +## Disclosure |
| 59 | + |
| 60 | +This repository is not a vendor channel. If you find a new affected build or a |
| 61 | +new PHP issue, report it to the PHP security team and the distribution vendor |
| 62 | +through their coordinated disclosure process. Do not open a public issue with |
| 63 | +an unpatched exploit. |
0 commit comments