applied security research
Rik van Duijn - 11 jul 2023

Using MiTMProxy as a scriptable pre-proxy for BurpSuite

TLDR: you can use mitmproxy to modify stuff before it sent to Burp Proxy. Instruction below.

Recently we were asked to asses a oldschool Java client server application. After configuring BurpSuite as a proxy and trusting the CA cert, we noticed the client communication still gave an error. It turned out the client and server used zlib to compress communication. The client could not accept plaintext responses. But the plaintext data was easier to work with. So we needed a way to decompress incoming requests and compress responses just before they were sent to the client-application.

This could probably be done by employing a Burp extension but I have never built one and it feels like its a lot of work. Some googling resulted in an extension called “JDser-DComp“, but the extension was only available as source. And it wasnt 100% what we wanted

So essentially we need to do the following:

  1. decompress the zlib packed request body that is sent by the client using mitmproxy
  2. remove the accept-encoding header from the request using mitmproxy
  3. forward the request to BurpSuite
  4. edit/modify etc the request in BurpSuite
  5. compress the response received from the server back to zlib-format using mitmproxy

Setting up:

OpenWebStart – MitmProxy – Burp Proxy – Server

First we need to add the mitmproxy CA certificate to OpenWebStart (Java). And point its proxy to localhost 8080. Next we need to make sure Burp proxy runs at a different port, i choose 8081. Run mitm proxy using the following command:

mitmproxy --mode upstream:http://127.0.0.1:8081 --ssl-insecure -s ./header.py

This forces mitmproxy to use burp as an upstream proxy, and trust its certificates. Its probably possible to add the Burp CA certificate to mitmproxy but this works just fine. The headers.py script modifies the incoming traffic and response traffic so we can use it in plaintext and the client still receives a compressed message. The header.py content:

import zlib

class AddHeader:
    def response(self, flow):
        flow.response.content=zlib.compress(flow.response.content)
        #flow.response.headers["Content-Encoding"] = "zlib"

    def request(self, flow):
        flow.request.headers.pop("Accept-Encoding", None)
        if(flow.request.headers.get("Content-Encoding") == "zlib"):
            flow.request.headers.pop("Content-Encoding", None)
            flow.request.content = zlib.decompress(flow.request.content)
            flow.request.headers["Content-Length"] = len(flow.request.content)

addons = [AddHeader()]

We had some issues modifying the response content-encoding header which resulted in errors. There is probably something happening after we compress and change the header. My guess is that mitmproxy tries to evaluate and change things based on, for example the content-encoding.

Got a useful tip from Rick Verdoes (Hackify) he uses a Burp extension “Python Scripter” that allows you to execute python code on each request and response. Havent tried it myself but it seems like a viable alternative.

Thanks @t_oh for help with the python debugging 🙂

Blogs

Attic Security voegt gratis AITM detectie toe  

- 25 mrt 2024
GRATIS bescherming tegen phishing voor Microsoft365  Goed nieuws! We hebben de gratis versie van Attic uitgebreid met een nieuwe oplossing: AITM Detectie. AiTM is een methode van cybercriminelen om (Microsoft) accounts te hacken en tweestapsverificatie te omzeilen. Met de AITM-functie in Attic kun jij als gebruiker eenvoudig je Microsoft365 omgeving beveiligen tegen phishingaanvallen. Het stelt […] Lees verder

Microsoft AITM honeytoken: warning the victims

Wesley Neelen - 18 mrt 2024
In January we launched new functionality for Attic to detect AiTM attacks targeting the Microsoft 365 tenant of customers. Using the platform of didsomeoneclone.me and custom CSS in the Microsoft login page. Since then, our approach has been implemented by other companies, such as EYE, CIPP and even de honey-heroes at Thinkst. This is amazing, because like this, our approach has more […] Lees verder

Attic Release Notes 2024.3.13

Erik Remmelzwaal - 13 mrt 2024
We are preparing Attic to become multi-lingual. For now this has led to the following (semi-)related new features. Furthermore we added some non-related additions particularly to Partner Portal and security content. Attic App Mail Layout Our backend consists of several functions that may generate email messages to users. We have unified the email templates in […] Lees verder

Building an AITM attack tool in Cloudflare Workers (174 LOC)

