phpsafe 𝕏 GitHub
Official CA 421DTkQ3TSG3n7F9SkNZj9NxvdFGbypwkctPd2uupump This is the only official address.
CWE Β· OWASP Top 10:2021

PHP security rules

The 18 checks behind the PHP Safe scanner. Each one comes with a vulnerable example, the secure fix and its CWE and OWASP references.

Injection 8

Critical CWE-89

SQL built with variables (SQL injection)

Joining input into SQL lets an attacker rewrite the query itself and read, change or delete anything in the database. Prepared statements send the query and the values separately, so input can never become SQL.

Learn more β†’
Critical CWE-78

Shell command execution

Input passed to the shell can append extra commands with characters such as ; or |, handing the attacker control of the server. Validate the value strictly and quote every argument.

Learn more β†’
Critical CWE-95

Code execution with eval()

eval() runs whatever PHP it receives. If any part of that string comes from a request, an attacker can run their own code on your server.

Learn more β†’
Critical CWE-95

preg_replace with the /e modifier

The /e modifier evaluated the replacement as PHP code. It was removed in PHP 7, so code that still uses it is dangerous on old servers and broken on new ones.

Learn more β†’
Critical CWE-98

File inclusion from user input

Building include paths from input lets attackers load system files, uploaded images containing PHP or remote code. It is one of the fastest routes to a full server takeover.

Learn more β†’
Medium CWE-98

Include path built from a variable

A variable include path is only safe if the variable can never hold user input. It is worth confirming, because the value often comes from a request further up the code.

Learn more β†’
Critical CWE-502

unserialize() on untrusted data

unserialize() can create any object, and attackers chain existing classes (gadgets) to delete files or run code. JSON only ever produces plain data.

Learn more β†’
High CWE-621

extract() on request data

extract() turns every request field into a variable, so an attacker can overwrite variables such as $is_admin just by adding a field to the form.

Learn more β†’