คลัง
recon

Censys

Censys เป็น search engine สำหรับ host และ certificate ที่ต่ออินเทอร์เน็ต คล้าย Shodan แต่เด่นเรื่อง certificate search (เผย subdomain/related infra) และข้อมูลเชิงลึก บทนี้ลงลึก host vs certificate search, query syntax, การหา IP จริงหลัง CDN ผ่าน cert, CLI, และเทียบกับ Shodan (เนื้อหาเพื่อ recon ที่ได้รับอนุญาต)

Intermediate#censys#recon#osint#certificates#exposed-services#passive#ctf

1. Censys คืออะไร (vs Shodan)

Censys สแกนอินเทอร์เน็ตเก็บข้อมูล host และ certificate คล้าย Shodan แต่จุดเด่นคือ certificate search ที่ทรงพลัง — ค้น SSL/TLS certificate ทั้งหมดที่เกี่ยวกับ domain เผย subdomain และ related infrastructure ได้ดี และมีข้อมูล host เชิงลึก (service, software, cert) เป็น passive recon ที่ควรใช้คู่กับ Shodan เพราะฐานข้อมูล/มุมมองต่างกัน

เนื้อหานี้เพื่อการ reconnaissance ในงานที่ได้รับอนุญาต (CTF, OSINT, pentest scope) เท่านั้น

2. Host search vs Certificate search

โหมดค้นอะไรใช้เมื่อ
HostsIP + service/port/softwareหา exposed service (เหมือน Shodan)
CertificatesSSL/TLS cert ทั้งหมดหา subdomain/related domain จาก cert

Certificate search คือจุดแข็ง — cert มักครอบหลาย subdomain (SAN) และเผย domain ที่เกี่ยวข้อง ค้น cert ที่มีชื่อ target → ได้ subdomain/related infra ที่วิธีอื่นไม่เจอ

3. Query syntax

Censys search queries (search.censys.io)
# === Hosts search ===
services.service_name: HTTP and location.country: TH
services.port: 3389                      # RDP exposed
ip: 8.8.8.0/24                           # IP range
autonomous_system.asn: 15169             # ตาม ASN
services.software.product: nginx
same_service(services.port: 443 and services.tls.certificates.leaf_data.subject.common_name: "example.com")

# === Certificates search (จุดเด่น) ===
names: example.com                       # cert ที่มีชื่อนี้
names: *.example.com                     # subdomain จาก cert
parsed.subject.organization: "Example Inc"
parsed.names: example.com and parsed.validity.end > 2024-01-01

# หา subdomain จาก cert แล้วดึงชื่อ → เป็น subdomain list
Hosts: services.port/software, autonomous_system.asn; Certificates: names: *.domain เผย subdomain (จุดเด่น)

4. CLI + การใช้

censys CLILinux
pip install censys
censys config                            # ใส่ API ID + secret

# ค้น host
censys search "services.port: 3389 and autonomous_system.asn: 15169"

# ดูข้อมูล IP
censys view 8.8.8.8

# ค้น certificate → ดึง subdomain
censys search "names: example.com" --index-type certs

# เชื่อมกับ subdomain enum:
# ดึงชื่อจาก cert → เพิ่มเข้า subdomain list → resolve (ดู Subdomain Enumeration)
censys search/view; --index-type certs สำหรับ certificate; ผล cert → subdomain list ไปต่อ resolve

5. การใช้ + Quick Reference

  • หา subdomain ผ่าน cert: names: *.example.com เผย subdomain ที่ออก cert (คู่กับ crt.sh)
  • IP จริงหลัง CDN: ค้น cert ที่มีชื่อ domain → IP ที่ใช้ cert นั้น (อาจเป็น origin จริง)
  • related infra: cert ของ org เดียวกัน → domain/host ที่เกี่ยวข้อง
  • exposed service: services.port/software ตาม org/ASN (เหมือน Shodan)
  • ใช้คู่ Shodan: ฐานข้อมูลต่างกัน — ตัวหนึ่งอาจเห็น host ที่อีกตัวไม่เห็น
  • search engine host + certificate (เด่น cert search)
  • Hosts: services.port/software, autonomous_system.asn
  • Certificates: names: *.domain (เผย subdomain — จุดเด่น)
  • CLI: censys search; censys view IP; --index-type certs
  • หา IP จริงหลัง CDN + related infra ผ่าน cert
  • ใช้คู่ Shodan (ฐานข้อมูลต่างกัน)

