บทนำ (Overview)
ในเครือข่ายองค์กรขนาดใหญ่นั้น จะประกอบไปด้วยเจ้าหน้าที่หลายฝ่าย หลายแผนก บ้างก็ต้องการทำสำเนาโอนย้ายไฟล์ จำนวนมาก บางเปิดไว้เพื่อให้โปรแกรมบางชนิดเข้ามาอ่านไฟล์ แต่โดยมากแล้วเพื่อความสะดวกอาจเปิดใช้งาน “shared file” โดยไม่ได้จำกัดสิทธิ หรืออาจไม่ต้องมีบัญชีผู้ใช้ (User account) ก็เข้าถึงได้ เมื่อใช้งานเสร็จ อาจลืมหรือจงใจเปิดถึงไว้ เพื่อใช้ครั้งหน้าอาจส่งผลให้ผู้ไม่ประสงค์ดีเข้าถึงไฟล์สำคัญได้
โดยการค้นหาช่องโหว่ดังกล่าวจะทำการค้นหา โดยใช้ “Port 445” ซึ่งเป็นของโปรโตคอล “SMB” (Server Message Block) หรือ CIFS (Common Internet File System) เป็นโปรโตคอลที่พัฒนาโดย “Microsoft” “Intel” และ “IBM” ทำให้เครื่องคอมพิวเตอร์สามารถติดต่อสื่อสารเพื่อให้เกิดการแชร์ทรัพยากร เช่น File ต่าง ๆ หรือ Printer ได้ ซึ่งมีระบบปฏิบัติการหลายชนิดที่รองรับโปรโตคอลนี้ เช่น “Windows” “OS/2” “Linux” “MC” เป็นต้น
ขั้นตอน (Steps)
- เข้าใช้งานระบบปฎิบัติการ “Kali” หรือ “Backtrack” Linux
- ค้นหาตัวโปรแกรม “check_dir_file”
msf > search check_dir_file [!] Database not connected or cache not built, using slow search Matching Modules ================ Name Disclosure Date Rank Description ---- --------------- ---- ----------- auxiliary/admin/smb/check_dir_file normal SMB Scanner Check File/Directory Utility
- เรียกใช้ “Module” ของ “check_dir_file”
msf > use auxiliary/admin/smb/check_dir_file msf auxiliary(check_dir_file) >
- ทำการแสดง “options” เพื่อแสดงค่าพารามิเตอร์ที่ต้องตั้ง
msf auxiliary(check_dir_file) > show options Module options (auxiliary/admin/smb/check_dir_file): Name Current Setting Required Description ---- --------------- -------- ----------- RHOSTS yes The target address range or CIDR identifier RPATH yes The name of the remote file/directory relative to the share RPORT 445 yes Set the SMB service port SMBDomain WORKGROUP no The Windows domain to use for authentication SMBPass no The password for the specified username SMBSHARE C$ yes The name of an accessible share on the server SMBUser no The username to authenticate as THREADS 1 yes The number of concurrent threads
- จากนั้นทำการ set ค่าพารามิเตอร์สำหรับการค้นหาดังนี้
msf auxiliary(check_dir_file) > set RHOSTS 192.168.0.0/24 RHOSTS => 192.168.0.0 msf auxiliary(check_dir_file) > set RPATH \ RPATH => \ msf auxiliary(check_dir_file) > set SMBDomain "" SMBDomain => msf auxiliary(check_dir_file) > set SMBSHARE SharedDocs SMBSHARE => SharedDocs msf auxiliary(check_dir_file) > show options Module options (auxiliary/admin/smb/check_dir_file): Name Current Setting Required Description ---- --------------- -------- ----------- RHOSTS 192.168.0.0/24 yes The target address range or CIDR identifier RPATH \ yes The name of the remote file/directory relative to the share RPORT 445 yes Set the SMB service port SMBDomain no The Windows domain to use for authentication SMBPass no The password for the specified username SMBSHARE SharedDocs yes The name of an accessible share on the server SMBUser no The username to authenticate as THREADS 1 yes The number of concurrent threads
- จากพารามิเตอร์ข้างต้นสามารถอธิบายได้ดังนี้
- RHOSTS สำหรับการตั้งค่า IP เครื่องเป้าหมายสามารถ set เป็นช่วงของ IP ได้ จาก ตัวอย่าง /24 หมายถึง IP ตั้งแต่ 192.168.0.1 – 192.168.0.255
- RPATH ถ้าเราทราบชื่อ File หรือ Directory ที่ shared สามารถตั้งได้
- RPORT ปกติหมาย Port ของ SMB คือ 445
- SMBDomain สำหรับเครือข่ายที่ต้องช้ “Domain” เพื่อการ “Authentication” สำหรับการทดสอบอย่างเป็นคนไม่มีสิทธิเลยสามารถ Set ให้ว่างได้ โดยใช้คำสั่ง
msf auxiliary(check_dir_file) > set SMBDomain "" SMBDomain =>
- SMBPass รหัสผ่านของ “Account” ที่ใช้ในการ “Authentication” ซึ่งใช้ในการทดสอบเครือข่ายภายใน
- SMBSHARE สำหรับการตั้งชื่อ “shared folder” ที่จะเข้าถึง สำหรับตัวอย่างเป็น “shared folder” ของ WindowsXP ซึ่งเราอาจใช้เป็น “C$” “ADMIN$” หรือ “D$” ก็ได้
- SMBUser ของ “Account” ที่ใช่ในการ “Authentication” ซึ่งใช้ในการทดสอบเครือข่ายภายใน
- จากนั้นเรียกใช้คำสั่ง “run” และรอจนกว่าจะ “scan” ครบทุก IP
msf auxiliary(check_dir_file) > run
- ผลจากการทดสอบสามารถตรวจสอบได้ดังภาพ
สรุปผลการทดสอบ (Conclusions)
จากการทดสอบจะเห็นได้ว่าแม้จะมีจำนวนเครื่องมากแค่ไหน ถ้าเครื่องของผู้ไม่ประสงค์ดีสามารถเข้าถึงเครือข่ายภายในได้ และ มีเจ้าหน้าที่หรือผู้บริหารท่านได้ไม่ตระหนักถึงการใช้ “shared file” เช่นเป็นให้ “everyone” สามารถเข้าถึงได้ หรือร้ายกว่านั้นคอมพิวเตอร์ส่วนตัวที่ไม่มีแม้กระทั้งบัญชีผู้ใช้เข้าใช้งานระบบปฎิบัติการ อ่านส่งผลให้ข้อมูลความลับ เช่น ข้อมูลลูกค้า ข้อมูลการเงิน ข้อมูลพนักงาน หรือข้อมูลทางเครือข่ายหลุดรั่วออกไปได้