Wesley Neelen - 11 mrt 2024
In January we launched new functionality for Attic to detect AiTM attacks targeting the Microsoft 365 tenant of customers. Using the platform of didsomeoneclone.me and custom CSS in the Microsoft login page. Since then we are monitoring new detections and obviously, as security researchers, we deepdive into any detection that involves previously unseen TTPs.  Our […] Lees verder

Zolder B.V. ontvangt CCV Pentest Certificaat van DEKRA

Rik van Duijn - 16 feb 2024
Op 15 februari 2024 heeft Zolder B.V. het certificaat voor Certified Cybersecurity Vulnerability Pentest (CCV Pentest) van het test- en certificeringsbedrijf DEKRA ontvangen. Dit certificaat bevestigt dat Zolder B.V. voldoet aan de normen voor cybersecurity pentesting, wat onze klanten zekerheid biedt over de kwaliteit en professionaliteit van onze diensten. Het CCV Pentest Certificaat is van […] Lees verder

Microsoft 365 AiTM detection: the lessons learned

Wesley Neelen - 12 feb 2024
The beginning of January we released a new way to detect AiTM attacks on your Microsoft 365 environment. In just one month, we are protecting over 100 tenants with this new approach. We were able to protect so many tenants in a short time due to our existing customers of the Attic app. Also, our […] Lees verder

Attic Release Notes 2024.2.2

Erik Remmelzwaal - 08 feb 2024
In deze release van Attic introduceren wij een nieuwe manier van onboarding van diensten. Daardoor is het eenvoudiger geworden om TRIAL versies van onze diensten, met name die voor Microsoft365, toe te voegen. Het enige wat je nu nog nodig hebt om 2 weken met Attic for M365 te testen, is een (gratis) Attic account. […] Lees verder

Using honeytokens to detect (AiTM) phishing attacks on your Microsoft 365 tenant

Wesley Neelen - 09 jan 2024
Phishing attacks are rapidly increasing against Microsoft 365 tenants. Why? Microsoft is used by many company’s and users, so targetting it is very attractive. Also, techniques to bypass Multi-Factor Authentication (MFA) during a phishing attack are gaining popularity (AiTM phishing attacks). This allows attackers to even compromise accounts protected by MFA. At Zolder we are […] Lees verder

Pentesting-as-a-Service: rapporten zijn ouderwets

- 18 dec 2023
De manier van rapporteren van pentestresultaten lijkt stil te staan. Dat terwijl pentesten in feite de ideale manier is om risico’s en kwetsbaarheden te identificeren. Maar terwijl de cyberdreigingen in een hoog tempo veranderen, lijkt de manier waarop we het pentestproces inrichten soms stil te staan. Bij Zolder zijn we ervan overtuigd dat deze cruciale […] Lees verder

Storm-1575 AITM platform used to target cybersecurity experts

Zolder B.V. - 21 nov 2023
This morning we received a phishing mail containing a QR code. The mail caught our attention because it bypassed our spam filter and came straight into our inbox. Also, our company name “Zolder” was mentioned multiple times in the phishing mail, which indicates a more targeted campaign, although probably still highly automated. Last year Zolder […] Lees verder

Microsoft 365 review: onze hackers controleren jouw Microsoft 365 omgeving!

- 31 okt 2023
Heb je Attic inmiddels aangeschaft, of overweeg je om het te kopen? Maar heb je toch behoefte aan ondersteuning van onze security experts? Maak kennis met onze Microsoft 365 review dienst, ontworpen om jou te ondersteunen bij het optimaal benutten van Attic en je bedrijf te beschermen tegen digitale bedreigingen. Loop je vast met Attic? […] Lees verder

Subsidieregeling voor kleine bedrijven

Erik Remmelzwaal - 09 okt 2023
Uit onderzoek over cyberveiligheid onder kleinere bedrijven komt naar voren dat maar liefst 19% geen enkele cybersecuritymaatregel treft. Dit maakt kleine ondernemers kwetsbaar voor cyberaanvallen. Het Digital Trust Center (DTC) lanceerde eerder dit jaar de CyberVeilig Check voor mkb en zzp. De cyberorganisatie opent nu tijdelijk ook een subsidieregeling ‘Mijn Cyberweerbare Zaak’ om mogelijke financiële […] Lees verder