🧭 จับมือทำทีละขั้น (มีแค่ Kali) + ถ้าติดไปไหนต่อ

สมมติอยากหา IP จริงหลัง CDN หรือ subdomain ที่ tool อื่นไม่เจอ มีแค่ Kali + เบราว์เซอร์ ทำตามนี้ทีละขั้น

  1. 1เปิดเบราว์เซอร์ไป search.censys.io แล้วสมัคร account ฟรี (ต้องมี account ถึงจะค้นได้เต็มที่)
  2. 2ลอง Certificate search ก่อน: พิมพ์ names: target.com ดูว่ามี cert อะไรบ้าง
  3. 3ขยายหา subdomain จาก cert: names: *.target.com แล้วจดชื่อทั้งหมดที่ขึ้น
  4. 4สลับไป Hosts search ดู service ที่เปิด: services.tls.certificates.leaf_data.subject.common_name: target.com
  5. 5ถ้ารู้ ASN ขององค์กรแล้ว (จาก ASN Enumeration) ลอง: autonomous_system.asn: 15169
  6. 6ถ้าอยากใช้ผ่าน terminal ติดตั้ง CLI: pip install censys && censys config (ใส่ API ID/secret จากหน้า account)
  7. 7ค้นผ่าน CLI: censys search "names: target.com" --index-type certs
  8. 8ดึงชื่อจาก cert ที่ได้ → เอาไปรวมกับ subdomain list อื่น แล้ว resolve ด้วย dnsx
  9. 9ถ้าต้องการหา IP จริงหลัง Cloudflare ลองหา cert ที่มีชื่อ target แล้วดูว่า IP ไหนใช้ cert เดียวกัน
  10. 10ถ้า Censys ไม่มี rate/quota พอ หรือหาไม่เจอ สลับไปลอง Shodan ดูมุมต่าง (ฐานข้อมูลคนละชุด)
Censys เจอของไหม? ทำอะไรต่อ
Certificate search: names: *.target.com
เจอ subdomain/related domain จาก cert ไหม?
✅ เจอชื่อใหม่→ resolve/verify ต่อ
❌ ไม่เจอ/quota หมด→ ลอง Hosts search หรือสลับ tool
Hosts search: org/ASN/port filter
หา exposed service แทนการหา cert
✅ เจอ service ที่น่าสนใจ→ scan/enum service นั้นต่อ
❌ ยังไม่เจอ→ สลับไป Shodan (ฐานข้อมูลต่างกัน)
ขั้นตอน/งานเครื่องมือใน Kaliติดตั้งเพิ่ม (ถ้าไม่มี)เครื่องมือออนไลน์
ค้น host/certificate--search.censys.io
ค้นผ่าน CLIpython3/pippip install censys-
resolve subdomain ที่ได้dnsxgo install .../dnsx@latestdnsdumpster.com
เทียบ cert อีกมุม--crt.sh
เทียบฐานข้อมูล exposed service--shodan.io
สแกน service ที่เจอnmap--
🚑 ถ้าตันสนิท ลองท่าถัดไป: Shodan (ฐานข้อมูลคนละชุด — host ที่ Censys ไม่เห็นอาจอยู่ใน Shodan), DNS Enumeration (crt.sh ให้ผลคล้าย certificate search ของ Censys แบบฟรีไม่ต้องสมัคร), ASN Enumeration (ถ้ารู้ ASN ก่อน จะกรอง Hosts search ได้แม่นขึ้น), Subdomain Enumeration (พอได้ชื่อจาก cert แล้ว ไป resolve/probe รวมกับ workflow หลัก)

โน้ตของฉัน

ยังไม่มีโน้ตสำหรับหัวข้อนี้