From 9b3e15f871720b539ec42aabc19d239bee16d401 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sat, 29 Aug 2020 06:10:55 -0400 Subject: [PATCH] do not send any headers or data in aborted requests --- .../resources/packer/roles/mitmproxy/files/dns_spoofing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bubble-server/src/main/resources/packer/roles/mitmproxy/files/dns_spoofing.py b/bubble-server/src/main/resources/packer/roles/mitmproxy/files/dns_spoofing.py index d3224732..fcd94012 100644 --- a/bubble-server/src/main/resources/packer/roles/mitmproxy/files/dns_spoofing.py +++ b/bubble-server/src/main/resources/packer/roles/mitmproxy/files/dns_spoofing.py @@ -4,6 +4,8 @@ import re import time import uuid +from mitmproxy.net.http import headers as nheaders + from bubble_api import bubble_matchers, bubble_log, bubble_activity_log, \ CTX_BUBBLE_MATCHERS, BUBBLE_URI_PREFIX, CTX_BUBBLE_ABORT, CTX_BUBBLE_LOCATION, CTX_BUBBLE_PASSTHRU, CTX_BUBBLE_REQUEST_ID, \ add_flow_ctx, parse_host_header, is_bubble_request, is_sage_request, is_not_from_vpn @@ -62,7 +64,7 @@ class Rerouter: if 'decision' in resp: decision = resp['decision'] - matcher_response = { 'decision': decision, 'matchers': matchers, 'request_id': req_id } + matcher_response = {'decision': decision, 'matchers': matchers, 'request_id': req_id} bubble_log("get_matchers: returning "+repr(matcher_response)) return matcher_response @@ -136,6 +138,8 @@ class Rerouter: else: bubble_log('dns_spoofing.request: unknown abort code: ' + str(matcher_response['decision']) + ', aborting with 404 Not Found') abort_code = 404 + flow.request.headers = nheaders.Headers([]) + flow.request.content = b'' add_flow_ctx(flow, CTX_BUBBLE_ABORT, abort_code) bubble_activity_log(client_addr, server_addr, 'http_abort' + str(abort_code), log_url) return