Attic versie 2023.9.0 - Release Notes

- 21 sep 2023
Een nieuwe Attic #release bomvol nieuwe checks, geïnspireerd door de #CIS Benchmark voor #Microsoft365. Deze release zit vol met nieuwe Checks en Fixes. Want we zijn hard bezig om te zorgen dat Attic “CIS-certified” raakt als assessment tool voor Microsoft365 en hebben nu bijna alle checks gebouwd die daarvoor nog nodig waren. Daarnaast is er […] Lees verder

Microsoft Sentinel: Wapen tegen Cyberdreigingen

Erik Remmelzwaal - 19 sep 2023
In de wereld van cybersecurity sta je voor een belangrijke uitdaging: het beschermen van je organisatie tegen digitale bedreigingen. Gelukkig is er een krachtig hulpmiddel tot je beschikking: Microsoft Sentinel. Wij praten er veel over vanwege onze dienstverlening, maar wat is het nu eigenlijk? in dit blog deel ik graag mijn inzichten met jou, zodat je een solide basisbegrip krijgt van wat dit product is en hoe je het kunt inzetten. Lees verder

Door NIS2 moet je iets gaan doen wat je nu nog niet doet...

Erik Remmelzwaal - 03 aug 2023
Als je onder een steen hebt geleefd: NIS2 komt eraan. De 2e versie van de Network and Information Security richtlijn van de EU. Het duurt nog even voordat dit in Nederlandse wetgeving is omgezet en daarin kunnen nog belangrijke details gaan schuiven, maar in grote lijnen weten we wat er op ons af komt. Door […] Lees verder

5 tips voor MKB'ers om zichzelf weerbaar te  maken tegen misleiding via internet

- 21 jul 2023
In de digitale wereld worden MKB’ers steeds vaker geconfronteerd met de dreiging van social engineering. In deze blogpost delen we waardevolle inzichten over twee veelvoorkomende vormen van social engineering, phishing en CEO-fraude. We benadrukken echter de praktische tips die MKB’ers kunnen volgen om zichzelf effectief te beschermen tegen deze cyberdreigingen. Phishing en CEO-fraude Phishing omvat […] Lees verder

Using MiTMProxy as a scriptable pre-proxy for BurpSuite

Rik van Duijn - 11 jul 2023
TLDR: you can use mitmproxy to modify stuff before it sent to Burp Proxy. Instruction below. Recently we were asked to asses a oldschool Java client server application. After configuring BurpSuite as a proxy and trusting the CA cert, we noticed the client communication still gave an error. It turned out the client and server […] Lees verder

Wat leren we uit het NCTV Cybersecuritybeeld en Verizon DBIR 2023

Zolder B.V. - 04 jul 2023
De samengestelde conclusie die ik haal uit CSBN en DBIR is dat organisaties (nog steeds) vooral slachtoffer worden via gelekte inloggegevens en e-mail en dat ze datalekken bijna altijd kunnen voorkomen door het implementeren van basismaatregelen. En de basismaatregel die past bij gelekte inloggegevens is Multi-Factor Authentication (MFA). Lees verder

Weerbaar tegen CEO-Fraude met Logs in Microsoft365

Erik Remmelzwaal - 22 jun 2023
Veel organisaties kunnen maar 7 dagen terugkijken in hun Microsoft365 logboeken. Veel te weinig, om adequaat te reageren op incidenten zoals CEO-Fraude en Ransomware. Belangrijk dus om te begrijpen welke mogelijkheden er zijn om die termijn uit te breiden. Lees verder

Attic voor de zorg: De toekomst van beveiliging met partnerschap Z-CERT

- 06 jun 2023
Attic voor de zorg is momenteel in ontwikkeling. We richten ons vooral op de toekomstige beschikbaarheid van deze krachtige beveiligingsoplossing en we nodigen zorginstellingen uit om deel te nemen aan onze beta-testfase. Partnerschap met Z-CERT In samenwerking met Z-CERT, de toonaangevende leverancier van dreigingsinformatie in de Nederlandse zorgsector, biedt Attic voor de zorg een unieke […] Lees verder

Ontdek meer van Zolder B.V.

Abonneer je nu om meer te lezen en toegang te krijgen tot het volledige archief.

Lees verder