Công cụ kiểm thử bảo mậtSecurity Testing Tools
Thuộc bộ kiến thức DevSecOps Roadmap.
Tổng quan
Các công cụ kiểm thử bảo mật (security testing tools) giúp một đội ngũ xác minh rằng những biện pháp phòng thủ mà họ nghĩ là đã xây dựng thực sự hoạt động — thay vì giả định rằng một rule firewall, một bộ validate input, hay một mức patch nào đó là đúng, ta chủ động thăm dò hệ thống theo cách một kẻ tấn công sẽ làm và quan sát kết quả thực tế. Trong bối cảnh DevSecOps, các công cụ này phục vụ ba mục đích:
- Tìm ra misconfiguration và lỗ hổng trước khi kẻ tấn công tìm ra — một port đáng lẽ phải đóng nhưng lại mở, một form web không sanitize input, một host thiếu bản patch quan trọng, một service vẫn dùng credential mặc định.
- Xác minh rằng các control hoạt động đúng như thiết kế — kiểm tra xem TLS có thực sự được enforce hay không, một rule WAF có thực sự chặn được payload độc hại hay không, một network segment có thực sự không thể truy cập từ internet hay không.
- Cung cấp phản hồi liên tục, lặp lại được — giống như unit test bắt được regression trong code, các đợt scan bảo mật định kỳ và tích hợp trong pipeline bắt được regression trong tư thế bảo mật (security posture) khi hạ tầng và code thay đổi theo thời gian.
Mọi nội dung trong bài này đều giả định có sự cho phép rõ ràng (explicit authorization). Việc scan, capture traffic, intercept request, hoặc dò tìm lỗ hổng trên bất kỳ hệ thống, mạng, hay ứng dụng nào bạn không sở hữu — hoặc không có sự cho phép bằng văn bản rõ ràng để kiểm thử — là bất hợp pháp ở hầu hết các quốc gia (ví dụ theo Computer Fraud and Abuse Act của Mỹ, Computer Misuse Act của Anh, và các luật tương đương ở nơi khác) và gần như chắc chắn dẫn đến sa thải ở mọi tổ chức, kể cả khi ý định là vô hại. Mọi ví dụ trong bài này được viết để chạy trên lab riêng của bạn, một môi trường staging đã được cho phép, hoặc một hệ thống có văn bản authorization/rules of engagement (RoE) bao trùm hoạt động đó. Xem phần Best Practices để biết cách scope hóa sự cho phép này trong thực tế.
Bài này tập trung vào các công cụ kiểm thử động (dynamic) — những công cụ tương tác với một hệ thống đang chạy (mạng, host, hoặc ứng dụng) theo cách một người dùng hoặc kẻ tấn công thực sự sẽ làm, đây chính là bản chất của DAST (Dynamic Application Security Testing) và kiểm thử bảo mật mạng/hạ tầng. Nội dung này bổ sung cho, chứ không thay thế, phân tích tĩnh (static) trên source code và dependency, được trình bày ở Secure Coding and Web Application Security (SAST, code review) và CI/CD and Supply Chain Security (SCA, pipeline gate). Các công cụ scan chuyên biệt cho container và Kubernetes (image scanner, admission controller) được trình bày sâu ở Container and Kubernetes Security; bài này chỉ giới thiệu ngắn gọn để làm bối cảnh.
Kiến thức nền tảng
Các nhóm công cụ kiểm thử bảo mật
Công cụ kiểm thử bảo mật đại khái rơi vào một vài nhóm, mỗi nhóm trả lời một câu hỏi khác nhau:
| Nhóm | Câu hỏi nó trả lời | Công cụ tiêu biểu |
|---|---|---|
| Reconnaissance / network scanning | Có những host và service nào tồn tại, chúng được expose ra sao? | Nmap, Masscan |
| Packet/traffic analysis | Điều gì đang thực sự diễn ra trên đường truyền — dữ liệu có được mã hóa không, giao thức có hoạt động đúng không? | Wireshark, tcpdump |
| Web application testing (proxy/DAST) | Ứng dụng web có xử lý input không tin cậy một cách an toàn tại runtime không? | Burp Suite, OWASP ZAP |
| Vulnerability scanning | Những CVE hoặc misconfiguration đã biết nào tồn tại trên các host/service này? | Nessus, OpenVAS, Qualys |
| Image/container scanning | Image container hay IaC manifest này có chứa lỗ hổng đã biết hoặc cấu hình không an toàn không? | Trivy, Grype, Clair (xem Container and Kubernetes Security) |
Các nhóm này bổ sung cho nhau chứ không cạnh tranh — một đợt đánh giá thực tế thường kết hợp nhiều nhóm lại với nhau (xem Khái niệm chính → Các công cụ này khớp với SDLC ra sao).
Authorization là điều kiện tiên quyết, không phải chuyện làm sau
Trước khi đụng vào bất kỳ công cụ nào trong số này để nhắm vào thứ gì đó khác ngoài lab cá nhân, cần có sẵn ba thứ:
- Văn bản cho phép (written authorization) từ chủ sở hữu hệ thống/dữ liệu, nêu rõ ai đang kiểm thử, phạm vi (scope) là gì, và trong bao lâu.
- Scope được xác định rõ — dải IP, hostname, URL, hay tài khoản cụ thể nào được phép kiểm thử, và tuyên bố rõ ràng cái gì không nằm trong phạm vi (ví dụ: dịch vụ bên thứ ba, database production, tenant khác trong môi trường dùng chung).
- Rules of engagement (RoE) — khung giờ kiểm thử được phép, các kỹ thuật bị cấm (ví dụ: không kiểm thử denial-of-service, không social engineering trừ khi được nêu rõ), liên hệ khẩn cấp khi có sự cố, và cách kết quả sẽ được báo cáo và tiết lộ.
Phần này được mở rộng thêm ở Best Practices.
Khái niệm chính
Nmap — dò tìm mạng và quét cổng (port scanning)
Nmap (“Network Mapper”) là công cụ mã nguồn mở chuẩn để host discovery, port scanning, và service/version fingerprinting. Nó trả lời câu hỏi: cái gì đang “sống” trên mạng này, cổng nào đang mở, và cái gì đang lắng nghe trên chúng?
Các khả năng cốt lõi:
- Host discovery — xác định địa chỉ IP nào trong một dải đang hoạt động, mà không nhất thiết phải quét port.
- Port scanning — xác định cổng TCP/UDP nào đang mở, đóng, hay bị filter.
- Service and version detection — nhận diện phần mềm (và phiên bản) đứng sau một cổng đang mở.
- OS detection — fingerprint hệ điều hành có khả năng dựa trên hành vi của TCP/IP stack.
- NSE (Nmap Scripting Engine) — thư viện script cho các kiểm tra mở rộng (banner grabbing, kiểm tra credential mặc định, phát hiện lỗ hổng cơ bản).
Một số câu lệnh ví dụ (chỉ chạy trên host/mạng bạn được phép quét):
# Chỉ host discovery — không port scan, chỉ tìm host đang sống trong subnet
nmap -sn 192.168.1.0/24
# Basic TCP connect scan trên 1000 cổng phổ biến nhất
nmap 192.168.1.10
# SYN ("half-open") scan trên một dải cổng cụ thể — cần quyền elevated
sudo nmap -sS -p 1-1000 192.168.1.10
# Service/version detection cộng thêm các NSE script mặc định (an toàn)
nmap -sV -sC 192.168.1.10
# Quét toàn bộ cổng (tất cả 65535)
nmap -p- 192.168.1.10
# Chạy nhóm script "vuln" của NSE để đánh dấu các dấu hiệu lỗ hổng đã biết
nmap --script vuln 192.168.1.10
Một vài lưu ý thực tế:
-sS(SYN scan) nhanh hơn và “êm” hơn so với full TCP connect scan, nhưng cần quyền root/administrator vì nó tự tạo raw packet.-sV -sClà tổ hợp “cho tôi biết ở đây có gì” được dùng phổ biến nhất cho một lượt scan nhanh, nhiều thông tin.--script vulnchạy một tập kiểm tra NSE rộng và có thể ồn ào (false positive) và mang tính xâm nhập — nên coi đây là manh mối cần xác minh lại, chứ không phải kết quả đã được xác nhận.- Các scan mạnh tay (
-A, quét toàn dải port, timing template cao như-T4/-T5) tạo ra lượng traffic đáng kể và có thể kích hoạt cảnh báo IDS/IPS, hoặc với các thiết bị dễ vỡ (thiết bị mạng đời cũ, thiết bị OT/ICS) có thể gây mất ổn định — đây chính xác là lý do vì sao scope và RoE quan trọng (xem Best Practices).
Wireshark — capture và phân tích gói tin
Wireshark là công cụ GUI chuẩn để capture và kiểm tra traffic mạng theo từng gói tin. Nếu Nmap cho bạn biết cái gì đang lắng nghe, thì Wireshark cho bạn biết thực sự cái gì đang được truyền tải trên đường dây.
Có hai loại filter khác nhau cần phân biệt:
- Capture filter — áp dụng trước khi gói tin được ghi lại, để giới hạn những gì được capture (dùng cú pháp BPF, ví dụ
tcp port 443). - Display filter — áp dụng sau khi capture, để thu hẹp những gì bạn xem trong số các gói tin đã capture (ngôn ngữ filter riêng, phong phú hơn của Wireshark, ví dụ
tcp.port == 443).
Các display filter phổ biến:
| Filter | Mục đích |
|---|---|
ip.addr == 192.168.1.10 | Chỉ hiện traffic đến/từ một host cụ thể |
tcp.port == 443 | Chỉ hiện traffic trên một cổng cụ thể |
http | Chỉ hiện HTTP request/response |
http.request.method == "POST" | Chỉ hiện HTTP POST request (thường mang dữ liệu form/login) |
tcp.flags.syn == 1 && tcp.flags.ack == 0 | Chỉ hiện gói SYN ban đầu của TCP handshake |
tls.handshake.type == 1 | Hiện gói TLS Client Hello (bắt đầu của TLS handshake) |
ftp hoặc telnet | Hiện traffic FTP/Telnet — hữu ích để minh họa giao thức cleartext |
Đọc TCP three-way handshake: filter theo tcp.port == 443 (hoặc cổng bất kỳ) vào lúc bắt đầu một kết nối và tìm chuỗi:
- Client → Server:
SYN(client yêu cầu kết nối, đề xuất sequence number ban đầu) - Server → Client:
SYN, ACK(server xác nhận và đề xuất sequence number của riêng nó) - Client → Server:
ACK(client xác nhận; kết nối đã được thiết lập)
Wireshark gắn nhãn các gói này trong cột Info là [SYN], [SYN, ACK], [ACK], giúp dễ dàng nhận ra ba bước này bằng mắt.
Phát hiện plaintext credential (và vì sao TLS quan trọng): trên một giao thức không mã hóa — HTTP (không phải HTTPS), FTP, Telnet, hay một service nội bộ vô tình bỏ qua TLS — credential hiển thị dưới dạng cleartext cho bất kỳ ai có thể quan sát traffic (một mạng Wi-Fi dùng chung, một switch bị compromise, một span port bị cấu hình sai). Ví dụ, capture một lượt login FTP và filter theo ftp.request.command == "PASS" sẽ lộ ra mật khẩu ở dạng chữ nguyên văn trong panel chi tiết gói tin; capture một form HTTP submit (http.request.method == "POST") và dùng Follow → HTTP Stream sẽ lộ ra giá trị các field của form, bao gồm cả login credential, dưới dạng plaintext. Đây chính xác là rủi ro mà TLS (HTTPS) loại bỏ: một khi traffic được mã hóa, Wireshark chỉ hiện ciphertext mù mờ (thấy được trong các frame filter theo tls) trừ khi bạn nắm private key hoặc secret giải mã — đây là lý do vì sao enforce TLS ở mọi nơi, kể cả traffic service-to-service nội bộ, là một control cơ bản, không phải tùy chọn. Việc demo điều này trên một VM lab có server Telnet hoặc FTP là cách phổ biến và an toàn để làm rõ luận điểm “TLS quan trọng” với đội ngũ.
Burp Suite — intercepting proxy cho kiểm thử ứng dụng web
Burp Suite (của PortSwigger) là công cụ chuẩn mực trong ngành cho kiểm thử bảo mật ứng dụng web thủ công và bán tự động. Về mặt khái niệm, nó đóng vai trò một proxy nằm giữa trình duyệt của bạn và ứng dụng đích, nên mọi request và response đều đi qua nó và có thể được kiểm tra, chỉnh sửa, và gửi lại — dưới sự cho phép, nhắm vào một ứng dụng bạn được phép kiểm thử.
Các thành phần cốt lõi (ở mức khái niệm — bài này không đi sâu vào các kỹ thuật khai thác):
- Proxy — intercept traffic HTTP(S) giữa trình duyệt và ứng dụng, cho phép tester xem và giữ request lại trước khi nó tới server, và xem response nguyên bản trước khi nó tới trình duyệt.
- Target / Site map — xây dựng bản đồ cấu trúc ứng dụng (trang, tham số, endpoint) khi bạn duyệt qua nó, hữu ích để hiểu attack surface và độ bao phủ trước khi kiểm thử.
- Repeater — cho phép tester gửi lại một request đã capture với giá trị đã sửa đổi, để quan sát response của ứng dụng thay đổi ra sao — đây là cách input handling (ví dụ: ứng dụng có validate/sanitize một tham số hay không, có hiển thị hành vi khác nhau với input khác nhau hay không) được khám phá một cách có phương pháp và lặp lại được.
- Intruder (bản trả phí) — tự động hóa việc gửi nhiều biến thể của một request (ví dụ một wordlist) vào một tham số, hữu ích cho kiểm thử fuzzing/brute-force được cho phép trong phạm vi scope.
- Scanner (Burp Suite Professional) — một engine DAST tự động, crawl và dò ứng dụng để tìm các nhóm lỗ hổng phổ biến (ví dụ các hạng mục OWASP Top 10) và báo cáo kết quả kèm bằng chứng.
Lựa chọn thay thế miễn phí, mã nguồn mở với mô hình proxy/scanning tương tự là OWASP ZAP, ngoài ra còn hỗ trợ tự động hóa CI/CD mạnh (chế độ scan “baseline” và “full” chạy headless, được thiết kế để chạy trong pipeline).
Giá trị thực tế của một công cụ dựa trên proxy như Burp/ZAP trong DevSecOps là nó kiểm thử ứng dụng theo đúng cách một client thực sự làm — sau khi JavaScript phía client đã chạy, sau khi logic routing/API gateway đã được áp dụng, với session state thực — điều mà chỉ phân tích source code tĩnh không thể tái hiện đầy đủ. Nó là đối tác DAST tự nhiên của SAST và dependency scanning được trình bày ở Secure Coding and Web Application Security.
Vulnerability scanner: Nessus, OpenVAS, Qualys
Vulnerability scanner tự động hóa quy trình kiểm tra host, network service, và (ở một số sản phẩm) ứng dụng web dựa trên một cơ sở dữ liệu lớn, được cập nhật liên tục về lỗ hổng đã biết (CVE) và các mẫu misconfiguration. Thay vì kiểm thử thủ công từng vấn đề đã biết, scanner chạy hàng ngàn kiểm tra và báo cáo cái nào khớp.
| Scanner | Nhà cung cấp / license | Ghi chú |
|---|---|---|
| Nessus | Tenable — thương mại (có bản “Essentials” miễn phí cho scope nhỏ) | Được dùng rộng rãi; feed plugin (check) lớn, cập nhật thường xuyên; mạnh về compliance/benchmark scanning |
| OpenVAS / Greenbone Vulnerability Management | Greenbone — lõi mã nguồn mở | Feed do cộng đồng đóng góp, miễn phí tự host, phù hợp làm baseline cho lab và tổ chức nhỏ |
| Qualys | Qualys — thương mại, cloud/SaaS | Mạnh ở quy mô enterprise/fleet lớn, continuous asset inventory, dịch vụ PCI-DSS Approved Scanning Vendor (ASV) |
Các khái niệm cốt lõi chung cho các công cụ này:
- CVE-based scanning — mỗi kiểm tra thường gắn với một hoặc nhiều CVE identifier hoặc một signature misconfiguration cụ thể, nên kết quả ánh xạ trực tiếp tới một lỗ hổng đã biết, có thể theo dõi được, với mức độ nghiêm trọng đã công bố (thường là điểm CVSS).
- Unauthenticated scan — scanner dò mục tiêu thuần túy từ mạng, cùng góc nhìn với một kẻ tấn công bên ngoài không có credential. Nhanh và ít ma sát, nhưng có giới hạn: có thể bỏ sót các lỗ hổng chỉ hiện ra khi đã đăng nhập (ví dụ: phần mềm lỗi thời chỉ thấy được từ admin panel nội bộ, thiếu patch OS mà không có dấu hiệu nhìn thấy được từ mạng).
- Authenticated (credentialed) scan — scanner được cấp credential hợp lệ (SSH, WinRM/SMB, hoặc login ứng dụng) và có thể kiểm tra host hoặc ứng dụng từ bên trong — phiên bản package đã cài, cài đặt registry, file cấu hình local — cho kết quả chính xác và đầy đủ hơn nhiều với ít false positive hơn. Authenticated scanning nói chung là mặc định được khuyến nghị cho tài sản nội bộ; unauthenticated scanning gần với những gì một kẻ tấn công bên ngoài nhìn thấy và hữu ích để xác thực mức độ phơi nhiễm ở perimeter.
- Compliance/configuration scanning — ngoài CVE, các công cụ này có thể kiểm tra host so với một benchmark hardening (ví dụ CIS Benchmarks, DISA STIGs) hay một chuẩn quy định (PCI-DSS), báo cáo độ lệch cấu hình (configuration drift) so với baseline đã được phê duyệt — điều này chồng lấn với việc tự động hóa compliance được trình bày ở Compliance, Governance and Risk Management.
Các vulnerability scanner khớp với pipeline DevSecOps ra sao:
- Các đợt scan có credential theo lịch (ví dụ hàng tuần/hàng tháng) trên fleet production và staging, đưa kết quả vào hệ thống ticketing với SLA khắc phục theo mức độ nghiêm trọng.
- Scan được kích hoạt trên một môi trường staging vừa được provision như một phần của release pipeline, gate việc promote lên production dựa trên việc không có finding critical/high (hoặc có một ngoại lệ đã được phê duyệt).
- Continuous asset inventory để hạ tầng mới được provision (một điểm mù dễ gặp trong môi trường cloud động, autoscale) tự động được đưa vào diện scan thay vì dựa vào danh sách target duy trì thủ công.
- Tích hợp qua API: hầu hết các scanner này expose API nên việc kích hoạt scan, kiểm tra trạng thái, và export kết quả có thể được tự động hóa thay vì chỉ vận hành qua UI.
Image và container scanning (điểm qua ngắn gọn)
Việc scan image container (và các IaC manifest triển khai chúng) để tìm base image layer, package đã biết có lỗ hổng, và cấu hình không an toàn (ví dụ: chạy dưới quyền root, secret bị bake cứng vào layer) là một mảng liên quan nhưng khác biệt, thường được thực hiện bằng các công cụ như Trivy, Grype, hay Clair, thường như một pipeline gate trước khi một image được phép push lên registry hoặc deploy. Nội dung này được trình bày sâu, bao gồm cả admission control và runtime scanning đặc thù cho Kubernetes, ở Container and Kubernetes Security.
Các công cụ này khớp với SDLC ra sao
Một mô hình tư duy hữu ích là xác định mỗi cách tiếp cận kiểm thử hoạt động ở đâu trong vòng đời:
| Cách tiếp cận | Kiểm thử cái gì | Chạy khi nào | Trình bày ở |
|---|---|---|---|
| SAST (static analysis) | Source code, không cần thực thi | Tại thời điểm commit / pull request | Secure Coding and Web Application Security |
| SCA (software composition analysis) | Dependency bên thứ ba để tìm CVE đã biết và vấn đề license | Tại thời điểm build / commit | CI/CD and Supply Chain Security |
| Image/IaC scanning | Image container và IaC manifest | Tại thời điểm build, trước khi push/deploy | Container and Kubernetes Security |
| DAST (bài này: Burp/ZAP, vulnerability scanner, kiểm thử hỗ trợ bởi Nmap/Wireshark) | Một ứng dụng, host, hoặc mạng đang chạy | Nhắm vào staging (hoặc production, với kiểm soát chặt chẽ) sau khi deploy | Bài này |
DAST và SAST bổ sung cho nhau chứ không thay thế: SAST có thể phát hiện một mẫu code có lỗ hổng chưa bao giờ được thực thi ở runtime trong test hiện tại, trong khi DAST có thể phát hiện một lỗ hổng chỉ xuất hiện qua tương tác giữa nhiều thành phần (routing, middleware authentication, reverse proxy) mà phân tích tĩnh một file đơn lẻ không thể thấy được. Một pipeline DevSecOps trưởng thành chạy cả hai, đối chiếu kết quả, và coi sự đồng thuận giữa hai loại là tín hiệu mạnh để ưu tiên xử lý.
Bảng so sánh
| Công cụ | Nhóm | Use case điển hình |
|---|---|---|
| Nmap | Reconnaissance / network scanning | Host discovery, liệt kê cổng mở, service/version fingerprinting |
| Wireshark | Packet/traffic analysis | Kiểm tra gói tin chuyên sâu, troubleshoot giao thức, xác minh mã hóa có thực sự được dùng |
| Burp Suite | Web application (proxy / DAST) | Kiểm thử thủ công và bán tự động input handling, authorization, session management của web app |
| OWASP ZAP | Web application (proxy / DAST) | Lựa chọn mã nguồn mở thay thế Burp, hỗ trợ mạnh tự động hóa pipeline CI/CD |
| Nessus | Vulnerability scanner | Scan host/network dựa trên CVE, kiểm toán benchmark compliance |
| OpenVAS / Greenbone | Vulnerability scanner | Scan CVE mã nguồn mở, tự host cho lab và môi trường nhỏ |
| Qualys | Vulnerability scanner (cloud/SaaS) | Continuous asset scanning quy mô enterprise, scan PCI-DSS ASV |
| Trivy / Grype / Clair | Image/container scanning | Scan CVE và misconfiguration của image container và IaC trước khi deploy |
Best Practices
- Không bao giờ kiểm thử khi chưa có sự cho phép rõ ràng bằng văn bản. Phải có một văn bản scope đã ký (hoặc scope đã công bố của một chương trình pentest/bug-bounty) trước khi chạy bất kỳ scan, capture, hay phiên proxy nào nhắm vào thứ gì đó bạn không tự sở hữu. Khi còn nghi ngờ, đừng chạy công cụ.
- Xác định scope chính xác. Liệt kê rõ dải IP, domain, và ứng dụng nằm trong phạm vi, và quan trọng không kém, cái gì không nằm trong phạm vi (hạ tầng dùng chung, SaaS bên thứ ba, tenant khác, database production).
- Thống nhất rules of engagement (RoE) từ trước — khung giờ kiểm thử được phép, các hành động bị cấm (ví dụ: không denial-of-service, không kiểm thử phá hoại, không kiểm thử ngoài khung giờ đã thống nhất), liên hệ khẩn cấp khi có sự cố, và cách/thời điểm kết quả được báo cáo và tiết lộ.
- Ưu tiên nhắm vào staging/pre-production cho bất kỳ hoạt động mang tính xâm nhập nào (vulnerability scan sâu, Nmap timing mạnh tay, fuzzing kiểu Burp Intruder). Nếu bắt buộc phải kiểm thử trên production, giảm cường độ scan, lên lịch vào khung giờ ít traffic, và chuẩn bị sẵn cơ chế rollback/giám sát.
- Dùng authenticated scan khi bạn kiểm soát được credential — chúng tìm ra nhiều vấn đề thực sự hơn hẳn với ít false positive hơn nhiều so với unauthenticated scan, và an toàn hơn (ít khả năng kích hoạt IDS/IPS hoặc làm mất ổn định một service dễ vỡ) vì không cần dò xét mạng theo cách xâm nhập để suy luận trạng thái.
- Đối chiếu kết quả DAST/vulnerability scanner với kết quả SAST/SCA từ pipeline (xem Secure Coding and Web Application Security và CI/CD and Supply Chain Security) — sự đồng thuận giữa các loại công cụ là tín hiệu ưu tiên mạnh, và DAST giỏi trong việc xác nhận một vấn đề được phát hiện tĩnh có thực sự reachable/khai thác được hay không.
- Tự động hóa những gì lặp lại được, review những gì không. Vulnerability scan theo lịch và scan baseline ZAP tích hợp trong pipeline nên chạy tự động; kiểm thử proxy thủ công (Burp) cho lỗi logic nghiệp vụ và authorization vẫn cần con người.
- Coi kết quả scan là dữ liệu nhạy cảm. Packet capture, lịch sử proxy, và báo cáo lỗ hổng có thể chứa credential, PII, hay thẳng thừng là một bản đồ các điểm yếu có thể khai thác — lưu trữ chúng với access-control và mã hóa, và xóa khi không còn cần thiết.
- Giữ công cụ và feed lỗ hổng luôn mới. Một feed plugin Nessus/OpenVAS lỗi thời hay một bộ NSE script Nmap cũ sẽ bỏ sót các CVE mới công bố; hãy coi việc cập nhật công cụ/feed là bảo trì định kỳ, không phải chuyện làm sau.
- Báo cáo kết quả kèm bằng chứng có thể tái hiện (cặp request/response, câu lệnh Nmap chính xác và output, packet capture liên quan) và mức độ nghiêm trọng (ví dụ CVSS), để người chịu trách nhiệm khắc phục có thể xác minh và sửa mà không phải tự khám phá lại vấn đề.
Tài liệu tham khảo
- Nmap Official Documentation
- Nmap Scripting Engine (NSE) documentation
- Wireshark User’s Guide
- Wireshark Display Filter Reference
- Burp Suite Documentation — PortSwigger
- OWASP ZAP Documentation
- OWASP Web Security Testing Guide (WSTG)
- Tenable Nessus Documentation
- Greenbone / OpenVAS Documentation
- NIST SP 800-115: Technical Guide to Information Security Testing and Assessment
Part of the DevSecOps Roadmap knowledge base.
Overview
Security testing tools let a team verify that the defenses they think they built actually work — instead of assuming a firewall rule, an input validator, or a patch level is correct, you probe the system the way an attacker would and observe the real result. In a DevSecOps context, these tools serve three purposes:
- Finding misconfigurations and vulnerabilities before attackers do — an open port that should be closed, a web form that doesn’t sanitize input, a host missing a critical patch, a service still using a default credential.
- Verifying that controls work as designed — confirming that TLS is actually enforced, that a WAF rule actually blocks a malicious payload, that a firewall segment really is unreachable from the internet.
- Providing continuous, repeatable feedback — the same way unit tests catch regressions in code, periodic and pipeline-integrated security scans catch regressions in security posture as infrastructure and code evolve.
Everything in this note assumes explicit authorization. Scanning, capturing traffic, intercepting requests, or probing for vulnerabilities on any system, network, or application you do not own — or do not have clear, written permission to test — is illegal in most jurisdictions (e.g., under the U.S. Computer Fraud and Abuse Act, the UK Computer Misuse Act, and equivalent laws elsewhere) and is a firing offense in virtually every organization, even when the intent is benign. Every example in this note is meant to be run against your own lab, a sanctioned staging environment, or a system with a signed authorization/rules of engagement covering the activity. See Best Practices for how that authorization should be scoped in practice.
This note focuses on dynamic testing tools — tools that interact with a running system (network, host, or application) the way a real user or attacker would, which is the essence of DAST (Dynamic Application Security Testing) and network/infrastructure security testing. This complements, but does not replace, static analysis of source code and dependencies, covered in Secure Coding and Web Application Security (SAST, code review) and CI/CD and Supply Chain Security (SCA, pipeline gates). Container and Kubernetes-specific scanning tools (image scanners, admission controllers) are covered in depth in Container and Kubernetes Security; this note only introduces them briefly for context.
Fundamentals
Categories of security testing tools
Security testing tools roughly fall into a handful of categories, each answering a different question:
| Category | Question it answers | Representative tools |
|---|---|---|
| Reconnaissance / network scanning | What hosts and services exist, and how are they exposed? | Nmap, Masscan |
| Packet/traffic analysis | What is actually happening on the wire — is data encrypted, is a protocol behaving correctly? | Wireshark, tcpdump |
| Web application testing (proxy/DAST) | Does the web application handle untrusted input safely at runtime? | Burp Suite, OWASP ZAP |
| Vulnerability scanning | Which known CVEs or misconfigurations exist on these hosts/services? | Nessus, OpenVAS, Qualys |
| Image/container scanning | Does this container image or IaC manifest contain known vulnerabilities or insecure configuration? | Trivy, Grype, Clair (see Container and Kubernetes Security) |
These categories are complementary, not competing — a real assessment typically chains several of them together (see Key Concepts → How these tools fit together).
Authorization is a prerequisite, not an afterthought
Before touching any of these tools against anything other than a personal lab, three things should exist:
- Written authorization from the system/data owner, naming who is testing, what is in scope, and for how long.
- A defined scope — specific IP ranges, hostnames, URLs, or accounts that may be tested, and an explicit statement of what is out of scope (e.g., third-party services, production databases, other tenants in a shared environment).
- Rules of engagement (RoE) — allowed testing windows, prohibited techniques (e.g., no denial-of-service testing, no social engineering unless explicitly included), escalation contacts if something goes wrong, and how findings will be reported and disclosed.
This is expanded further in Best Practices.
Key Concepts
Nmap — network discovery and port scanning
Nmap (“Network Mapper”) is the standard open-source tool for host discovery, port scanning, and service/version fingerprinting. It answers: what is alive on this network, what ports are open, and what is listening on them?
Core capabilities:
- Host discovery — determine which IP addresses in a range are up, without necessarily port-scanning them.
- Port scanning — determine which TCP/UDP ports are open, closed, or filtered.
- Service and version detection — identify what software (and version) is behind an open port.
- OS detection — fingerprint the likely operating system from TCP/IP stack behavior.
- NSE (Nmap Scripting Engine) — a library of scripts for extended checks (banner grabbing, default credential checks, basic vulnerability detection).
Example commands (run only against hosts/networks you are authorized to scan):
# Host discovery only — no port scan, just find live hosts on a subnet
nmap -sn 192.168.1.0/24
# Basic TCP connect scan of the most common 1000 ports
nmap 192.168.1.10
# SYN ("half-open") scan of a specific port range — requires elevated privileges
sudo nmap -sS -p 1-1000 192.168.1.10
# Service/version detection plus default (safe) NSE scripts
nmap -sV -sC 192.168.1.10
# Scan every port (all 65535)
nmap -p- 192.168.1.10
# Run NSE's "vuln" script category to flag known vulnerability signatures
nmap --script vuln 192.168.1.10
A few practical notes:
-sS(SYN scan) is faster and stealthier than a full TCP connect scan but requires root/administrator privileges because it crafts raw packets.-sV -sCis the most commonly used “tell me what’s here” combination for a quick, informative scan.--script vulnruns a broad set of NSE checks and can be noisy (false positives) and intrusive — treat it as a lead to verify, not a confirmed finding.- Aggressive scans (
-A, full port ranges, high timing templates like-T4/-T5) generate significant traffic and can trip IDS/IPS alerts or, on fragile devices (older network appliances, OT/ICS equipment), cause instability — this is exactly why scope and RoE matter (see Best Practices).
Wireshark — packet capture and analysis
Wireshark is the standard GUI tool for capturing and inspecting network traffic packet-by-packet. Where Nmap tells you what is listening, Wireshark tells you what is actually being said on the wire.
Two different kinds of filters matter:
- Capture filters — applied before packets are recorded, to limit what’s captured (uses BPF syntax, e.g.,
tcp port 443). - Display filters — applied after capture, to narrow down what you view among already-captured packets (Wireshark’s own richer filter language, e.g.,
tcp.port == 443).
Common display filters:
| Filter | Purpose |
|---|---|
ip.addr == 192.168.1.10 | Show only traffic to/from a specific host |
tcp.port == 443 | Show only traffic on a specific port |
http | Show only HTTP requests/responses |
http.request.method == "POST" | Show only HTTP POST requests (often carrying form/login data) |
tcp.flags.syn == 1 && tcp.flags.ack == 0 | Show only the initial SYN packets of TCP handshakes |
tls.handshake.type == 1 | Show TLS Client Hello packets (start of a TLS handshake) |
ftp or telnet | Show FTP/Telnet traffic — useful for illustrating cleartext protocols |
Reading a TCP three-way handshake: filter on tcp.port == 443 (or whatever port) at the start of a connection and look for the sequence:
- Client → Server:
SYN(client requests a connection, proposes an initial sequence number) - Server → Client:
SYN, ACK(server acknowledges and proposes its own sequence number) - Client → Server:
ACK(client acknowledges; connection is now established)
Wireshark labels these in the Info column as [SYN], [SYN, ACK], [ACK], making the three steps easy to pick out visually.
Spotting plaintext credentials (and why TLS matters): on an unencrypted protocol — HTTP (not HTTPS), FTP, Telnet, or an internal service that mistakenly skips TLS — credentials are visible in cleartext to anyone who can observe the traffic (a shared Wi-Fi network, a compromised switch, a misconfigured span port). For example, capturing an FTP login and filtering on ftp.request.command == "PASS" reveals the literal password in the packet detail pane; capturing an HTTP form submission (http.request.method == "POST") and using Follow → HTTP Stream reveals form field values, including login credentials, in plain text. This is precisely the risk TLS (HTTPS) eliminates: once traffic is encrypted, Wireshark shows only opaque ciphertext (visible in tls filtered frames) unless you hold the private key or a decryption secret, which is why enforcing TLS everywhere — including internal service-to-service traffic — is a baseline control, not an optional one. Demonstrating this on a lab VM with a Telnet or FTP server is a common, safe way to make the “TLS matters” case concrete to a team.
Burp Suite — intercepting proxy for web application testing
Burp Suite (by PortSwigger) is the industry-standard tool for manual and semi-automated web application security testing. Conceptually, it sits as a proxy between your browser and the target application, so every request and response passes through it and can be inspected, modified, and replayed — under authorization, against an application you’re permitted to test.
Core components (at a conceptual level — this note does not walk through exploit techniques):
- Proxy — intercepts HTTP(S) traffic between browser and application, letting a tester see and hold requests before they reach the server, and see raw responses before they reach the browser.
- Target / Site map — builds a map of the application’s structure (pages, parameters, endpoints) as you browse it, which is useful for understanding attack surface and coverage before testing.
- Repeater — lets a tester resend a single captured request with modified values, to observe how the application’s response changes — this is how input handling (e.g., does the app validate/sanitize a parameter, does it reveal different behavior for different inputs) is explored methodically and repeatably.
- Intruder (paid tiers) — automates sending many variations of a request (e.g., a wordlist) to a parameter, useful for authorized fuzzing/brute-force testing within scope.
- Scanner (Burp Suite Professional) — an automated DAST engine that crawls and probes an application for common vulnerability classes (e.g., OWASP Top 10 categories) and reports findings with evidence.
The free, open-source alternative with a similar proxy/scanning model is OWASP ZAP, which additionally has strong CI/CD automation support (a headless “baseline” and “full” scan mode designed to run inside pipelines).
The practical value of a proxy-based tool like Burp/ZAP in DevSecOps is that it tests the application the way a real client does — after client-side JavaScript has run, after routing/API gateway logic has applied, with real session state — which static source analysis alone cannot fully replicate. It is the natural DAST counterpart to the SAST and dependency scanning covered in Secure Coding and Web Application Security.
Vulnerability scanners: Nessus, OpenVAS, Qualys
Vulnerability scanners automate the process of checking hosts, network services, and (in some products) web applications against a large, continuously updated database of known vulnerabilities (CVEs) and misconfiguration patterns. Instead of manually testing for every known issue, a scanner runs thousands of checks and reports which ones matched.
| Scanner | Vendor / license | Notes |
|---|---|---|
| Nessus | Tenable — commercial (free “Essentials” tier for small scope) | Widely used; large, frequently updated plugin (check) feed; strong compliance/benchmark scanning |
| OpenVAS / Greenbone Vulnerability Management | Greenbone — open source core | Community-driven feed, free to self-host, good baseline for labs and smaller organizations |
| Qualys | Qualys — commercial, cloud/SaaS | Strong at enterprise/large-fleet scale, continuous asset inventory, PCI-DSS Approved Scanning Vendor (ASV) service |
Key concepts common to these tools:
- CVE-based scanning — each check is typically tied to one or more CVE identifiers or a specific misconfiguration signature, so results map directly to a known, trackable vulnerability with a published severity (often CVSS score).
- Unauthenticated scans — the scanner probes the target purely from the network, the same vantage point as an external attacker with no credentials. Fast and low-friction, but limited: it can miss vulnerabilities that only show up once logged in (e.g., outdated software visible only from an internal admin panel, missing OS patches that don’t have a network-visible signature).
- Authenticated (credentialed) scans — the scanner is given valid credentials (SSH, WinRM/SMB, or application login) and can inspect the host or application from the inside — installed package versions, registry settings, local configuration files — yielding far more accurate and complete results with fewer false positives. Authenticated scanning is generally the recommended default for internal assets; unauthenticated scanning is closer to what an external attacker sees and is useful for validating perimeter exposure.
- Compliance/configuration scanning — beyond CVEs, these tools can check hosts against a hardening benchmark (e.g., CIS Benchmarks, DISA STIGs) or a regulatory standard (PCI-DSS), reporting configuration drift from an approved baseline — this overlaps with the compliance automation covered in Compliance, Governance and Risk Management.
How vulnerability scanners fit into a DevSecOps pipeline:
- Scheduled (e.g., weekly/monthly) authenticated scans of production and staging fleets, feeding results into a ticketing system with SLA-based remediation timelines by severity.
- Scans triggered against a freshly provisioned staging environment as part of a release pipeline, gating promotion to production on the absence of critical/high findings (or an approved exception).
- Continuous asset inventory so newly provisioned infrastructure (an easy blind spot in dynamic, autoscaled cloud environments) is automatically picked up for scanning rather than relying on a manually maintained target list.
- API-driven integration: most of these scanners expose an API so scan triggering, status polling, and result export can be automated rather than operated purely through a UI.
Image and container scanning (brief pointer)
Scanning container images (and the IaC manifests that deploy them) for known-vulnerable base image layers, packages, and insecure configuration (e.g., running as root, exposed secrets baked into a layer) is a related but distinct discipline, typically performed with tools like Trivy, Grype, or Clair, often as a pipeline gate before an image is allowed to be pushed to a registry or deployed. This is covered in depth, including Kubernetes-specific admission control and runtime scanning, in Container and Kubernetes Security.
How these tools fit into the SDLC
A useful mental model is where in the lifecycle each testing approach operates:
| Approach | What it tests | When it runs | Covered in |
|---|---|---|---|
| SAST (static analysis) | Source code, without executing it | At commit / pull request time | Secure Coding and Web Application Security |
| SCA (software composition analysis) | Third-party dependencies for known CVEs and license issues | At build time / commit time | CI/CD and Supply Chain Security |
| Image/IaC scanning | Container images and infrastructure-as-code manifests | At build time, before push/deploy | Container and Kubernetes Security |
| DAST (this note: Burp/ZAP, vuln scanners, Nmap/Wireshark-assisted testing) | A running application, host, or network | Against staging (or production, with strict controls) after deployment | This note |
DAST and SAST are complementary rather than substitutes: SAST can find a vulnerable code pattern that never gets exercised at runtime in current tests, while DAST can find a vulnerability that only manifests through the interaction of multiple components (routing, authentication middleware, a reverse proxy) that static analysis of one file can’t see. A mature DevSecOps pipeline runs both, correlates their findings, and treats agreement between the two as a strong signal for prioritization.
Comparison table
| Tool | Category | Typical use case |
|---|---|---|
| Nmap | Reconnaissance / network scanning | Host discovery, open port enumeration, service/version fingerprinting |
| Wireshark | Packet/traffic analysis | Deep packet inspection, protocol troubleshooting, verifying encryption is actually in use |
| Burp Suite | Web application (proxy / DAST) | Manual and semi-automated testing of web app input handling, authorization, session management |
| OWASP ZAP | Web application (proxy / DAST) | Open-source alternative to Burp with strong CI/CD pipeline automation |
| Nessus | Vulnerability scanner | CVE-based host/network scanning, compliance benchmark auditing |
| OpenVAS / Greenbone | Vulnerability scanner | Open-source CVE scanning, self-hosted labs and smaller environments |
| Qualys | Vulnerability scanner (cloud/SaaS) | Enterprise-scale continuous asset scanning, PCI-DSS ASV scans |
| Trivy / Grype / Clair | Image/container scanning | CVE and misconfiguration scanning of container images and IaC before deploy |
Best Practices
- Never test without explicit, written authorization. Have a signed scope document (or a pentest/bug-bounty program’s published scope) before running any scan, capture, or proxy session against anything you don’t personally own. When in doubt, don’t run the tool.
- Define scope precisely. List exact IP ranges, domains, and applications in scope, and just as importantly, what is explicitly out of scope (shared infrastructure, third-party SaaS, other tenants, production databases).
- Agree on rules of engagement (RoE) up front — permitted testing windows, prohibited actions (e.g., no denial-of-service, no destructive tests, no testing outside agreed hours), an emergency contact if something breaks, and how/when findings get reported and disclosed.
- Prefer staging/pre-production targets for anything intrusive (deep vulnerability scans, aggressive Nmap timing, Burp Intruder-style fuzzing). If production must be tested, throttle scan intensity, schedule during low-traffic windows, and have rollback/monitoring in place.
- Use authenticated scans where you control credentials — they find far more real issues with far fewer false positives than unauthenticated scans, and are safer (less likely to trip IDS/IPS or destabilize a fragile service) since they don’t rely on invasive network probing to infer state.
- Correlate DAST/vulnerability-scanner findings with SAST/SCA results from the pipeline (see Secure Coding and Web Application Security and CI/CD and Supply Chain Security) — agreement across tool types is a strong prioritization signal, and DAST is good at confirming whether a statically-flagged issue is actually reachable/exploitable.
- Automate what’s repeatable, review what isn’t. Scheduled vulnerability scans and pipeline-integrated ZAP baseline scans should run automatically; manual proxy-based testing (Burp) for business-logic and authorization flaws still needs a human.
- Treat scan output as sensitive data. Packet captures, proxy histories, and vulnerability reports can contain credentials, PII, or a literal roadmap of exploitable weaknesses — store them access-controlled and encrypted, and purge them once no longer needed.
- Keep tools and vulnerability feeds current. An out-of-date Nessus/OpenVAS plugin feed or an old Nmap NSE script set will miss recently disclosed CVEs; treat tool/feed updates as part of routine maintenance, not an afterthought.
- Report findings with reproducible evidence (the request/response pair, the exact Nmap command and output, the relevant packet capture) and a severity rating (e.g., CVSS), so remediation owners can verify and fix without having to re-discover the issue themselves.
References
- Nmap Official Documentation
- Nmap Scripting Engine (NSE) documentation
- Wireshark User’s Guide
- Wireshark Display Filter Reference
- Burp Suite Documentation — PortSwigger
- OWASP ZAP Documentation
- OWASP Web Security Testing Guide (WSTG)
- Tenable Nessus Documentation
- Greenbone / OpenVAS Documentation
- NIST SP 800-115: Technical Guide to Information Security Testing and Assessment