CVE-2012-1823 [PHP CGI]

CVE-2012-1823 [PHP CGI]
CVE-2012-1823 เป็นช่องโหว่ที่พบโดย Eindbazen ขณะที่เค้ากำลังเล่น Capture the flag (CTF) โดยช่องโหว่นี้ถือว่าเป็นช่องโหว่ที่รุนแรง เพราะกระทบกับ server จำนวนมาก โดยมันเกิดจาก PHP CGI module นั้นคอยรับ input จาก URI โดยไม่มีการ filter ใดๆ ทำให้ผู้โจมตีสามารถส่ง option ในการรันคำสั่ง php-cgi command ได้ผ่าน URI
โดย php-cgi มี option ดังต่อไปนี้
noob@victim:~$ php-cgi -h
Usage: php [-q] [-h] [-s] [-v] [-i] [-f ]
      php [args...]
 -a               Run interactively
 -b | Bind Path for external FASTCGI Server mode
 -C               Do not chdir to the script's directory
 -c | Look for php.ini file in this directory
 -n               No php.ini file will be used
 -d foo[=bar]     Define INI entry foo with value 'bar'
 -e               Generate extended information for debugger/profiler
 -f        Parse .  Implies `-q'
 -h               This help
 -i               PHP information
 -l               Syntax check only (lint)
 -m               Show compiled in modules
 -q               Quiet-mode.  Suppress HTTP Header output.
 -s               Display colour syntax highlighted source.
 -v               Version number
 -w               Display source with stripped comments and whitespace.
 -z        Load Zend extension .
 -T       Measure execution time of script repeated times.
จะเห็นว่ามี option ที่น่าสนใจมากกว่า ซึ่ง option ที่มักถูกนำมาตรวจสอบว่าเว็บไซด์ปลายทางว่ามีช่องโหว่หรือไม่นั่นคือ -s option ซึ่งหากเว็บไซด์เป้าหมายดังกล่าวมีช่องโหว่ เราจะสามารถ view source code จริงๆของเพจนั้นๆที่ request ได้ ยกตัวอย่างเช่น การเรียกใช้ปกติจะได้ออกมาเป็น
course-5-201905145458hNj7mSvOWnIH.png
จะเห็นว่าเป็นการทำงานปกติของ PHP แต่เมื่อเรา request ต่อท้าย URL เป็น -s จะได้ผลลัพธ์เป็นการแสดง source code ของเพจนั้นๆ
course-5-201905145458RaFRTBhiqLpa.png

Comments

Popular Posts