⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perlfilterlecture.html

📁 黑客培训教程
💻 HTML
📖 第 1 页 / 共 3 页
字号:
    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/aa//g; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", 

      hex($1))/eg; #convert url encoding to ascii </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>A way to defeat this 'aa' filter would be to url 

      encode your 'aa' as '%61%61'. This next filtering problem is almost the 

      same as this one. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>+Filters that filter previous filters 

</FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>This is a strange one I found pretty earily in my 

      perl journey. This one is simular to the '.../...//' trick discribed 

      eariler. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>What happends is that one filter is looking for a 

      string, and another filter changes the string later. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>So an attacker can get a string to pass the first 

      filter, and then have the next filter(s) change the string into a 

      dangerous one. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>An example is easier to follow: </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/&lt;!--(.|\n)*--&gt;//g; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/javascript//ig; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Above we have the most common used filter to 

      prevent ssi and a filter for 'javascript'. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>The way to get around this filter is to use the 

      'javascript' filter inorder to change a string into ssi. So if: 

  </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah = '&lt;javascript!-- #exec cmd="rm -rf 

      /home/you/www" --&gt;'; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Then $blah will pass the first filter without 

      getting changed, and then be turned into '&lt;!-- #exec cmd="rm -rf 

      /home/you/www" --&gt;' which is a bad string, and would have been filtered 

      by the first filter. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>This technique can also be used with only one 

      filter. You've already seen this in the '.../...//' example I talked 

      about. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>+Multiple inputted variables forgotten in the 

      filters </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>This technique is more used on the output side of 

      things (html, flat databases, etc..), or when dealing with filepaths. But 

      I've seen it turn up in odd places, so keep an eye open for it. 

  </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>The deal with this problem is that your filters 

      may work perfect, they may filter out every possible bad string and any of 

      the other technqiues used to evade are stopped. But.. when the bad string 

      is split between two variables your filters do not find it. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Here is an example with filepaths (pretend all 

      directory transversal is stopped): </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/\.\./; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>erm </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/\.\.//; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$file =~ s/\.\.//; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>open(FILE "/home/user/${blah}$file"); 

</FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>If $blah = '.'; and $bleh = './anotheruser/file'; 

      the whole filename becomes: '/home/user/../anotheruser/file' </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>This problem is seen alot when filters try 

      stopping ssi or cross site scriptting. If two variables are printed to 

      html, then you need to make sure they aren't evading your filters. 

    </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>A fairly hard problem to fix indeed. Purhaps 

      putting all output into one variable and then filtering output is the best 

      solution. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>-- </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>That's pretty much it for the lecture, I will just 

      throw one more evasion technique for a poor perl filter that is used all 

      the time. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah =~ s/&lt;!--(.|\n)*--&gt;//g; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>I've already said that this filter is used to stop 

      ssi. But from my testings there is a way around this filter. That is if: 

      </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>$blah = '&lt;!-- #exec cmd="rm -rf /home/you/www" 

      - -&gt;'; </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Notice the space in '- -&gt;' at the end. 

    </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Now $blah will pass the filter and still will get 

      parsed by ssi. Atleast from my testing, if you can please try this on your 

      box and email me if '- -&gt;' works (try it with include, not exec as you 

      might have exec disabled). </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>These types of attacks where inserting characters 

      can be a big problem if you don't know all the variables of the system and 

      the details of how they work. Also you can find new ways to exploit very 

      common filters this way, so experiment alot with what is and what isn't 

      possible. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>-- </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Now time for discussion, I will try to answer any 

      questions (if you have any) or help you better understand anything. This 

      part might be editted in the log posted to bsrf website. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>Please try to refrain from talking unless you have 

      a question or are adding to the disscussion. Do not talk about other 

      things which aren't reguarding perl filters. </FONT></TD></TR>

  <TR>

    <TD>&nbsp;</TD>

    <TD>&nbsp; </TD></TR>

  <TR>

    <TD colSpan=2><FONT color=#ffffff>--- b0iler sets modes [#bsrf -m] 

    </FONT></TD></TR>

  <TR>

    <TD>&nbsp;</TD>

    <TD>&nbsp; </TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;Strider&gt;</FONT></TD>

    <TD><FONT color=#ffffff>nice lec b0iler =) </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>no questions worry me. ether it was good or people 

      don't care much. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;luCky&gt;</FONT></TD>

    <TD><FONT color=#ffffff>is this gonna be on a website </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>luCky: yes it will be on 

      http://b0iler.eyeonsecurity.net tonight and maybe http://blacksun.box.sk 

      if they upload it </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;Vegas&gt;</FONT></TD>

    <TD><FONT color=#ffffff>b0iler YOU ARE A FUCKING BASTARD </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;Vegas&gt;</FONT></TD>

    <TD><FONT color=#ffffff>pvt now </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;dksk8&gt;</FONT></TD>

    <TD><FONT color=#ffffff>lol </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;Strider&gt;</FONT></TD>

    <TD><FONT color=#ffffff>LMAO! </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;Strider&gt;</FONT></TD>

    <TD><FONT color=#ffffff>rofl </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;dksk8&gt;</FONT></TD>

    <TD><FONT color=#ffffff>roflmao </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;dksk8&gt;</FONT></TD>

    <TD><FONT color=#ffffff>no questions just &lt;Vegas&gt; b0iler YOU ARE A 

      FUCKING BASTARD </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>To conclude the lecture I would like to comment on 

      how obese cyrus is. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>&lt;yank&gt; Cyrus: eat a duck. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>&lt;yank&gt; I mean dick. </FONT></TD></TR>

  <TR>

    <TD><FONT color=#ffffff>&lt;b0iler&gt;</FONT></TD>

    <TD><FONT color=#ffffff>&lt;b0iler&gt; he'll eat both. and then a chicken. 

      </FONT></TD></TR></TBODY></TABLE><BR><BR>About 4 hours after my lecture I reread 

