Bỏ qua menu, vào nội dung chính
Security Audit

Audit security cho web app — checklist 40 điểm

TLDR — tóm tắt

Audit security web app qua 5 nhóm: (1) OWASP Top 10 (injection, XSS, CSRF, auth, …), (2) Authentication + session management, (3) Secrets + config, (4) HTTP headers + transport, (5) Dependency + supply chain. Checklist 40 mục dưới đây áp dụng cho mọi web app production. Mỗi audit cycle: 4-8 giờ kỹ sư.

Thời gian4-8 giờ kỹ sư + 2-4 tuần fix
Mức độKhó
AudienceCTO / Security Engineer / Senior Dev

Security incident có thể tổn thất 50-500 triệu (revenue lost + GDPR/Nghị định 13 fines + reputation). Audit định kỳ 6 tháng 1 lần là minimum cho web app production. Hướng dẫn này dựa OWASP Top 10 2021 + Nghị định 13/2023 Việt Nam.

6 bước · Quy trình

Hướng dẫn từng bước

Mỗi bước có duration + todos cụ thể + deliverable rõ ràng. Theo thứ tự — không skip.

  1. 01

    OWASP Top 10 scan

    2-3 giờ

    Quét manual + automated 10 lỗ hổng phổ biến nhất theo OWASP. Đây là baseline minimum.

    Việc cần làm
    • A01 Broken Access Control — kiểm tra IDOR, missing authorization checks
    • A02 Cryptographic Failures — TLS version, weak ciphers, password hashing (bcrypt/argon2)
    • A03 Injection — SQL injection test với sqlmap, XSS test reflected + stored
    • A04 Insecure Design — review architecture, threat modeling
    • A05 Security Misconfiguration — error pages leak info, default credentials, unnecessary services
    • A06 Vulnerable Components — npm audit, dependency scan
    • A07 Auth Failures — brute force, session fixation, weak password policy
    • A08 Software + Data Integrity — verify CI/CD pipeline + signed releases
    • A09 Logging Failures — log security events, không log sensitive data
    • A10 SSRF — kiểm tra server-side request forgery
    Output: OWASP scan report với CVE severity ranking
  2. 02

    Authentication + Session management

    1-2 giờ

    Auth là attack surface lớn nhất. Verify mọi flow: login, logout, password reset, account lockout.

    Việc cần làm
    • Password policy enforce: min 8 chars, complexity, no breached passwords (haveibeenpwned)
    • Account lockout sau 5-10 failed attempts (rate limit)
    • Session cookie: httpOnly + secure + sameSite=lax
    • JWT properly: short expiry (15min) + refresh token, validate signature, no sensitive data in payload
    • Logout: invalidate session server-side (không chỉ delete cookie)
    • Password reset: token expires <1h, single use, secure transmission
    • MFA / 2FA cho admin accounts (TOTP, SMS, hoặc passkey)
    Output: Auth audit report + recommendations
  3. 03

    Secrets + Configuration

    1 giờ

    Secrets leak là root cause của 30% incidents. Verify không có secrets in code, env, log.

    Việc cần làm
    • Scan codebase với git-secrets / gitleaks — không có API key trong git history
    • Environment variables không log ra console
    • Production secrets khác staging khác dev
    • Rotate secrets policy: API keys 90 ngày, passwords 180 ngày, certificates 365 ngày
    • Secrets storage: AWS Secrets Manager / Cloudflare Secrets / Vault — không .env trên server
    • Database connection string không hardcode trong code
    Output: Secrets audit + rotation plan
  4. 04

    HTTP Headers + Transport security

    30 phút

    Modern web app cần headers đúng để defense in depth. Test với securityheaders.com.

    Việc cần làm
    • HTTPS strict — redirect HTTP → HTTPS
    • HSTS header: max-age >= 31536000 (1 năm), includeSubDomains, preload
    • Content-Security-Policy: restrict script-src, style-src, img-src
    • X-Content-Type-Options: nosniff
    • X-Frame-Options: DENY (chống clickjacking)
    • Referrer-Policy: strict-origin-when-cross-origin
    • Permissions-Policy: disable unused features (geolocation, camera)
    • Cookies: Secure + HttpOnly + SameSite cho mọi cookies
    Output: Headers score A+ trên securityheaders.com
  5. 05

    Dependency + Supply chain

    1 giờ

    Supply chain attacks (npm package compromise) tăng nhanh 2024-2026. Verify dependencies định kỳ.

    Việc cần làm
    • npm audit / pnpm audit weekly — fix high + critical
    • Snyk hoặc Dependabot enabled trong GitHub
    • Lockfile (package-lock.json / pnpm-lock.yaml) committed
    • Review new dependencies trước khi add — popularity, last update, maintainer reputation
    • Pin major versions — không dùng `latest` hoặc `^` cho critical libs
    • SBOM (Software Bill of Materials) — list tất cả dependencies + license + version
    Output: Dependency audit report + SBOM
  6. 06

    Nghị định 13/2023 compliance (Việt Nam)

    1-2 giờ

    Nghị định 13 về bảo vệ dữ liệu cá nhân — apply cho mọi web app xử lý data người dùng VN.

    Việc cần làm
    • Consent banner cookie + tracking — user opt-in explicit
    • Privacy policy đầy đủ — data thu thập gì, dùng làm gì, bao lâu, share với ai
    • User rights — xem data, xoá data, export data theo yêu cầu (trong 30 ngày)
    • Data localization — data nhạy cảm lưu tại VN (VNG, Viettel IDC) nếu thuộc danh mục bắt buộc
    • Audit log truy cập data cá nhân — ai access khi nào
    • Breach notification process — báo cáo trong 72h nếu có incident
    • DPA (Data Processing Agreement) với mỗi vendor xử lý data (Google Analytics, OpenAI, etc.)
    Output: Compliance checklist signed off
