Finding hidden gems vol. 3: quick win with .sh file

Mateusz Olejarka
Nov 1, 2018 · 2 min read

I observed that some application deployment’s automation is done by the use of shell scripts, mostly files with .sh extensions.

Based on the popular filenames found on GitHub (search for site:github.com ext:sh) I routinely check for such files during bug bounty hunting in my spare time.

Once it ended up quite unexpected.

I found a file, let’s say it was install.sh on one site which was WordPress based blog.

[--CUT--]echo "Setting up blog"echo "- Admin URL: ${local_url}/wp-admin"echo "- Wp User: c[--EDITED--]"echo "- Wp Pass: [--EDITED--][--CUT--]

What? WordPress admin credentials in plaintext?!

When I saw this, I said to myself “No way it works. Forget it”.

Still I opened the /wp-admin and entered login and password just to see the login error. I looked for a few seconds on the spinner waiting for this error to show up. To my surprise I was logged in instead. I immediately checked if I was an admin.

Yes I was. So, I filled the report. Few hours later I got the message below.

Thank you for this report, and given the severity, I have gone ahead and paid a full P1 bounty. We are working on resolving this now and should have it done soon.

Thank you for your participation in the program and we look forward to future reports!

Nice of them.

Lessons learned

  • For myself - build a list of common sh files
  • Bug hunters - search for common sh files during recon
  • Developers - make sure you do not have any shell scripts in web root, if you do definitely do not store admin password in those files

If you enjoyed this story go see two previous parts:

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store