it and noticed that I completely forgot to mention a couple of things which my 

"Hacking CGI - Security and Exploitation" paper covers.&nbsp; This is how perl's 

reg ex uses "globing" to find strings.&nbsp; Which means it will match the first 

part (starting at the begining), and then find the last part starting at the end 

going backwards.&nbsp; This is dangerous if you are trying to correct any 

string.&nbsp; Read the paper for a better explaination, but here is a quick 

example: <BR><BR>$blah = '&lt;script&gt;&lt;script&gt;alert("this is not 

filtered well");&lt;/script&gt;&lt;/script&gt;';<BR>$blah =~ 

s/&lt;script&gt;(.*)&lt;\/script&gt;/[script]$1[\/script]/ig; <BR><BR>This will 

result in the s/// finding the first &lt;script&gt; and then going to end and 

finding the last &lt;/script&gt;.&nbsp; it will only replace these with the 

[]'s, it will leave the middle ones untouched.&nbsp; So $blah will be: 

[script]&lt;script&gt;alert('this is not filtered 

well');&lt;/script&gt;[/script] <BR><BR>The other is quite simple.&nbsp; The 

fact that .* will match any character.&nbsp; Or atleast that's what many scripts 

seem to think.&nbsp; Perl will match any character up until a newline, unless 

the /s switch is given or the newline is specificly matched.&nbsp; This means 

trouble for things like: <BR><BR>$blah = 

"&lt;script\n&gt;alert('unfiltered');&lt;/script\n&gt;";<BR>$blah =~ 

s/&lt;(.*)&gt;/[$1]/g; <BR><BR>Now this will match the first &lt; then it will 

match some characters, but then it runs into a newline before the closing 

&gt;.&nbsp; So the pattern does not match and the filter does nothing, but the 

html tags still work (atleast in browsers I tested). <BR><BR>If you find anymore 

problems in perl filters please email me about them with a clear discription and 

some examples.&nbsp; b0iler@hotmail.com <BR><BR><BR><FONT 

color=#ffffff><B>[-----]</B> <BR><BR><A 

href="http://b0iler.eyeonsecurity.net/">http://b0iler.eyeonsecurity.net/</A>&nbsp; 

- is my homepage <BR><BR>I got tons of tutorials, mini-tutorials, advisories, 

and code written by me there.&nbsp; Come check out what I'm up to and possibly 

learn a bit.&nbsp; This lecture was orignally given for http://blacksun.box.sk 

but anyone has permission to mirror it as long as it is mirrored in whole and 

proper credit is given to the author.&nbsp; Also a link to 

http://b0iler.eyeonsecurity.net would be nice. <BR><BR><B>[-----]</B> </FONT></FONT></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -