Skip to content

Volume 10 · Security & Authentication

บทนี้แผยภาพรวมด้านความปลอดภัยของระบบ VTRC โดยอ้างอิง file:line ของ source code จริงในทุกโพรไฟล์ของระบบ


ทำไมต้องมี Volume นี้

ระบบ VTRC รัน production มาตั้งแต่ปี 2564 โดยไม่เคยผ่าน security audit เชิงลึกที่มีการ verify กับ source code จริง เมื่อ audit อย่างเป็นทางการใน Phase 5 (เอกสาร audit/05-tech-debt-register.md) พบปัญหา Critical 11 ข้อ และ High อีกเป็นสิบ ข้อ — ทั้งหมดแบ่งเป็น 5 หมวดคือ authentication, secrets, injection, infrastructure exposure, supply chain

Volume 10 นี้ไม่ใช่ checklist ที่ไม่มีบริบท — ทุกบทเจาะ source code จริง อธิบายว่า bug เกิดจากอะไร, attacker ใช้ประโยชน์ได้อย่างไร, และแก้อย่างไร อ่านจบแล้วควรรู้ว่าถ้าต้อง triage incident ที่เกี่ยวกับ auth หรือ injection ใน VTRC ต้องเริ่มที่ไหน

Volume นี้เสริม Volume 3.3 (Authentication & session internals) — Volume 3 อธิบาย mechanics ว่า login ทำงานอย่างไร Volume 10 อธิบายว่า mechanics นั้นมีช่องโหว่อะไรบ้าง


Severity legend

🔴 Critical = active security/data-loss/availability risk ต้องแก้ทันที
🟡 High     = correctness/maintainability hazard มี impact จริง
🟢 Medium   = friction/hygiene ยังไม่อันตรายแต่เป็น debt

ระดับ severity ใน Volume นี้ mapping กับ debt register ใน audit/05-tech-debt-register.md ทุก entry (SEC-1 ถึง SEC-11, CORR-2/4/6, PERF-3/4/7, LEG-1 ถึง LEG-29)


โครงสร้าง Volume

9.1  Threat model + attack surface   — ตั้ง trust boundary ก่อน
9.2  Authentication flow              — login end-to-end พร้อมช่องโหว่
9.3  JWT + session internals          — refresh bug, JSON scan, decode-vs-verify
9.4  RBAC + @auth directive           — CORR-4 inconsistency
9.5  Credentials + secrets            — GCP key, device keys, JWT 'secret' default
9.6  Injection + RCE                  — execSync × 5, /webdeployment, SQLi
9.7  File upload + path traversal     — multer, /conicle/downloadFile, /file/:id
9.8  Network + infra exposure         — CORS bug, phpMyAdmin, network_mode: host
9.9  Logging exposure                 — refreshToken ใน log, forceLoging injection
9.10 Supply chain + runtime           — axois, Node 12 EOL, jsonwebtoken@8
9.11 Scorecard + remediation          — Wave 0 stop-the-bleed checklist

5 หมวดหลักของปัญหา

หมวดบทจำนวน Criticalตัวอย่าง
Authentication + session9.2, 9.32refreshToken ใช้ decode ไม่ verify; ไม่มี rate limit
RBAC9.41CORR-4 role.accessRole shape ไม่ consistent
Secrets9.54GCP SA key ใน repo, prod device keys plaintext, JWT 'secret' default
Injection9.65qpdf execSync × 5 endpoints, /webdeployment
Infrastructure9.7, 9.8, 9.92phpMyAdmin exposed, Conicle SSRF + path traversal

ใครควรอ่านบทไหน

ถ้าเป็นอ่านบท
Dev ที่แก้ auth หรือ session9.1, 9.2, 9.3, 9.4
DevOps ที่ดูแล deploy9.5, 9.8, 9.10
Dev ที่แก้ PDF/file endpoint9.6, 9.7
คนที่จะ triage incident9.1, 9.11
คนที่วางแผน modernize9.11 (เชื่อมไป Volume 15)

สิ่งที่ Volume นี้ไม่ครอบคลุม

  • การ audit TLS cipher suite ที่ edge nginx — config อยู่นอก repo (mount ผ่าน ./nginx:/etc/nginx/conf.d) จึง verify ไม่ได้
  • ผล npm audit / yarn audit — ต้องรัน network install ก่อน นอก scope ของ static audit
  • OWASP top 10 ทั้งหมด — เน้นเฉพาะที่พบใน codebase จริง ไม่ใช่ generic checklist

อ่านต่อ → 9.1 Threat model + attack surface