Web Injections

Basics

  • Used to run arbitrary commands on a server.

  • Multiple payloads can be used to trigger this behavior.

  • This is going to take a lot of guess-work .. just keep trying till you get it

Cookies

  • Check cookies

    • Tools > Developer > Application > Cookies

    • for yes-no or admin flags

    • for username (ex: auth=webuser)

      • Update to 'admin' to elevate!

  • Try google chrome extension

  • Encode/Decode with Base64 if needed

  • MD5 key for username:

62318aca2ef2e809a13623715a8aaff4   ..testme
21232f297a57a5a743894a0e4a801fc3   ..admin
> echo -ne admin | md5sum          ..ne to prevent new-line dump

Admin Registration Bug

  • Admin Registration Tricks

  • You might be able to register with 'AdMIN' or 'admin '

  • And the login will assume you are actually 'admin'

  • This is just dirty programming!

  • select * from users where username = 'admin'

Catch a Login Redirect with Burp

Naughty Strings

Try and break a webpage for error or injection:

Command Injection Basics

Command Injections

  • Where [x] is the value you provided in the form or in the URL.

  • Instead of sending the [x] to the command:

  • If commands are blocked, backticks might still be allowed!

Blind

  • Commands are blocked, but $() might be allowed

No spaces allowed

Name Field injection

Injecting the 'name' login field - gives command injection Custom messages aren't vulnerable to command injection, but your 'name' is.

PHP Injections

Open Redirect

PHP Includes

  • PHP normally disables loading of remote files: allow_url_include

Ruby Injections

  • Ruby with 'eval' - Eval is evil

  • Ruby uses ` for command execution!!

  • Here, we will need to do the following:

    • A double-quote " to break out of the string.

    • Add a + sign for string concatenation (don't forget to URL-encode to %2b)

    • Add a call to the command ([COMMAND]) we want to run using `

    • Add another + sign for string concatenation.

    • Another double-quote " to close the one that was already there.

Python Injections

Python Injection Bypass Execution Rules

Python Practice Locally

Perl Injections

  • Perl Concat using " . "

  • Developer Tools > Network > Preserve Logs

  • Find a back-end page running with "hello?name=hack"

LDAP Injection

MongoDB Injection

  • Instead of doing every manual-match attempt... use RubyBrute

Server Side Request Forgery (SSRF)

  • Allows an attacker to send commands to the localhost/server instead of normal path

Server Side Template Injection (SSTI)

File Uploads

XML Attack

XPath Injection

Last updated

Was this helpful?