PHP Security Masterclass

Study material from posts already published on PHP Hub. It is not an assessment of your application and it does not replace an authorized audit.

0 of 8 published modules marked complete on this device.

  1. 1. Password Hashing in PHP: password_hash, password_verify and Safe Rehashing

    Store PHP passwords safely with password_hash() and password_verify(), upgrade old hashes on login with password_needs_rehash(), and migrate legacy MD5 hashes.

    5 min read

  2. 2. Laravel Mass Assignment: Fillable, Guarded and Safe Request Validation

    Allow-list model columns, pass only validated input to create() and update(), and make Laravel fail loudly in development when a field is silently dropped.

    5 min read

  3. 3. Laravel CSRF Protection: Tokens, Exceptions and SPA Pitfalls

    Keep Laravel CSRF on for cookie-auth routes, put tokens in forms and AJAX headers, exclude only true third-party webhooks, and initialize Sanctum SPAs with /sanctum/csrf-cookie.

    4 min read

  4. 4. XSS Prevention in Laravel Blade: {{ }}, {!! !!} and Js::from

    Prefer Blade {{ }} for any user-supplied text, never dump raw input with {!! !!}, use Js::from for JSON in scripts, and leave @{{ }} for frontend frameworks.

    4 min read

  5. 5. SQL Injection in Laravel: Raw Queries, Bindings and Safe ORDER BY

    Bind every value (?, named bindings, or the query builder), never interpolate request data into raw SQL, and allow-list column names and sort directions because PDO cannot bind them.

    4 min read

  6. Critical

    6. PHP2Shell: two critical PHP core RCE flaws fixed in 8.5.12 / 8.4.27 / 8.3.36 / 8.2.35

    On 21 Oct 2026 the PHP project shipped emergency security releases fixing two vulnerabilities in PHP itself (not in any framework or plugin). Both can allow unauthenticated remote code execution.…

    4 min read

  7. Critical

    7. PHP security this week (26 Oct – 2 Nov 2026)

    Five items worth a look this week, from official sources only (checked 2 Nov 2026 against NVD, the CISA KEV catalog and GitHub advisories). One is urgent (PHP itself); the rest are routine…

    3 min read

  8. 8. How We Patched Our Own Site: Clearing 5 npm Advisories with an Astro 7 Upgrade

    npm audit flagged 5 advisories (1 critical) on PHP Hub. How we upgraded Astro 5.18.2 to 7.4.5, moved to Node 22 and proved nothing broke.

    A case study about this site’s own dependency upgrade.

    3 min read

Questions from the published lessons

Questions are taken from published PHP Hub lessons. This does not grade a certification, and the answers are checked in your browser.

1. Which call does the password hashing lesson say to use for a new password?
2. The mass assignment lesson says never to pass which value straight into create(), update(), or fill()?
3. Which Blade directive does the CSRF lesson say adds the hidden token field?
4. The XSS lesson says Blade {{ }} passes the value through which PHP function?
5. Which call does the SQL injection lesson treat as safe because the query builder binds the value?

Practical next steps

Get new briefs by email

Short alerts when a PHP or WordPress vulnerability needs action.

Double opt-in via Buttondown; unsubscribe any time. See our privacy policy.