I was doing bounty on a private H1 program that interacts with various external services one of them was Atlassian Confluence and Jira.
As you know, you can run Atlassian on their cloud service at Atlassian.net, or in your own server. The Web application provided an input box to the URL and another input to the token to auth.
I created a Confluence wiki at atlassian.net, created a wiki page, wrote a few strings and added attachments, connected to this application, and the application downloaded completely the wiki page with their attachments on separate files.
What if I try to emulate an Atlassian server and manage to serve a 302 redirect at the time of serving the wiki attachments?
Let’s make a try,
The first thing that I did, was to open 8081 port to my router, and set up Burp to forward all the traffic to Atlassian IP so I redirected my HTTP traffic to HTTPS Atlassian IP like this:
The first MUST rule to add to search and replace is changing Host: MYOWNIP to Host: testwiki.atlassian.net. Otherwise, the Atlassian server will don’t know how to forward my traffic because that hostname with my IP is not on their WebServer config.
I tried the application on the testing app and It worked, the first HTTP request was forwarded, but all the next requests was going back to testwiki.atlassian.net.
I had to add a second match and replace this time in the Response Body, to find all https://testwiki.atlassian.net and change them to http://MYIP:8081.
After those 2 “match and replace” rules, on HTTP Proxy I could sniff and see all the HTTP Requests between the App and the Confluence server, so I waited for the app to try to synch attachments
And the HTTP Request was like this:
GET /wiki/download/attachments/229377/mobile_login_screen.png?version=1&modificationDate=1575987229920&cacheVersion=1&api=v2 HTTP/1.1
HTTP/1.1 302 Found
Cache-Control: private, max-age=2880
Strict-Transport-Security: max-age=315360000; includeSubDomains; preload
Date: Tue, 10 Dec 2019 14:47:32 GMT
And you can see the Location redirect to api.media.atlassian.com, that’s AWESOME.
A simple match/replace rule with regex, a test and finally:
HTTP Proxy showed up the original response and the modified with match/replace one.
And now all the attachments were 205 bytes with the access token inside of them. YEAH!
Burp helped me a lot on this one, otherwise, I would have to set up an HTTP Proxy with logs to sniff al the traffic, emulate each JSON request with PHP, Python or whatever scripting software you feel comfortable.
This method from start to end took me about an hour, but coding myself a proxy script and emulate all could have taken me a whole day. Thumbs up to Burp to be a bounty hunting tool and a proxy weapon sometimes too! That license worth every penny.