Skip to content

Instantly share code, notes, and snippets.

@kjlubick
Last active September 3, 2015 20:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjlubick/560dda55c47dd3a53643 to your computer and use it in GitHub Desktop.
Save kjlubick/560dda55c47dd3a53643 to your computer and use it in GitHub Desktop.
Example Jetty Exploit
import org.eclipse.jetty.server.Server;
public static HTTPServer startUpAnHTTPServer(WebQueryInterface wqi, UserManager um)
{
HTTPServer httpServer = new HTTPServer();
if (HTTPServer.getUserManager() == null)
{
userManager = um;
}
//Exploitable, this port can be accessed by anyone on the local network
httpServer.underlyingServer = new Server(SERVER_PORT);
//Safe, only can be accessed by localhost
//httpServer.underlyingServer = new Server(new InetSocketAddress("localhost", SERVER_PORT));
httpServer.underlyingServer.setHandler(HandlerManager.makeHandler(wqi));
try
{
httpServer.underlyingServer.start();
}
catch (Exception e)
{
logger.error("There was a problem starting the server", e);
}
return httpServer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment