Laravel — 2 vulnerability checks
noctis ships 2 vulnerability checks for Laravel, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Laravel Ignition Debug Mode RCE
| CVE | CVE-2021-3129 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | http_request, match · highest QoD 75 |
| Feed | tests/vulnerabilities/laravel/CVE-2021-3129.yaml |
Tests Laravel + Facade Ignition (<= v8.4.2) for the unauthenticated php://filter chain RCE via POST /_ignition/execute-solution. Safe, read-only response-analysis probe: a vulnerable debug-mode Ignition reflects the supplied viewFile marker back in a verbose Illuminate exception (HTTP 500), which a patched / non-debug server does not. Does not perform the exploit write+execute chain, so it reports at QoD 75, not 97.
How noctis detects it
- HTTP(S) request
POST /_ignition/execute-solutionwith a crafted body - Checks
resp.bodyfor(?s)(noctis_cve20213129_probe_marker.*Illuminate|Illuminate.*noctis_c…→ finding QoD 75: Laravel debug-mode Facade Ignition exposed — POST /_ignition/execute-solution returned 500 reflecting the supplied viewFile marker in a ver…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-3129
- https://github.com/zhzyker/vulmap
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-3129.yaml
- https://www.rapid7.com/db/?q=CVE-2021-3129
Feed source — tests/vulnerabilities/laravel/CVE-2021-3129.yaml
# Laravel Ignition (<= v8.4.2) Debug Mode — Remote Code Execution (CVE-2021-3129)
#
# When a Laravel application runs with APP_DEBUG=true and the Facade Ignition
# package (<= 2.5.1 / Laravel Ignition <= 8.4.2) is installed, the unauthenticated
# endpoint POST /_ignition/execute-solution accepts a "solution" with arbitrary
# parameters. MakeViewVariableOptionalSolution then lets an attacker abuse a
# chained php://filter stream on the Laravel log file to achieve RCE.
#
# Detection (safe, read-only — response analysis, QoD 75):
# We do NOT perform the write+execute chain and we do NOT look for a fabricated
# `uid=` command-output line (a single read-only probe never produces one on a
# real target). Instead we send a MakeViewVariableOptionalSolution whose
# `viewFile` is a php://filter *read* of a unique, non-existent marker resource.
# A vulnerable, debug-mode Ignition install:
# 1. has the /_ignition/execute-solution route registered (Ignition present), and
# 2. with APP_DEBUG=true serialises the resulting exception verbatim — a verbose
# HTTP 500 JSON that REFLECTS the attacker-supplied viewFile (our own marker,
# echoed back) and leaks the `Illuminate` vendor framework stack.
# That combination — our marker reflected back AND the Illuminate framework leak,
# at HTTP 500 — is a genuine consequence of the vulnerable debug-mode Ignition and
# is reproducible on a real target. A patched install (package fixed or
# APP_DEBUG=false) does not register the route and returns a flat 404 with no
# reflection and no framework stack, so it cannot match.
#
# Confirmed RCE (QoD 97) would require the full php://filter write + phar trigger
# + `uid=` read-back chain; this feed intentionally stays at the safe QoD-75 tier.
#
# Source: Nuclei http/cves/2021/CVE-2021-3129.yaml (same endpoint + solution;
# the Nuclei template only reaches `uid=` after writing and executing a payload)
# + the Ignition debug-mode exception-reflection behaviour.
uid: e466fef8-9161-4157-91a1-4fa16c33e6aa
name: "Laravel Ignition Debug Mode RCE (CVE-2021-3129)"
description: |
Tests Laravel + Facade Ignition (<= v8.4.2) for the unauthenticated
php://filter chain RCE via POST /_ignition/execute-solution. Safe, read-only
response-analysis probe: a vulnerable debug-mode Ignition reflects the
supplied viewFile marker back in a verbose Illuminate exception (HTTP 500),
which a patched / non-debug server does not. Does not perform the exploit
write+execute chain, so it reports at QoD 75, not 97.
cves: [CVE-2021-3129]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags: [laravel, ignition, debug-mode, rce, kev, php-filter]
services: [http, https]
author: noctis
version: "1.1.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2021-3129"
- "https://github.com/zhzyker/vulmap"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-3129.yaml"
- "https://www.rapid7.com/db/?q=CVE-2021-3129"
steps:
# ── Safe read-only probe: MakeViewVariableOptionalSolution against a unique,
# non-existent php://filter *read* resource (no write, no execution). ─────
- id: ignition-probe
action: http_request
method: POST
path: "/_ignition/execute-solution"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 10
headers:
Accept: "application/json"
Content-Type: "application/json"
body: '{"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution", "parameters": {"variableName": "cve20213129", "viewFile": "php://filter/read=convert.base64-encode/resource=/noctis_cve20213129_probe_marker"}}'
store_as: resp
# ── Confirm: HTTP 500 whose body reflects OUR marker AND leaks the Illuminate
# framework stack — both signals of a vulnerable debug-mode Ignition.
# (?s) so `.` spans the JSON; either order accepted. Not a fabricated
# command-output marker — this is our reflected input + framework leak. ────
- id: ignition-match
action: match
source: resp.body
pattern: "(?s)(noctis_cve20213129_probe_marker.*Illuminate|Illuminate.*noctis_cve20213129_probe_marker)"
condition: "resp.status == 500"
on_match:
finding:
confidence_delta: 0.45
qod: 75
evidence: "Laravel debug-mode Facade Ignition exposed — POST /_ignition/execute-solution returned 500 reflecting the supplied viewFile marker in a verbose Illuminate exception (Ignition installed, APP_DEBUG on), exploitable via the php://filter RCE chain: {{resp.body}}"
stop: trueLaravel .env environment file disclosure
| CVE | CVE-2017-16894 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | file-read — File read |
| Services | http, https |
| Detection | set_var, http_request, script, match · highest QoD 75 |
| Feed | tests/vulnerabilities/laravel/CVE-2017-16894.yaml |
Reads the Laravel environment file (/.env and common backup / sub-directory copies) over HTTP and confirms it is a Laravel .env (APP_KEY= plus another standard Laravel variable, each at the start of a line). The file exposes APP_KEY, database and mail credentials and API keys. Values are redacted in the finding — only the names of the leaked variables are reported.
How noctis detects it
- HTTP(S) request
GET {{env_path}} - Parses / computes the next value with a Rhai script
- Checks
env_leak.redactedfor(?m)^[ \t]*(export[ \t]+)?APP_KEY=<redacted>$→ finding QoD 75: Laravel environment file readable without authentication at … (HTTP 200). Leaked variables (values redacted): …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-16894
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-16894.yaml
- https://laravel.com/docs/5.5/configuration#environment-configuration
Feed source — tests/vulnerabilities/laravel/CVE-2017-16894.yaml
# Laravel — environment (.env) file disclosure (CVE-2017-16894)
#
# Laravel (through 5.5.21) keeps every secret of the application — APP_KEY (the
# encryption / signed-cookie key, which turns into RCE through the cookie
# deserialization chain), DB_PASSWORD, MAIL_PASSWORD, cloud API keys — in the
# `.env` file at the project root. When the web server's document root is the
# project root instead of `public/`, or a copy of the file is left next to the
# app, anyone can GET it.
#
# Detection (real exploitation, read-only — QoD 75):
# We actually read the file and prove it is a Laravel environment file, not just
# that the path answers 200: the body must hold an `APP_KEY=` assignment line AND
# another Laravel-standard assignment line (APP_ENV/APP_DEBUG/APP_URL/APP_NAME or
# DB_CONNECTION/DB_HOST/DB_DATABASE/DB_USERNAME/DB_PASSWORD). Both are matched as
# `KEY=` at the start of a line, so an HTML catch-all / SPA page that merely
# answers 200 (or quotes those names in prose) cannot match.
#
# The leaked values are secrets: a `script` step builds a copy of the file that
# keeps only the `KEY=` assignment lines with every value replaced by
# `<redacted>`, and the `match` step (whose source is copied into the finding)
# runs on that copy — the finding lists which variables leaked, never their values.
#
# Better than the sources:
# - Nuclei (http/cves/2017/CVE-2017-16894.yaml) only probes `/.env` and requires
# `Content-Type: application/octet-stream` — missing every server that serves
# dotfiles as text/plain — plus APP_NAME= which Laravel < 5.5 does not write.
# - The OpenVAS NVT (2018/gb_sensitive_file_disclosures_http.nasl) checks `/.env`
# among ~100 generic files. We also try the backup copies editors and deploy
# scripts leave behind and the usual sub-directory installs.
#
# Source: OpenVAS/Greenbone NVT 2018/gb_sensitive_file_disclosures_http.nasl
# (OID 1.3.6.1.4.1.25623.1.0.107305, GPL-2.0-only), Laravel .env entry;
# Nuclei http/cves/2017/CVE-2017-16894.yaml.
uid: ae7cdd4e-3e5c-44a8-8338-fcc90dace0a8
name: "Laravel .env environment file disclosure (CVE-2017-16894)"
description: |
Reads the Laravel environment file (/.env and common backup / sub-directory
copies) over HTTP and confirms it is a Laravel .env (APP_KEY= plus another
standard Laravel variable, each at the start of a line). The file exposes
APP_KEY, database and mail credentials and API keys. Values are redacted in
the finding — only the names of the leaked variables are reported.
cves: [CVE-2017-16894]
cvss: 7.5
severity: high
category: file-read
confidence_base: 0.30
tags: [laravel, php, env, dotenv, information-disclosure, secrets, file-read]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-16894"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-16894.yaml"
- "https://laravel.com/docs/5.5/configuration#environment-configuration"
steps:
# ── Per path: pre-initialise the stored result (a failed request leaves
# `store_as` unset, and an undefined var in the script would abort the
# whole test), fetch the candidate, analyse, report. A finding stops the loop.
- id: init
action: set_var
var_name: env_resp
var_value: {status: 0, body: ""}
loop:
over:
- /.env
- /.env.backup
- /.env.bak
- /.env.save
- /.env.old
- /.env.production
- /laravel/.env
- /core/.env
- /api/.env
var: env_path
- id: fetch-env
action: http_request
method: GET
path: "{{env_path}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 8
store_as: env_resp
# ── Analyse the body: Laravel .env signature + a redacted copy that keeps only
# `KEY=<redacted>` lines (never the secret values). Names are upper-case
# only, so a mixed-case base64 continuation line of a multi-line quoted
# value (e.g. a PEM key tail `Zm9vYmFy==`) is not mistaken for a name. ────
- id: analyse
action: script
code: |
let b = if type_of(env_resp.body) == "string" { env_resp.body } else { "" };
let has_key = ereg("(?m)^[ \\t]*(export[ \\t]+)?APP_KEY[ \\t]*=", b);
let has_other = ereg("(?m)^[ \\t]*(export[ \\t]+)?(APP_(ENV|DEBUG|URL|NAME)|DB_(CONNECTION|HOST|DATABASE|USERNAME|PASSWORD))[ \\t]*=", b);
let assigns = egrep("^[ \\t]*(export[ \\t]+)?[A-Z][A-Z0-9_]*[ \\t]*=", b);
let redacted = ereg_replace("(?m)^([ \\t]*(export[ \\t]+)?[A-Z][A-Z0-9_]*)[ \\t]*=.*$", "${1}=<redacted>", assigns);
#{ laravel: env_resp.status == 200 && has_key && has_other, redacted: redacted }
store_as: env_leak
- id: report
action: match
source: env_leak.redacted
pattern: "(?m)^[ \\t]*(export[ \\t]+)?APP_KEY=<redacted>$"
condition: "env_leak.laravel"
on_match:
finding:
confidence_delta: 0.55
qod: 75
evidence: "Laravel environment file readable without authentication at {{env_path}} (HTTP 200). Leaked variables (values redacted): {{env_leak.redacted}}"
stop: true