PHPÖ´ÐÐrootÃüÁî
ÔÚÍæC ÒÔÇ° Íæ¹ýÒ»¶Îʱ¼äµÄPHP, ÄĸöʱºòÐèÒªÓÃPHP À´ÔËÐÐrootÃüÁî,һֱδ¹û,Ö±µ½ÓÐÒ»ÌìËÑË÷µ½ÁËsuperÕâ¸ö²å¼þ.
Ëæ×ÅÍæCµÄÈÕ×Ó¶àÁË.·¢ÏÖ¿ÉÒÔÓÃCÓïÑÔÀ´°ü¹ü ÒªÔËÐеÄÍⲿÃüÁî. ʵÑéÁËÒ»ÏÂ.³É¹¦ÁË.
²»ÐèÒªÈκÎÍⲿ¹¤¾ß¾Í¿ÉÒÔʵÏÖÓÃPHP Ö´ÐÐrootÃüÁî.
ÎÒÏÂÃæ¾Í°Ñ·½·¨·¢²¼¸ø´ó¼Ò,ÓÐÐèÇóÓÃphpÀ´ÔËÐÐrootÃüÁîµÄÅóÓÑ¿ÉÒÔ²»Ó÷¢³îÁË.
ƽ̨:Linux. ʵÑéÃüÁîiptables µ±Ç°µÄĿ¼ÊÇ/var/www/html/http
д³ÌÐòµÄʱºò ÓÃrootÓû§
´ó¼Ò¶¼ÖªµÀiptables ·ÇrootÓû§²»ÄÜÔËÐÐ.
Ê×ÏÈд¸öC³ÌÐò
ÃüÃûΪ:ipt.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
uid_t uid ,euid;
char cmd[1024];
uid = getuid() ;
euid = geteuid();
printf("my uid :%u\n",getuid()); //ÕâÀïÏÔʾµÄÊǵ±Ç°µÄuid ¿ÉÒÔ×¢Ê͵ô.
printf("my euid :%u\n",geteuid()); //ÕâÀïÏÔʾµÄÊǵ±Ç°µÄeuid
if(setreuid(euid, uid)) //½»»»
ÕâÁ½¸öid
perror("setreuid");
printf("after setreuid uid :%u\n",getuid());
printf("afer sertreuid euid :%u\n",geteuid());
system("/sbin/iptables -L"); //Ö´ÐÐiptables -LÃüÁî
return 0;
}
[/CODE]
±àÒë¸ÃÎļþ gcc -o ipt -Wall ipt.c
Ôڸ÷¾¶ÏÂÉú³Éipt Õâ¸ö¿ÉÖ´ÐÐÎļþ.
Èç¹ûÏÖÔÚÓÃPHPÍøÒ³µ÷Óà ¸ÃiptµÄ»°,¼´Ê¹setreuidÁË Ò²ÊDz»ÐеÄ.
½ÓÏÂÀ´Òª×öµÄÊÇchmod u+s ./ipt
ls Ò»ÏÂ
-rwsr-xr-x 1 root root 5382&nb
Ïà¹ØÎĵµ£º
¶à̬Õâ¸ö¸ÅÄÔÚJavaÖÐÖ¸µÄÊDZäÁ¿¿ÉÒÔÖ¸ÏòµÄ¶ÔÏóµÄÀàÐÍ£¬¿ÉÊDZäÁ¿ÉùÃ÷ÀàÐ͵Ä×ÓÀà¡£¶ÔÏóÒ»µ©´´½¨£¬ËüµÄÀàÐÍÊDz»±äµÄ£¬¶à̬µÄÊDZäÁ¿¡£ÔÚPHP5ÖУ¬±äÁ¿µÄÀàÐÍÊDz»È·¶¨µÄ£¬Ò»¸ö±äÁ¿¿ÉÒÔÖ¸ÏòÈκÎÀàÐ͵ÄÊýÖµ¡¢×Ö·û´®¡¢¶ÔÏó¡¢×ÊÔ´µÈ¡£ÎÒÃÇÎÞ·¨ËµPHP5Öжà̬µÄÊDZäÁ¿¡£
ÎÒÃÇÖ»ÄÜ˵ÔÚPHP5ÖУ¬¶à̬ӦÓÃÔÚ·½·¨²ÎÊýµÄÀàÐÍÌáʾλÖá£
Ò» ......
»·¾³Èí¼þ°æ±¾½éÉÜ£º
APACHE 2.0.59
PHP5.2.3
MYSQL5.0.45
GD-2.0.35
Zend Optimizer v3.3.0
&n ......
ͨ³£ÈËÃÇд³ÌÐòʱ¶¼Êǽ«ÎÄ×ÖдËÀÔÚ³ÌÐòÀïµÄ£¬±ÈÈ磺echo "Hello
World!";
£¬¼ÙÈçÒª¸Ä³ÉËü¹úÓïÑÔ£¬Ð´¹ú¼Ê»¯³ÌÐò£¬¾ÍÒªÖð¸ö´ò¿ª½øÐÐÐ޸ģ¬³ÌÐò½Ï¶Ìʱ»¹ÐУ¬Èô³ÌÐòÓÐÉÏÍòÉõÖÁ¸ü¶à£¬¸ÄÆðÀ´¾Í²»ÊÇÄÇôÈÝÒ×ÁË¡£½üÀ´Ëæ×Åi18nµÄÖð½¥±ê
×¼»¯£¬ÎÒÒ²À´½²Ò»½²ÔÚPHPÖÐÈçºÎʵÏÖ¹ú¼Ê»¯Ö§³Ö¡£¸úÆäËû³ÌÐòÓïÑÔÒ»Ñù£¬ÔÚ PHP Ò²¿ ......
Ò». Ê×ÏÈ×öÒ»¸ö¼òµ¥µÄsoÎļþ£º
/**
* hello.c
* To compile, use following commands:
* gcc -O -c -fPIC -o hello.o hello.c
* gcc -shared ......
PHPеÄÁ¬½ÓMySQL·½·¨mysqli
1. ¿ªÆôPHPµÄAPIÖ§³Ö
£¨1£©Ê×ÏÈÐÞ¸ÄÄúµÄphp.iniµÄÅäÖÃÎļþ¡£
²éÕÒÏÂÃæµÄÓï¾ä£º
;extension=php_mysqli.dll
½«ÆäÐÞ¸ÄΪ£º
extension=php_mysqli.dll
......