# Rakuten Securities: Rakuten Securities: WAF bypass in staging led to SQLi implant and 4.41M unmasked records

> **Safety notice:** Run only against your own authorized staging origins.

- **Incident date:** Oct 27–Nov 16, 2026
- **Disclosed:** Nov 17, 2026
- **Source disclosure:** https://www.rakuten-sec.co.jp/web/company/newsrelease/pdf/press2026120401.pdf

## Reproduction lab
Checks your own staging endpoints to verify direct-to-origin HTTP requests without WAF headers are rejected rather than reaching backend APIs.

```bash
# Replace 192.0.2.50 and stg-api.example.com with your own staging origin IP and Host header
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 \
  -H "Host: stg-api.example.com" "https://192.0.2.50/" -k || echo "BLOCKED")
echo "Direct-to-origin result: $STATUS (expected BLOCKED or 403)"
```

## Policies and detection rules

### `enforce-staging-origin-lock.conf`
Origin reverse-proxy guard refusing any request to staging or third-party APIs that does not present a verified mTLS client certificate or secret header from your WAF. Limits step 1.

```nginx
# Enforce WAF-only ingress on staging origins (pair with Security Group / firewall IP allowlist)
server {
    listen 443 ssl;
    server_name stg-api.example.jp;

    ssl_client_certificate /etc/nginx/waf-origin-ca.pem;
    ssl_verify_client on;

    location / {
        if ($http_x_waf_origin_secret != "${WAF_ORIGIN_SECRET}") {
            return 403;
        }
        proxy_pass http://vendor_api_upstream;
    }
}
```

### `hunt-staging-sqli-and-bulk-select.sql`
Audit query flagging anomalous bulk SELECT volume or file-write keywords from staging application database users outside scheduled maintenance windows. Limits steps 2 and 3.

```sql
-- Run against PostgreSQL / Oracle / MySQL staging DB audit logs
SELECT event_time, db_user, client_ip, rows_returned, left(query_text, 160) AS sample
FROM db_audit_log
WHERE environment = 'staging'
  AND (
    rows_returned > 50000
    OR query_text ~* '(into\s+outfile|xp_cmdshell|copy\s+.*to\s+program|pg_read_file|union\s+select)'
  )
ORDER BY event_time DESC;
```

## Indicators of compromise
- **url:** `https://www.rakuten-sec.co.jp/web/company/newsrelease/pdf/press2026120401.pdf` (Official Rakuten Securities December 4 third report PDF detailing the Oct 27 WAF bypass, third-party staging API SQLi implant, Nov 8 internal pivot, and skipped exception approval.)
- **url:** `https://www.rakuten-sec.co.jp/web/info/info20261204-02.html` (Official Rakuten Securities December 4 web notice mirroring the third report.)
- **url:** `https://www.rakuten-sec.co.jp/web/info/info20261124-04.html` (Official Rakuten Securities November 24 second report confirming ~4.41M personal-data records, ~1.68M asset-balance records, and ~11.98M login-ID-only records.)