Checklist · Print-friendly

Checklist tổng hợp

Print ra hoặc copy vào Notion để track. Mỗi category là 1 group rõ ràng.

OWASP Top 10

  • Authorization checks trên mọi endpoint
  • TLS 1.2+ với strong ciphers
  • Parameterized queries (no SQL injection)
  • Input validation + output encoding (no XSS)
  • Default credentials removed
  • npm audit clean (no high/critical)
  • Brute force protection
  • Audit log security events
  • SSRF prevention

Authentication

  • Password min 8 chars + breached check
  • Account lockout sau 5-10 fails
  • Session cookie httpOnly + secure + sameSite
  • JWT short expiry + refresh token
  • Logout invalidate server-side
  • Password reset token <1h + single use
  • MFA cho admin

Secrets + Config

  • Git-secrets scan clean
  • Secrets không log
  • Production secrets isolated
  • Rotation policy documented
  • Secrets manager (not .env)
  • DB connection không hardcode

HTTP Headers

  • HTTPS redirect
  • HSTS 1 năm + preload
  • CSP restrict script/style/img
  • X-Content-Type-Options: nosniff
  • X-Frame-Options: DENY
  • Cookies Secure + HttpOnly + SameSite

Nghị định 13 VN

  • Cookie consent banner
  • Privacy policy đầy đủ
  • User data rights (view/delete/export)
  • Data localization nếu cần
  • Audit log data access
  • Breach notification process
  • DPA với 3rd party vendors
Warnings · Tránh ngay

5 dấu hiệu nguy hiểm

Pattern thực tế đã gây fail nhiều dự án. Recognize sớm + fix ngay.

API key trong git history

Commit accidentally → leak forever. Tools như git-secrets, gitleaks scan. Nếu lỡ commit: rotate ngay, force-push không cứu được (đã clone). Use BFG Repo-Cleaner.

Password hash với MD5/SHA1

