ปี 2023 ข้อมูลลูกค้าของบริษัทประกันรายใหญ่ในไทยรั่วไหลออกสู่ Dark Web กว่า 160 ล้าน Records ค่าใช้จ่ายทางกฎหมาย, Reputational Damage และ Customer Churn ที่ตามมามหาศาลกว่าค่าลงทุนใน Security หลายสิบเท่า
SME อาจคิดว่า "เราเล็กเกินไปที่ Hacker จะสนใจ" แต่ความจริงคือตรงกันข้าม — SME เป็นเป้าหมายที่ "ง่ายกว่า" เพราะมัก Security น้อยกว่า
OWASP Top 10 — ช่องโหว่ที่พบบ่อยที่สุด
OWASP (Open Web Application Security Project) เผยแพร่รายการ 10 ช่องโหว่ที่อันตรายที่สุดของ Web Application ที่ Software House ทุกเจ้าต้องรู้:
1. Broken Access Control
ผู้ใช้ธรรมดาสามารถเข้าถึงข้อมูลของคนอื่นหรือทำ Action ที่ไม่ควรทำได้
ตัวอย่าง: เปลี่ยน URL จาก /profile/123 เป็น /profile/456 แล้วเห็นข้อมูลคนอื่น
วิธีป้องกัน: ตรวจสอบ Permission ทุก Request ไม่ใช่แค่ตอน Login
2. Cryptographic Failures
เก็บหรือส่งข้อมูลสำคัญโดยไม่มี Encryption
ตัวอย่าง: เก็บ Password ใน Database เป็น Plain Text, ส่ง Credit Card ผ่าน HTTP
วิธีป้องกัน: bcrypt/argon2 สำหรับ Password, TLS สำหรับ every transmission, AES สำหรับ Sensitive Data at Rest
3. Injection (SQL, NoSQL, Command)
ผู้โจมตีส่ง Input ที่มี Code ซ่อนอยู่ ทำให้ Database หรือ Server รัน Command ที่ไม่ได้ตั้งใจ
ตัวอย่าง SQL Injection: ใส่ '; DROP TABLE users; -- ในช่อง Username
วิธีป้องกัน: Parameterized Queries, ORM ที่ดี, Input Validation ทุกจุด
4. Cross-Site Scripting (XSS)
ผู้โจมตี Inject JavaScript ลงใน Web ทำให้รัน Code ใน Browser ของ User อื่น
ตัวอย่าง: ใส่ <script>alert('hacked')</script> ในช่อง Comment แล้วทุกคนที่อ่านถูก Execute
วิธีป้องกัน: Output Encoding, Content Security Policy (CSP) Header
5. Insecure Design
Architecture ที่ไม่ได้ออกแบบมาเพื่อ Security ตั้งแต่ต้น
ตัวอย่าง: ไม่มี Rate Limiting สำหรับ Login ทำให้ Brute Force ได้ง่าย
วิธีป้องกัน: Threat Modeling ตอน Design Phase, Security Review ก่อน Build
Security ขั้นพื้นฐานที่ทุก Software ต้องมี
Authentication และ Authorization
| ❌ ไม่ควรทำ | ✅ ควรทำ |
|---|---|
| Password ไม่มี Policy | Require ความยาว 8+ ตัว, มีตัวใหญ่ + ตัวเลข |
| ไม่มี Rate Limiting บน Login | Lock หลัง 5 ครั้งผิด |
| Session ไม่ Expire | Auto Logout หลัง Inactive |
| ไม่มี 2FA สำหรับ Admin | Require 2FA สำหรับทุก Admin Account |
Data Protection
- HTTPS Everywhere — ไม่มีข้อยกเว้น แม้แต่ Internal Tool
- Encrypt Sensitive Data at Rest — ข้อมูลส่วนบุคคล, Financial Data
- Principle of Least Privilege — แต่ละ User เห็นและทำได้เฉพาะสิ่งที่จำเป็น
- Data Retention Policy — ลบข้อมูลที่ไม่จำเป็นแล้วออก ไม่เก็บตลอดไป
Input Validation
ตรวจสอบทุก Input ทั้งฝั่ง Frontend (UX) และ Backend (Security):
- ประเภทข้อมูลถูกต้อง
- ความยาวไม่เกิน Limit
- ไม่มี Special Character ที่อันตราย
- ไม่มี Script หรือ SQL Code
Audit Logging
บันทึก Activity สำคัญทุกครั้ง:
- Login/Logout (สำเร็จและล้มเหลว)
- Data Access สำหรับข้อมูล Sensitive
- Configuration Change
- Admin Action ทั้งหมด
Log ต้องเก็บนานพอสำหรับ Forensic (อย่างน้อย 90 วัน)
PDPA และ Software
พรบ. คุ้มครองข้อมูลส่วนบุคคล (PDPA) มีผลต่อ Software ที่เก็บข้อมูลคนไทย:
| ข้อกำหนด | ผลต่อ Software |
|---|---|
| ต้องมีความยินยอม (Consent) | ต้องมีระบบ Consent Management |
| Right to Access | ผู้ใช้ขอดูข้อมูลตัวเองได้ |
| Right to Delete | ลบข้อมูลได้เมื่อร้องขอ |
| Data Breach แจ้ง 72 ชม. | ต้องมี Incident Response Plan |
| Data Minimization | เก็บเฉพาะสิ่งที่จำเป็นจริงๆ |
Security Checklist ก่อน Go-Live
- HTTPS ทุก Endpoint
- Authentication มี Rate Limiting
- Password Hashing ด้วย bcrypt/argon2
- SQL/Input Injection Prevention ทุก Input
- Session Management ที่ถูกต้อง (Expiry, Secure Cookie)
- Access Control ทุก API Endpoint
- Sensitive Data Encrypted at Rest
- CORS Policy ที่ Restrictive
- Security Headers (CSP, HSTS, X-Frame-Options)
- Dependency Vulnerability Scan ผ่านแล้ว
- Error Messages ไม่เปิดเผยข้อมูล System
- Audit Log สำหรับ Sensitive Operations
สรุป
Security ไม่ใช่ "Option" — มันคือ ความรับผิดชอบ ต่อลูกค้า, ต่อกฎหมาย และต่อธุรกิจที่คุณสร้างมา
ต้นทุนของ Security ที่ดี:
- ลงทุน Security ตั้งแต่ต้น → ค่าใช้จ่ายน้อย
- แก้หลัง Breach → ค่าใช้จ่ายมหาศาล + Reputational Damage ที่ซ่อมไม่ได้
Software House ที่ดีจะ Integrate Security ตั้งแต่ Design Phase ไม่ใช่รอ Add ทีหลัง
ต้องการ Security Review สำหรับ Software ที่กำลังพัฒนาหรือที่ Go-Live แล้ว? ติดต่อทีม Adowbig