<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Axino.net &#187; Visual basic</title>
	<atom:link href="http://www.axino.net/tag/visual-basic/feed" rel="self" type="application/rss+xml" />
	<link>http://www.axino.net</link>
	<description>The other side of atom.</description>
	<lastBuildDate>Sat, 14 Aug 2010 23:11:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>hackthissite.org extbasic 8 :: Perl is a bitch sometimes</title>
		<link>http://www.axino.net/tutorial/2010/01/hackthissite-org-extbasic-8-perl-is-a-bitch-sometimes</link>
		<comments>http://www.axino.net/tutorial/2010/01/hackthissite-org-extbasic-8-perl-is-a-bitch-sometimes#comments</comments>
		<pubDate>Tue, 05 Jan 2010 02:01:47 +0000</pubDate>
		<dc:creator>Arxleol</dc:creator>
				<category><![CDATA[hackthissite.org]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[hackthissite]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[Visual basic]]></category>

		<guid isPermaLink="false">http://www.axino.net/?p=736</guid>
		<description><![CDATA[So our very dear Billy decided to work some code in perl. Introduction to mission gives us clue that Billy is used to Visual Basic code and therefore we probably need to search for difference in the code, that in fact is syntax similar to VB. So Bill Gates was tired of VisualBasic and now [...]]]></description>
			<content:encoded><![CDATA[<p>So our very dear Billy decided to work some code in perl.</p>
<p><span id="more-736"></span></p>
<p>Introduction to mission gives us clue that Billy is used to Visual Basic code and therefore we probably need to search for difference in the code, that in fact is syntax similar to VB.</p>
<blockquote><p>So Bill Gates was tired of VisualBasic and now did some Perl, too bad; this script has a security flaw that allows everyone access to the company records! Fix the flaw for him!</p></blockquote>
<p>Source code we have to examine:</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;http://perldoc.perl.org/functions/chomp.html&quot;</span><span style="color: #339933;">&gt;</span>chomp<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$User</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`/usr/bin/whoami`</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;http://perldoc.perl.org/functions/print.html&quot;</span><span style="color: #339933;">&gt;</span>print<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> <span style="color: #ff0000;">&quot;Checking your access level...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$User</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'BillGates'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;http://perldoc.perl.org/functions/print.html&quot;</span><span style="color: #339933;">&gt;</span>print<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> <span style="color: #ff0000;">&quot;Authorized! Here are the company records:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">`cat /home/BillGates/CompanyRecords.db`</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;http://perldoc.perl.org/functions/die.html&quot;</span><span style="color: #339933;">&gt;</span>die<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Closing...<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;http://perldoc.perl.org/functions/die.html&quot;</span><span style="color: #339933;">&gt;</span>die<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;You're not authorized!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</blockquote>
<p>Examining source code brought the following line of code to my notice.</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$User</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'BillGates'</span><span style="color: #009900;">&#41;</span></pre></div></div>

</blockquote>
<p>So we have to check whether in <strong>perl </strong><strong>Strings </strong>are <strong>compared </strong>with<strong> &#8220;==&#8221; </strong>syntax. From the <a href="http://www.shlomifish.org/lecture/Perl/Newbies/lecture1/conditionals/string.html" target="_blank">list of perl comparators</a> you will notice that Billy should have used <strong>eq</strong> instead of &#8220;==&#8221;.</p>
<p>So solution is:</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$User</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">'BillGates'</span><span style="color: #009900;">&#41;</span></pre></div></div>

</blockquote>
<p><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.axino.net/tutorial/2009/11/basic-web-hacking-11-user-agents-ii" rel="bookmark" title="Thursday 19.11.2009">Basic web hacking 11 :: User Agents II</a></li>
<li><a href="http://www.axino.net/tutorial/2010/06/javascript-challenge-13-cookie" rel="bookmark" title="Wednesday 09.06.2010">JavaScript Challenge 13 :: Cookie</a></li>
<li><a href="http://www.axino.net/tutorial/2009/11/basic-web-hacking-12-include-me-in" rel="bookmark" title="Saturday 21.11.2009">Basic web hacking 12 :: include me in</a></li>
<li><a href="http://www.axino.net/tutorial/2010/05/hack-test-com-7-examine-source-code" rel="bookmark" title="Friday 14.05.2010">hack-test.com 7 :: examine source code</a></li>
<li><a href="http://www.axino.net/tutorial/2010/01/hackthissite-org-extbasic-6-sucky-sysadmin" rel="bookmark" title="Monday 04.01.2010">hackthissite.org extbasic 6 :: Sucky Sysadmin</a></li>
</ul>
<p><!-- Similar Posts took 5.029 ms --></p>
 <img src="http://www.axino.net/wordpress/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=736" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.axino.net/tutorial/2010/01/hackthissite-org-extbasic-8-perl-is-a-bitch-sometimes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
