الأحد، 21 فبراير 2016

طريقة ترقيع ثغره تخطي السيف مود والدوال بواسطه htaccess +php.ini




السلام عليكم بخصوص سيرفرات لينكس التى تعمل بالـsuphp وكان يستطيع المخترق رفع ملف php.ini ويضع فيه اعدادت جديده فيقوم بتعطيل السيف مود + فتح جميع الدوال ويتمكن من ذلك بتشغيل اى شيل

وكان حل هذة المشكله هو اضافه هذا السطر
رمز PHP:
suPHP_ConfigPath /usr/local/lib/php.ini 

الي هذا الملف
رمز PHP:
pico /usr/local/apache/conf/php.conf 

ثم نبحث عن
رمز PHP:
[phprc_paths]
;
Uncommenting these will force all requests to that handler to use the php.ini ;in the specified directory regardless of suPHP_ConfigPath settings.
;
application/x-httpd-php=/usr/local/lib/
;
application/x-httpd-php4=/usr/local/php4/lib/
;
application/x-httpd-php5=/usr/local/lib
ونحذف علامه ; من اخر سطر بحيث يصبح بالشكل التالى
رمز PHP:
[phprc_paths]
;
Uncommenting these will force all requests to that handler to use the php.ini ;in the specified directory regardless of suPHP_ConfigPath settings.
;
application/x-httpd-php=/usr/local/lib/
;
application/x-httpd-php4=/usr/local/php4/lib/ application/x-httpd-php5=/usr/local/lib
وجدت شيء يمنع هذا التخطى حتى برفع .htaccess
وهو ننفذ الامر التالي
رمز PHP:
pico /opt/suphp/etc/suphp.conf 

ونبحث عن
رمز PHP:
[phprc_paths]
;
Uncommenting these will force all requests to that handler to use the php.ini ;in the specified directory regardless of suPHP_ConfigPath settings.
;
application/x-httpd-php=/usr/local/lib/
;
application/x-httpd-php4=/usr/local/php4/lib/
;
application/x-httpd-php5=/usr/local/lib
ونحذف علامه ; من السطر الاخير بحيث يصبح الشكل
رمز PHP:
[phprc_paths]
;
Uncommenting these will force all requests to that handler to use the php.ini ;in the specified directory regardless of suPHP_ConfigPath settings.
;
application/x-httpd-php=/usr/local/lib/
;
application/x-httpd-php4=/usr/local/php4/lib/ application/x-httpd-php5=/usr/local/lib
انتهي الدرس

G+