Vẫn còn thấy trong legacy code VN. Phải migration sang bcrypt/argon2. Migration plan: re-hash password khi user login next time.

Database backup không encrypt

Backup leak = full database leak. Encrypt backup at rest + transit. Store backup separately từ production credentials.

Admin panel exposed public

Admin panel tại /admin không có IP whitelist + chỉ rely vào auth = risky. Add IP whitelist (Cloudflare Access) + MFA + audit log.

Skip security trong sprint hectic

'Sprint sau sẽ fix' = không bao giờ fix. Embed security trong definition of done. PR review check security checklist.

Alodev tips · Kinh nghiệm thực

4 tips từ Alodev

Insights từ dự án thực tế Alodev đã làm — không lý thuyết.

Automated scan trong CI/CD

Snyk + npm audit + git-secrets trong GitHub Actions. Block merge nếu high/critical vulnerability. Catch sớm, fix rẻ.

Penetration test hằng năm

Internal audit không đủ — outside perspective cần thiết. Pentesting Việt Nam 30-80 triệu cho web app medium. ROI cao.

Bug bounty internal

Reward nhân viên discover vulnerability — 1-5 triệu/finding. Mỗi quý tổ chức 'security day' với reward + ăn pizza.

Incident response runbook

Có sẵn runbook cho 5-10 scenarios (DB leak, admin compromise, DDoS). Khi happen, không panic — execute runbook.

Resources

Tools + resources gợi ý

OWASP Top 10 PDF Vietnamese

Phiên bản 2021 dịch tiếng Việt

Mở

Security headers checker

Test online: securityheaders.com

Have I Been Pwned API

Check password breached: haveibeenpwned.com/Passwords

Nghị định 13 full text

PDF official từ Cổng thông tin Chính phủ

FAQ

Câu hỏi thường gặp

Audit security mất bao nhiêu thời gian + chi phí?

Internal audit (đội tự làm theo checklist): 4-8 giờ kỹ sư cho web app medium. Outside pentest: 30-80 triệu, 1-2 tuần. Frequency: internal mỗi 3 tháng, outside mỗi 12 tháng. ROI: 1 incident = 50-500 triệu mất, audit là rẻ.

Web app SME có thực sự cần security audit không?

Có. Tấn công automated bot scan mọi web 24/7, không phân biệt SME hay enterprise. Đặc biệt nguy hiểm: SME có data KH (CRM, contacts) → bị leak có thể bị phạt Nghị định 13 + reputation damage. Minimum: OWASP Top 10 check + Nghị định 13 compliance.

Sửa security issues mất bao lâu sau audit?

Phụ thuộc severity. Critical (RCE, SQL injection): fix trong 24-72h. High (XSS, auth bypass): 1-2 tuần. Medium (missing headers, weak crypto): 2-4 tuần. Low (cosmetic): roadmap dài hơi. Reserve 10-15% dev time cho security backlog.

Bug bounty program có nên không?

Doanh nghiệp SME: chưa cần public bug bounty. Internal program với nhân viên + close circle (HackerOne private) OK. Public bug bounty cần dev team có capacity respond + reward thực — premature thường tạo noise. Khi quy mô >100k user mới cần public.

Nghị định 13 violations bị phạt thế nào?

Mức phạt theo Nghị định: 50-100 triệu cho tổ chức vi phạm xử lý data cá nhân không có sự đồng ý. 200-500 triệu cho trường hợp nghiêm trọng (data >100 người, data nhạy cảm). Reputation damage lớn hơn nhiều: KH cũ lo ngại + KH mới không tin.

Cần tư vấn chi tiết?

Alodev hỗ trợ trực tiếp

Hướng dẫn này là kinh nghiệm tổng hợp. Mỗi dự án có context riêng. Đặt lịch tư vấn 30 phút để bàn case cụ thể của bạn — miễn phí, không bán hàng ép.