Skip to content

Instantly share code, notes, and snippets.

@nicoptere
Last active December 27, 2023 17:30
Show Gist options
  • Save nicoptere/a23ffae9ed51a5ca9766 to your computer and use it in GitHub Desktop.
Save nicoptere/a23ffae9ed51a5ca9766 to your computer and use it in GitHub Desktop.
basic PHP image proxy (that works ... )
<?php
$url = "";
if( isset( $_GET['url'] ) )
{
$url = $_GET[ 'url' ];
}
else
{
exit();
}
$imginfo = getimagesize( $url );
header("Content-type: ".$imginfo['mime']);
readfile( $url );
?>
@zyuiop
Copy link

zyuiop commented Sep 3, 2017

Completely insecure (...php?url=/etc/passwd)

@carloscarucce
Copy link

carloscarucce commented Oct 5, 2017

Thanks!
I've made some validations and security checks in this version: https://gist.github.com/carloscarucce/89329fa61997b3775487b0c155cda41f

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