Git Product home page Git Product logo

os-command-injection's Introduction

OS Command Injection


OS injection is a vulnerability seen in the websites that execute the system commands via web interface. OS command injection spoils the whole control access model of the website and the attacker gains the complete access over the website. With this ability attacker steals passwords and any other important files of the web site.

Possible Injection Points

  • GET : urls
  • POST : input via post method
  • HTTP headers : cookies, x-forward-for, user-agent, referrer ..... These are some possible places worth checking for injection.

How to Exploit OS command Injection

First step is to know the injection point and understand the functionality then use ping command to identify injection point, if there are any filters then use different kinds of operators.

For example, consider a scenario as shown in the image below.

chall

It takes some address as input and will ping the given web address i.e the input is executed as os command. Now that we can execute OS commands, we can give some command like " ls " to see what all files are there in the working directory, which may output something like this

chall-ls

There may be filters which does not allow the use of semi colon, then other operators like " & " can be used.

Some other useful operators

Operator Use
; Multiple shell commands are be seperated with semicolon and are executed at a time.
& It seperates two shell commands on one command line. It executes first command then second.
&& When this is used between two commands, second command is executed only if the first is true
|| Redirects the output of the first command to the input of the second command

Similar to SQL injection analysis of OS command injection can be done in two ways - 1) result based and 2) blind command injections.

1)Result - based injections:

When the attacker injects code then the output is displayed on the webpage. The output may be error as in sql injection or actual output of the command executed. The example from above can be considered as result based.

2)Blind injections:

Here the output of the injected code will not be displayed,then other technique's are used. One of which is transferring the output to other accessible locations and then viewing that file.

os-command-injection's People

Contributors

nimisha17 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.