<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Simone Margaritelli]]></title><description><![CDATA[INTP :: Hacker :: I break stuff to make the world a safer place.]]></description><link>http://www.evilsocket.net/</link><generator>Ghost 0.5</generator><lastBuildDate>Tue, 03 May 2016 17:28:53 GMT</lastBuildDate><atom:link href="http://www.evilsocket.net/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Is this a declaration of Cyber War?]]></title><description><![CDATA[<p>Hey guys, I'm writing this post mostly to save the stuff I'm going to share from being censored/removed, but also to share some of my thoughts about the thing.</p>

<h2 id="note">NOTE</h2>

<p>I like spy movies a lot, so if this just looks like bullshit to you be fair and be good, I'm just worried about the people's privacy :)</p>

<h3 id="bitcoindrama">BitCoin Drama</h3>

<p>I don't know if you've been following the whole BitCoin and Satoshi Nakamoto drama, basically Mr. Craig Wright <a href="http://www.economist.com/news/business-and-finance/21698060-craig-wright-reveals-himself-as-satoshi-nakamoto">claims that he is</a> Nakamoto, reveiling, finally, the true BitCoin creator's identity.</p>

<p>He also showed some alleged <a href="http://www.engadget.com/2016/05/02/bitcoin-creator-craig-wright/">crypto proof</a>.</p>

<p>Suddenly, on <a href="https://www.reddit.com/r/Bitcoin/comments/4hflr3/craig_wrights_signature_is_worthless/">Reddit</a> people started to explain how this "proof" was fake.</p>

<blockquote>
  <p>JoukeH discovered that the signature on Craig Wright's blog post is not a signature of any "Sartre" message, but just the signature inside of Satoshi's 2009 Bitcoin transaction. It absolutely doesn't show that Wright is Satoshi, and it does very strongly imply that the purpose of the blog post was to deceive people.
  So Craig Wright is once again shown to be a likely scammer. When will the media learn? <br>
  Take the signature being “verified” as proof in the blog post: <br>
  MEUCIQDBKn1Uly8m0UyzETObUSL4wYdBfd4ejvtoQfVcNCIK4AIgZmMsXNQWHvo6KDd2Tu6euEl13VTC3ihl6XUlhcU+fM4=</p>
  
  <p>Convert to hex:
  3045022100c12a7d54972f26d14cb311339b5122f8c187417dde1e8efb6841f55c34220ae0022066632c5cd4161efa3a2837764eee9eb84975dd54c2de2865e9752585c53e7cce</p>
  
  <p>Find it in Satoshi's 2009 transaction:
  <a href="https://blockchain.info/tx/828ef3b079f9c23829c56fe86e85b4a69d9e06e5b54ea597eef5fb3ffef509fe?format=hex">https://blockchain.info/tx/828ef3b079f9c23829c56fe86e85b4a69d9e06e5b54ea597eef5fb3ffef509fe?format=hex</a> <br>
  Also, it seems that there's substantial vote manipulation in /r/Bitcoin right now...</p>
</blockquote>

<p>I just thought "oh, some bad guy is speculating on bitcoins ... meh" ... but then <a href="https://www.reddit.com/r/Bitcoin/comments/4hj1xu/why_i_declined_to_verify_sns_identity_two_weeks/">this came out</a>:</p>

<h2 id="whyideclinedtoverifysnsidentitytwoweeksago">Why I declined to "verify" SN's identity two weeks ago</h2>

<blockquote>
  <p>About two weeks ago I was contacted and asked to offer security advice for a project. I was asked to sign an NDA in order to discuss the project itself, something I am reluctant to do, in general. Once I received the NDA however, it became obvious that the project was related to verifying the identity of Satoshi Nakamoto. I immediately declined the offer, declined to participate and declined to sign the NDA.
  I'm sure many people will think I was wrong to decline the "opportunity" to verify SN's identity. From my perspective, the request for me to verify his/her/their identity is in itself an appeal to authority. It is replacing public cryptographic proof with endorsement by a third party. If SN wants to "prove" their identity, they don't need an "authority" to do so. They can do it in a public, open manner. To ask people in the space who have a reputation to stake that reputation and vouch for SN's identity raises many red flags in my mind. <br>
  I don't know if Craig Wright is SN. I don't care and I don't want to know. <br>
  As I have expressed many times in the past, I think the identity of Satoshi Nakamoto does not matter. More importantly I think it serves to distract from the fact that bitcoin is not controlled by anyone and is not a system of Appeal-to-Authority. Identifying the creator only serves to feed the appeal-to-authority crowd, as if SN is some kind of infallible prophet, or has any say over bitcoin's future. <br>
  Identity and authority are distractions from a system of mathematical proof that does not require trust. This is not a telenovela. Bitcoin is a neutral framework of trust that can bring financial empowerment to billions of people. It works because it doesn't depend on any authority. Not even Satoshi's. <br>
  Back to work.</p>
</blockquote>

<p>The user who posted is not just some unknown, random user, <a href="https://www.reddit.com/user/andreasma">he's a well recognized part of the Reddit community</a>.</p>

<p>I'm neither a crypto expert nor a politics expert, but <strong>what I know</strong> is that during these very same days, governments all over the world are discussiong about our privacy, the right to have encrypted and private communications and so forth.</p>

<ul>
<li><a href="http://thehackernews.com/2016/04/fbi-hacking-power.html">http://thehackernews.com/2016/04/fbi-hacking-power.html</a></li>
<li><a href="http://thehackernews.com/2016/04/tor-unmask-malware.html">http://thehackernews.com/2016/04/tor-unmask-malware.html</a></li>
<li><a href="http://thehackernews.com/2016/04/apple-vulnerability.html">http://thehackernews.com/2016/04/apple-vulnerability.html</a></li>
</ul>

<p>And these links are just a small example about what is happening.</p>

<p>Having said that ... isn't this BitCoin thing very peculiar at this time? </p>

<p>If someone is really trying to replace cryptokeys and take control of the BitCoin market, who is he? Or ... who are them? Which organization is big enough to compromise/buy the media and spread such BS at such level?</p>

<p>Is it just me, or this is some kind of declaration of cyber war to the free people of the free web, us?</p>

<p>Maybe ... yeah, it's just me ... or maybe George Orwell was very right.</p>

<blockquote>
  <p>Perhaps a lunatic was simply a minority of one.</p>
</blockquote>

<p>George Orwell, 1984</p>]]></description><link>http://www.evilsocket.net/2016/05/03/is-this-a-declaration-of-cyber-war/</link><guid isPermaLink="false">4c4aa83a-b3b3-441b-ba6a-f3680eb38f02</guid><category><![CDATA[bitcoin]]></category><category><![CDATA[btc]]></category><category><![CDATA[satoshi nakamoto]]></category><category><![CDATA[identity]]></category><category><![CDATA[craig wright]]></category><category><![CDATA[government]]></category><category><![CDATA[privacy]]></category><category><![CDATA[cryptography]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 02 May 2016 22:53:46 GMT</pubDate></item><item><title><![CDATA[How I defeated an obfuscated and anti-tamper APK with some Python and a home-made Smali emulator.]]></title><description><![CDATA[<p>During this Saturday afternoon I was chatting with a friend of mine ( <a href="https://twitter.com/fvrmatteo">Matteo</a> ) and he asked for some help to fix a Python script he was working on.</p>

<p>He was trying to deobfuscate an APK in order to understand its obfuscation and anti tampering (more on this later) protections so I started working on it as well.</p>

<p>This was definitely way more challenging ( and fun! ) than my usual APK reversing session ( dex2jar -> jd-gui -> <strong>done</strong> ), moreover this required me to write a new tool which I find kinda cool and unique ( IMHO of course ), so I'm going to share the story in this post.</p>

<blockquote>
  <p>I'm going to intentionally skeep a few details here and there because I do not want to cause any harm to the people who wrote that application, all the involved protection mechanisms are there to avoid piracy.</p>
</blockquote>

<h3 id="weirdcharactersareweird">Weird Characters Are Weird</h3>

<p>Like every other reverser who experienced APK decompilation I'm used to Proguard messing with class and method names ( or Dexguard messing with strings, and so forth ), this is not usually a big deal to me, but what I saw when I executed <strong>apktool</strong> was definitely surprising:</p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/apktool.png" alt="apktool">
</center></p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/wtf.jpeg" alt="wtf">
</center></p>

<p>Most of the classes and methods names were weird binary strings, this almost freezed every single tool or editor I used to inspect those files, so the very first step was to fix ( to be honest, reimplement from scratch XD ) the python script that Matteo was trying to use to rename each obfuscated entry, the script itself was quite simple:</p>

<ul>
<li>Loop all smali files with non printable names.</li>
<li>Replace the obfuscated class name with <em>ClassXXX</em> ( where XXX is an incremental integer ).</li>
<li>Rename the files.</li>
<li>Search for every references to those classes and patch them with the new names ( regular expressions FTW! ).</li>
<li>Repeat the process against <em>.field</em> directives ( class members, methods, etc ).</li>
</ul>

<p>At the end of the process, I finally had a browsable folder and readable smali files :)</p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/phase1.png" alt="after basic deobfuscation">
</center></p>

<p>But I was definitely far from having done ...</p>

<h3 id="antitampering">Anti Tampering</h3>

<p>Before I continue, there're two things I need to point out in order to make the reasons behind my approach clearer:</p>

<ol>
<li>Matteo told me that the application had some misterious anti tampering ( and most likely anti debugging ) protection, therefore rebuilding the smali to a new APK with some injected code was not possible, neither was debugging.  </li>
<li>Such protections not only prevented code injection/modification, but also uninstalled the application if such tampering was detected.</li>
</ol>

<p>So no code injection ( nope, XPosed neither ), no debugging, absolutely no chance to use my standard approach for reversing it :(</p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/Okay-Meme-Gif-05.jpg" alt="sad">
</center></p>

<h3 id="encryptedstrings">Encrypted Strings</h3>

<p>As the lazy (or smart, you decide) reverser I am, instead of trying to understand the logic, at first I tried to search for meaningful strings that could give me some hints about what was going on in the app, but again I had a nasty surprise instead.</p>

<p>Every single string was encrypted with a custom algorithm, basically every reference to a string was replaced by something like:</p>

<pre><code class="language-java">String decrypted = Class623::method5( new int[]{ -12, 44, -35, ... }, 52 );  
</code></pre>

<p>Just a long array of integers and another integer as the second argument (maybe some sort of key?)</p>

<p>What I usually do in these cases is:</p>

<ol>
<li>Decompile the APK to java ( with dex2jar + jd-gui or just jadx ).  </li>
<li>Take the java code of the decryption routine and paste it in a stand alone java console application.  </li>
<li>Run the decryption routine against the encrypted stuff and eventually get the clear text results.</li>
</ol>

<p>Guess what? Every single tool failed to correctly transform the smali code of <strong>Class623::method5</strong> into java ... the output was just nonsense, not working, nada ... and for the record I'm not that good in reading smali code (the routine itself was quite complicated, at least for my smali skills) ... but I couldn't just give up ... no way!</p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/challengeaccepted.jpg" alt="challenge accepted">
</center></p>

<h3 id="allhailthesmaliemulator">All hail the Smali Emulator</h3>

<p>Of course I could take the smali code of <strong>Class623::method5</strong>, create a new Android app, decompile it with apktool, inject the smali code of that routine into the output, insert a smali call to that code into the app, rebuild it and launch it ... but:</p>

<ol>
<li>Again, I'm <strong>lazy</strong>.  </li>
<li>This solution wouldn't be <strong>elegant</strong>.  </li>
<li>A new idea was just born in my head and it was just too cool, I <strong>had</strong> to try it!</li>
</ol>

<p>Long story short, I said to myself:</p>

<blockquote>
  <p>Fuck this, I'm gonna write a smali parser and emulator and feed it with this routine, eventually it will output all the cleartexts I need!</p>
</blockquote>

<p>So I started reading <a href="http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html">Dalvik opcodes specs</a> ( tnx to <strong>Gabor Paller</strong> for this! ) and putting some code together, after a few hours I had this simple script ready for testing:</p>

<pre><code class="language-python">from smali.emulator import Emulator

emu = Emulator()

# The smali file to emulate.
filename = 'decryptor.smali'  
# Arguments for the method.
args = {  
    'p0': (-62, -99, -106, -125, -123, -105, -98, -37, -105, -97, -103, -41, -118, -97, -113, -103, -109, -104, -115, 111, 98, 103, 35, 52),
    'p1': 19
}

ret = emu.run( filename, args )

print emu.stats

print "RESULT:\n"  
print "'%s'" % ret  
</code></pre>

<p>Aaaaaaand:</p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/pwned.png" alt="decrypted">
</center></p>

<p><strong>BINGO!!!</strong></p>

<p>I executed the script against every encrypted string and it worked like a charm, the emulator was able to correctly parse and execute the smali code of the decryption routine and decrypt every single entry I've extracted from the decompiled application ... from that point on it was just a matter of replacing encrypted entries with their cleartexts and the reversing process became as easy as pie :)</p>

<p><center> <br>
<img src="http://www.evilsocket.net/content/images/2016/04/victory.jpg" alt="victory">
</center></p>

<h3 id="conclusions">Conclusions</h3>

<p>I've released the code on <a href="https://github.com/evilsocket/smali_emulator">github</a> as usual, it still lacks the support for a lot of Dalvik opcodes, I've just implemented the ones I needed in order to emulate that routine ( which you can find in the repo as well ), but it's quite easy to improve it and probably I'll complete it in the next few days :)</p>]]></description><link>http://www.evilsocket.net/2016/04/18/how-i-defeated-an-obfuscated-and-anti-tamper-apk-with-some-python-and-a-home-made-smali-emulator/</link><guid isPermaLink="false">848f6cf5-2016-4849-bb7f-1d2b6eba4f9f</guid><category><![CDATA[emulator]]></category><category><![CDATA[reversing]]></category><category><![CDATA[android]]></category><category><![CDATA[dalvik]]></category><category><![CDATA[apk]]></category><category><![CDATA[mobile]]></category><category><![CDATA[encryption]]></category><category><![CDATA[obfuscation]]></category><category><![CDATA[python]]></category><category><![CDATA[emulation]]></category><category><![CDATA[smali]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 18 Apr 2016 05:09:30 GMT</pubDate></item><item><title><![CDATA[How To Build Your Own Rogue GSM BTS For Fun And Profit]]></title><description><![CDATA[<p>The last week I've been visiting my friend and colleque <a href="https://twitter.com/z4ziggy">Ziggy</a> in Tel Aviv which gave me something I've been waiting for almost a year, a brand new <a href="https://www.nuand.com/blog/product/bladerf-x40/">BladeRF x40</a>, a low-cost USB 3.0 Software Defined Radio working in full-duplex, meaning that it can transmit and receive at the same time ( while for instance the HackRF is only half-duplex ).</p>

<p>In this blog post I'm going to explain how to create a portable GSM BTS which can be used either to create a private ( and vendor free! ) GSM network or for <strong>GSM active tapping/interception/hijacking</strong> ... yes, with some (relatively) cheap electronic equipment you can basically build something very similar to what the governments are using from years to perform GSM interception.</p>

<p><strong>I'm not writing this post to help script kiddies breaking the law, my point is that GSM is broken by design and it's about time vendors do something about it considering how much we're paying for their services.</strong></p>

<p><img src="http://www.evilsocket.net/content/images/2016/03/bts.jpeg" alt="my bts"></p>

<h3 id="hardwarerequirements">Hardware Requirements</h3>

<p>In order to build your BTS you'll need the following hardware:</p>

<ul>
<li>A <a href="https://www.nuand.com/blog/product/bladerf-x40/">bladeRF x40</a></li>
<li>Two <a href="https://www.sparkfun.com/products/675">Quad-band Cellular Duck Antennas SMA</a>.</li>
<li>A Raspberry Pi 3 ( model 2 and below are too slow ).</li>
<li>An USB battery pack ( I'm using a 26800mAh Anker Astro E7 ).</li>
<li>A microsd for the RPI >= 8GB.</li>
<li>Some patience and time ... :)</li>
</ul>

<h3 id="software">Software</h3>

<p>Let's start by installing the <a href="https://www.raspberrypi.org/downloads/raspbian/">latest Raspbian</a> image to the micrsd card ( use the "lite" one, no need for UI ;) ), boot the RPI, configure either the WiFi or ethernet and so forth, at the end of this process you should be able to SSH into the RPI.</p>

<p>Next, install a few dependecies we're gonna need soon:</p>

<pre><code>sudo apt-get install git apache2 php5 bladerf libbladerf-dev libbladerf0 automake
</code></pre>

<p>At this point, you should already be able to interact with the BladeRF, plug it into one of the USB ports of the RPI, <strong>dmesg</strong> should be telling you something like:</p>

<pre><code>[ 2332.071675] usb 1-1.3: New USB device found, idVendor=1d50, idProduct=6066
[ 2332.071694] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2332.071707] usb 1-1.3: Product: bladeRF
[ 2332.071720] usb 1-1.3: Manufacturer: Nuand
[ 2332.071732] usb 1-1.3: SerialNumber: b4ef330e19b718f752759b4c14020742
</code></pre>

<p>Start the <strong>bladeRF-cli</strong> utility and issue the <strong>version</strong> command:</p>

<pre><code>pi@raspberrypi:~ $ sudo bladeRF-cli -i
bladeRF&gt; version

  bladeRF-cli version:        0.11.1-git
  libbladeRF version:         0.16.2-git

  Firmware version:           1.6.1-git-053fb13-buildomatic
  FPGA version:               0.1.2

bladeRF&gt; 
</code></pre>

<p><strong>IMPORTANT</strong> Make sure you have these exact versions of the firmware and the FPGA, other versions might not work in our setup.  <center><strong><a href="http://www.evilsocket.net/content/images/bladerf_firmware_and_fpga.tar.gz">Download the correct firmware and FPGA image.</a></strong></center></p>

<p>Now we're going to install Yate and YateBTS, two open source softwares that will make us able to create the BTS itself.</p>

<p>Since I spent <strong>a lot</strong> of time trying to figure out which specific version of each was compatible with the bladeRF, I've created a github repository with correct versions of both, so in your RPI home folder just do:</p>

<pre><code>git clone https://github.com/evilsocket/evilbts.git
cd evilbts
</code></pre>

<p>Let's start building both of them:</p>

<pre><code>cd yate
./autogen.sh
./configure --prefix=/usr/local
make -j4
sudo make install
sudo ldconfig
cd ..

cd yatebts
./autogen.sh
./configure --prefix=/usr/local
make -j4
sudo make install
sudo ldconfig
</code></pre>

<p>This will take a few minutes, but eventually you'll have everything installed in your system.</p>

<p>Next, we'll symlink the NIB web ui into our apache www folder:</p>

<pre><code>cd /var/www/html/
sudo ln -s /usr/local/share/yate/nib_web nib
</code></pre>

<p>And grant write permission to the configuration files:</p>

<pre><code>sudo chmod -R a+w /usr/local/etc/yate
</code></pre>

<p>You can now access your BTS web ui from your browser:</p>

<pre><code>http://ip-of-your-rpi/nib
</code></pre>

<p>Time for some configuration now!</p>

<h3 id="configuration">Configuration</h3>

<p>Open the <strong>/usr/local/etc/yate/ybts.conf</strong> file either with nano or vi and update the following values:</p>

<pre><code>Radio.Band=900
Radio.C0=1000
Identity.MCC=YOUR_COUNTRY_MCC
Identity.MNC=YOUR_OPERATOR_MNC
Identity.ShortName=MyEvilBTS
Radio.PowerManager.MaxAttenDB=35
Radio.PowerManager.MinAttenDB=35
</code></pre>

<p>You can find valid MCC and MNC values <a href="http://www.mcc-mnc.com/">here</a>.</p>

<p>Now, edit the <strong>/usr/local/etc/yate/subscribers.conf</strong>:</p>

<pre><code>country_code=YOUR_CONTRY_CODE
regexp=.*
</code></pre>

<p><strong>WARNING</strong> Using the <strong>.*</strong> regular expression will make <strong>EVERY</strong> GSM phone in your area connect to your BTS.</p>

<p>In your NIB web ui you'll see something like this:</p>

<p><img src="http://www.evilsocket.net/content/images/2016/03/nibui-1.png" alt="NIB"></p>

<h3 id="enablegsmtapping">Enable GSM-Tapping</h3>

<p>In the "Tapping" panel, you can enable it for both GSM and GPRS, this will basically "bounce" every GSM packet to the loopback interface, since we haven't configure <strong>any encryption</strong>, you'll be able to see all the GSM traffic by simply tcpdump-ing your loopback interface :D</p>

<p><img src="http://www.evilsocket.net/content/images/2016/03/nibui-2.png" alt="tapping"></p>

<h3 id="startit">Start It!</h3>

<p>Finally, you can start your new BTS by executing the command ( with the BladeRF plugged in! ) :</p>

<pre><code>sudo yate -s
</code></pre>

<p>If everything was configured correctly, you'll see a bunch of messages and the line:</p>

<pre><code>Starting MBTS...
Yate engine is initialized and starting up on raspberrypi
RTNETLINK answers: File exists
MBTS ready
</code></pre>

<p>At this point, the middle LED for your bladeRF should start blinking.</p>

<h3 id="testit">Test It!</h3>

<p>Now, phones will start to automatically connect, this will happen because of the GSM implementation itself:</p>

<ul>
<li>You can set whatever MCC, MNC and LAC you like, effectly <strong>spoofing any legit GSM BTS</strong>.</li>
<li>Each phone will search for BTS of its operator and select the one with the strongest signal ... guess which one will be the strongest? Yep ... ours :D</li>
</ul>

<p>Here's a picture taken from my Samsung Galaxy S6 ( using the <a href="https://play.google.com/store/apps/details?id=com.wilysis.cellinfolite">Network Cell Info Lite</a> app ) which automatically connected to my BTS after 3 minutes:</p>

<p><img src="http://www.evilsocket.net/content/images/2016/03/gsm-1.jpeg" alt="MyEvilBTS"></p>

<p>From now on, you can configure the BTS to do whatever you want ... either act as a "proxy" to a legit SMC ( with a GSM/3g USB dongle ) and <strong>sniff the unencrypted GSM traffic</strong> of each phone, or to create a private GSM network where users can communicate for free using SIP, refer to the <a href="http://wiki.yatebts.com/index.php/Main_Page">YateBTS Wiki</a> for specific configurations.</p>

<p>Oh and of course, if you plug the USB battery, the whole system becomes completely portable :)</p>

<h3 id="referencesandfurtherreadings">References and Further Readings</h3>

<ul>
<li><a href="https://github.com/Nuand/bladeRF/wiki/Setting-up-Yate-and-YateBTS-with-the-bladeRF">https://github.com/Nuand/bladeRF/wiki/Setting-up-Yate-and-YateBTS-with-the-bladeRF</a></li>
<li><a href="https://z4ziggy.wordpress.com/2015/05/17/sniffing-gsm-traffic-with-hackrf/">https://z4ziggy.wordpress.com/2015/05/17/sniffing-gsm-traffic-with-hackrf/</a></li>
<li><a href="https://z4ziggy.wordpress.com/2015/05/10/ziggys-embedded-bts/">https://z4ziggy.wordpress.com/2015/05/10/ziggys-embedded-bts/</a></li>
<li><a href="http://wiki.yatebts.com/index.php/Main_Page">http://wiki.yatebts.com/index.php/Main_Page</a></li>
</ul>]]></description><link>http://www.evilsocket.net/2016/03/31/how-to-build-your-own-rogue-gsm-bts-for-fun-and-profit/</link><guid isPermaLink="false">7e7a63be-d303-42d1-be6a-9ef165d683cd</guid><category><![CDATA[hacking]]></category><category><![CDATA[gsm]]></category><category><![CDATA[bts]]></category><category><![CDATA[yatebts]]></category><category><![CDATA[rogue bts]]></category><category><![CDATA[evilbts]]></category><category><![CDATA[yate]]></category><category><![CDATA[bladerf]]></category><category><![CDATA[bladerf x40]]></category><category><![CDATA[rf]]></category><category><![CDATA[gsm hijacking]]></category><category><![CDATA[gsm intercept]]></category><category><![CDATA[gsm sniffing]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Thu, 31 Mar 2016 18:46:04 GMT</pubDate></item><item><title><![CDATA[OSX Mass Pwning using BetterCap and the Sparkle Updater Vulnerability.]]></title><description><![CDATA[<p><a href="http://www.bettercap.org/" target="_blank"> <br>
<img src="http://www.evilsocket.net/content/images/2016/01/bettercap.png" alt="bettercap" title="" style="width: 100%"> <br>
</a></p>

<p>Yesterday <a href="https://twitter.com/radekk">Radek</a> from VulnSec posted an interesting article named "<strong><a href="https://vulnsec.com/2016/osx-apps-vulnerabilities/">There's a lot of vulnerable OS X applications out there.</a></strong>", he discovered that the <strong>Sparkle</strong> update system ( used by some very popular OSX apps such as <strong>VLC</strong>, <strong>Adium</strong>, <strong>iTerm</strong> and so forth ) uses HTTP instead of HTTPS to fetch updates informations for such applications, making <strong>all of them</strong> vulnerable to <strong>man in the middle</strong> attacks and, as he shown, <strong>remote command execution</strong> attacks.</p>

<p>I'm not going to explain the details of his attack, his post is quite self explainatory, but I'll show you how easy it is to mass pwn OSX machines on your network using the new <a href="https://github.com/evilsocket/bettercap-proxy-modules/blob/master/osxsparkle.rb">OSX Sparkle</a> bettercap proxy module.</p>

<p>Moreover, I improved the attack ... Radek shown how to get RCE using an OSX terminal profile file, <strong>I will show you how to make the target execute any Mach-O exetutable you want!</strong> ( <a href="https://www.offensive-security.com/metasploit-unleashed/msf-os/">metasploit anyone</a>? ) </p>

<p>This is a screenshot of my MacBook Pro running OSX El Capitan with the latest version of VLC installed, being exploited and running a sample "Hello World" binary.</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/yo.png" alt="Hello World Sparkle"></p>

<p>Once you downloaded the aforementioned proxy module, install the <strong>ftpd</strong> gem:</p>

<pre><code>sudo gem install ftpd
</code></pre>

<p>and use the bettercap command line:</p>

<pre><code>sudo bettercap --proxy-module osxsparkle.rb --sparkle-rce-file /path/to/some/executable
</code></pre>

<p>Where <strong>/path/to/some/executable</strong> is the path to a Mach-O executable on your computer, this is the executable that all the targets are going to execute.</p>

<p>Well, enough said, have fun :)</p>]]></description><link>http://www.evilsocket.net/2016/01/30/osx-mass-pwning-using-bettercap-and-the-sparkle-updater-vulnerability/</link><guid isPermaLink="false">b95a365a-b897-4219-a5ed-3aec283ad91a</guid><category><![CDATA[bettercap]]></category><category><![CDATA[mitm]]></category><category><![CDATA[man in the middle]]></category><category><![CDATA[rce]]></category><category><![CDATA[sparkle]]></category><category><![CDATA[proxy module]]></category><category><![CDATA[update]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Sat, 30 Jan 2016 17:08:29 GMT</pubDate></item><item><title><![CDATA[Why you shouldn't trust CloudFlare's "Flexible SSL" and how to bypass it with BetterCap]]></title><description><![CDATA[<blockquote>
  <p>Let me clear one thing about this post ... this is <strong>not</strong> a CloudFlare vulnerability report and, even in that case, there's really nothing they could do in order to fix it     <del>unless they'd block direct traffic to HTTP websites</del>.
  This is only a blog post about why you shouldn't blindly trust free services that offer you some sort of SSL protection if your server itself is not SSL protected by default.</p>
</blockquote>

<p><br> <br>
<strong>UPDATE</strong>: <em>n0on3</em> <a href="https://twitter.com/n0on3/status/692763330210091009">noted on twitter</a> that <em>even a properly configured server / blocking plain HTTP won’t work if the mitm catches the first request</em>.</p>

<p>During this week, I've been playing with CloudFlare free plan in order to turn my websites into HTTPS protected websites, while configuring my account and playing a little bit with <a href="https://www.bettercap.org/">bettercap</a> I figured out something really weird and I tweeted <a href="https://twitter.com/bettercap/status/691991056469118976">this</a> ( from the @bettercap account ):</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/Schermata-2016-01-28-alle-18-08-27.png" alt="my tweet"></p>

<p>Someone from their team asked me to report this issue on HackerONE and eventually they decided to not accept it ... well, not a big deal, I didn't want to get money out of it in the first place and I didn't consider this to be a "real" vulnerability from their side, but just something they should take into account while writing their documentation and informing users, this is how it ended ( and that's why I'm disclosing this ) :</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/pasha.png" alt="HackerOne response"></p>

<h3 id="theattack">The Attack</h3>

<p>My configuration is the following:</p>

<ul>
<li>One website hosted on my dedicated server running <strong>only</strong> via HTTP ( no HTTPS available ).</li>
<li>CloudFlare SSL configured to <strong>Flexible</strong> ( since I have no certificate whatsoever ).</li>
</ul>

<p><img src="http://www.evilsocket.net/content/images/2016/01/flexiblessl.png" alt="Flexible SSL">
<center><small>As you can see, with Flexible SSL, your server doesn't handle HTTPS traffic by itself.</small></center></p>

<ul>
<li><strong>HSTS</strong> on with everything enabled ( <strong>browser preload</strong> as well ).</li>
</ul>

<p><img src="http://www.evilsocket.net/content/images/2016/01/hsts.png" alt="HSTS"></p>

<ul>
<li>A page rule configured ( as they wrote on the documentation ) to "<strong>Always uses https</strong>".</li>
</ul>

<p><img src="http://www.evilsocket.net/content/images/2016/01/pagerule.png" alt="Page Rule"></p>

<p>What I was expecting was that every request made against the HTTP website would be redirected to the CloudFlare HTTPS endpoint, effectively forcing every user to only browse through HTTPS ... well, it turned out that <strong>this configuration is quite easy to bypass</strong> using BetterCap or any other offensive tool that performs <strong>sslstripping</strong> and "Redirect to HTTPS" patching ... </p>

<p>But how? And why?</p>

<p>This attack will work <strong>if and only if</strong> the victim/target is browsing the HTTP(S) CloudFlare protected website for the very first time, since from the second time on, its browser would cache the HSTS preload rule and would perform a HTTP -> HTTPS redirect without waiting for an actual 307 redirect from the CloudFlare's proxy.</p>

<p>You just need to launch bettercap with the following command line arguments:</p>

<p><code>sudo bettercap -T IP-OF-THE-TARGET --proxy</code></p>

<p>From that moment on, bettercap will start sslstripping and patching every redirect to HTTPS:</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/bettercap_cloudflare.png" alt="bettercap and cloudflare"></p>

<p>As you can see from the screenshot, once bettercap intercepted the redirect to the HTTPS website, it just killed it and left the victim browsing the page through HTTP ( while proxying the data through HTTPS to the real endpoint ). <br>
This allows the tool to see the traffic from both sides in cleartext, manipulate it, and so forth.</p>

<p>This happens because the my original webserver had only the HTTP port exposed and no HTTPS capabilities at all, <del>as I already mentioned the only way for CloudFlare to fix this would be to block all the traffic going through the original HTTP server and only permit it if it's through SSL.</del></p>]]></description><link>http://www.evilsocket.net/2016/01/28/why-you-shouldnt-trust-cloudflares-flexible-ssl-and-how-to-bypass-it-with-bettercap/</link><guid isPermaLink="false">b7ba5a86-6b43-4a56-91a4-17df27b7e9c3</guid><category><![CDATA[security]]></category><category><![CDATA[bettercap]]></category><category><![CDATA[mitm]]></category><category><![CDATA[ssl]]></category><category><![CDATA[https]]></category><category><![CDATA[http]]></category><category><![CDATA[ssl stripping]]></category><category><![CDATA[sslstrip]]></category><category><![CDATA[sslstripping]]></category><category><![CDATA[cloudflare]]></category><category><![CDATA[flexible ssl]]></category><category><![CDATA[hsts]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Thu, 28 Jan 2016 17:26:07 GMT</pubDate></item><item><title><![CDATA[Autopwn every Android < 4.2 device on your network using BetterCap and the "addJavascriptInterface" vulnerability.]]></title><description><![CDATA[<p><a href="http://www.bettercap.org/" target="_blank"> <br>
<img src="http://www.evilsocket.net/content/images/2016/01/bettercap.png" alt="bettercap" title="" style="width: 100%"> <br>
</a></p>

<p>Recently I've been playing with Android's WebView based vulnerabilities, focusing on how to exploit them using a MITM attack. <br>
One of the most interesting ones is the <strong>addJavascriptInterface</strong> vulnerability ( <a href="http://www.cvedetails.com/cve/2012-6636">CVE-2012-6636</a> ) which affects every device running a version older than Android 4.2.</p>

<p><strong>NOTE</strong></p>

<p>The original title of this post was <strong>Autopwn every Android device on your network using BetterCap and the "addJavascriptInterface" vulnerability</strong> and some people pointed out it's a misleading title since "<strong>every Android != every Android &lt; 4.2</strong>". I totally agree with them, it wasn't intentional, the point of this post itself was not to show some uber 0day technique, but just to show how easy it is to use bettercap in order to exploit such type of vulnerabilities.</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/hacked.jpg" alt="hacked"></p>

<p>There's an <a href="https://labs.mwrinfosecurity.com/blog/2013/09/24/webview-addjavascriptinterface-remote-code-execution/">excellent post</a> about this vulnerability, long story short, if there's an app which is using a <strong>WebView</strong> UI control and it's declaring a custom javascript interface for it like so:</p>

<script src="https://gist.github.com/evilsocket/4f4deb1dbd1d66519dba.js"></script>

<p>you can inject some special javascript into that page and make that device execute any shell command you want.</p>

<p>In this post, I'd like to show how easy it is to automatically exploit every vulnerable device on your network using <a href="http://www.bettercap.org/">bettercap</a> and for this purpose I've wrote the <a href="https://github.com/evilsocket/bettercap-proxy-modules/blob/master/androidpwn.rb">AndroidPwn</a> transparent proxy module.</p>

<script src="https://gist.github.com/evilsocket/2e91719839d3fd6b06d6.js"></script>

<p>As you can see, you just need to activate it and specify a <code>--command COMMAND</code> command line argument and you're ready to go.</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/androidpwn-1.png" alt="androidpwn"></p>

<p>Leave it running and it will automatically perform a Man-In-The-Middle attack on your network and execute the command(s) you've chosen on every single Android device it will find on the network.</p>]]></description><link>http://www.evilsocket.net/2016/01/18/autopwn-every-android-device-on-your-network-using-bettercap-the-and-addjavascriptinterface-vulnerability/</link><guid isPermaLink="false">a1c3e446-3e71-46b0-ae1c-83ba74ab46ff</guid><category><![CDATA[hack]]></category><category><![CDATA[android]]></category><category><![CDATA[hacking]]></category><category><![CDATA[bettercap]]></category><category><![CDATA[transparent proxy]]></category><category><![CDATA[addJavascriptInterface]]></category><category><![CDATA[proxy]]></category><category><![CDATA[vulnerability]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 18 Jan 2016 17:49:49 GMT</pubDate></item><item><title><![CDATA[BetterCap and the first REAL DoubleDirect ICMP Redirect Attack]]></title><description><![CDATA[<p>The next release of <a href="http://www.bettercap.org/">bettercap</a> will include a <a href="https://github.com/evilsocket/bettercap/blob/8d1467987935762a890871c7e792c32b7390df53/lib/bettercap/spoofers/icmp.rb">new spoofer module</a> as an alternative to the default ARP spoofer. <br>
The new module performs a <strong>fully automated</strong> and full duplex <strong>ICMP Redirect</strong> MITM attack, what my collegues at Zimperium discovered and <a href="https://blog.zimperium.com/doubledirect-zimperium-discovers-full-duplex-icmp-redirect-attacks-in-the-wild/">called a</a> <strong>DoubleDirect</strong> attack.</p>

<p><strong>BetterCap will be the very first MITM framework to have this feature 100% working without any additional spoofers.</strong></p>

<p>If you're thinking about ettercap ICMP spoofer which was released (I think) years ago, let me remind you what its <a href="http://www.irongeek.com/i.php?page=backtrack-3-man/ettercap">documentation</a> says about it:</p>

<blockquote>
  <p>Obviously you have to be able to sniff all the traffic. If you are on a switch you have to use a different mitm attack such as arp poisoning.</p>
</blockquote>

<p>So yeah, unless you're <strong>already</strong> able to sniff network traffic ( in which case, why would you even need to do a MITM attack?!?!?! ), <strong>ettercap's ICMP module is completely useless</strong>.</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/photo.jpg" alt="lulz"></p>

<p>On the other hand, <a href="https://github.com/byt3bl33d3r/MITMf/">MITMf</a> is not that much better, if you look closely at <a href="https://github.com/byt3bl33d3r/MITMf/blob/d0b4fd66fafe9b3197e66b71dcc24e5e64f10eb3/core/poisoners/ICMP.py">its code</a>, you will find that the ICMP spoofer only does this:</p>

<pre><code>def build_icmp(self):
   pkt = IP(src=self.gateway, dst=self.target)/ICMP(type=5,    code=1, gw=self.ip_address) /\
              IP(src=self.target, dst=self.gateway)/UDP()

   return pkt
</code></pre>

<p>Which basically will only reroute traffic to the gateway.</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/Meme-derp.jpg" alt="derp"></p>

<p>In order to have a <strong>real</strong> and <strong>full duplex</strong> MITM using ICMP Redirect packets, you have to reroute the gateway and every other address that the target/victim is requesting, which is why I used <br>
a <strong>DNS</strong> watcher thread just like described on Zimperium's blog post.</p>

<p><img src="http://www.evilsocket.net/content/images/2016/01/papel-de-parede-meme-freddie-mercury-136608662.jpg" alt="imsexy"></p>

<p>So stay tuned guys, the next release is close!</p>]]></description><link>http://www.evilsocket.net/2016/01/10/bettercap-and-the-first-real-icmp-redirect-attack/</link><guid isPermaLink="false">b46e11fa-11c6-4d4c-a093-a3764118aac8</guid><category><![CDATA[bettercap]]></category><category><![CDATA[icmp]]></category><category><![CDATA[icmp redirect]]></category><category><![CDATA[double direct]]></category><category><![CDATA[doubledirect]]></category><category><![CDATA[zimperium]]></category><category><![CDATA[spoofing]]></category><category><![CDATA[spoofer]]></category><category><![CDATA[icmp spoofing]]></category><category><![CDATA[routing]]></category><category><![CDATA[routing table]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Sun, 10 Jan 2016 13:11:34 GMT</pubDate></item><item><title><![CDATA[Past, present and future of Bettercap]]></title><description><![CDATA[<p>Four months passed since <a href="http://www.evilsocket.net/2015/07/25/bettercap-a-complete-modular-portable-and-easily-extensible-mitm-framework/">my first blog post</a> about <a href="http://www.bettercap.org/">bettercap</a>, a lot of fixes have been released and a lot of new features have been implemented. <br>
In this post I'd like to talk about some of these new features and describe them a little bit, this is basically a big changelog since the very first version, for a complete list of code changes you can read the <a href="https://github.com/evilsocket/bettercap/releases">releases</a> github page.</p>

<h3 id="majorchanges">Major Changes</h3>

<p><strong>Added <code>--no-discovery</code> argument to skip active host discovery.</strong> ( since v.1.1.0 )</p>

<p>Sometimes you already have the hosts you want to target in the arp cache of your computer, maybe because you already used bettercap against them or just because you already established some communication with them, you can now use the <code>--no-discovery</code> argument to use the static ARP cache instead of spawning the discovery agents and make the whole process faster.</p>

<p><strong>Dynamic discovery, new hosts are added to the targets list while running.</strong> ( since v1.1.0 )</p>

<p>Once bettercap is started, it will keep searching for new hosts and add them to the targets list even if an attack is already running. You can basically just launch bettercap once and it will take care of new computers connecting to your internal network.</p>

<p><strong>Implemented HTTP transparent proxy with modules support.</strong> ( since v1.1.0 )</p>

<p>No need for explanations here, you can find the complete documentation of the transparent proxy and its modules <a href="http://www.bettercap.org/features/#modulartransparentproxy">here</a>.</p>

<p><strong>Added builtin HTTP server.</strong> ( since v1.1.1 )</p>

<p>There's now a simple builtin HTTP server available, you can use it to serve static assets such as images or js files that you might need in your custom proxy module.</p>

<p><strong>New feature to save all packets to a pcap file ( <code>--sniffer-pcap</code> option ).</strong> ( since v1.1.2 )</p>

<p>You don't have time to manually inspect everything you're sniffing from the network? No problems! You can use the <code>--sniffer-pcap</code> argument to save every sniffed packet to a PCAP file and inspect it later.</p>

<p><strong>New <code>--sniffer-filter</code> argument to pass custom BPF filters to the sniffer.</strong> ( since v1.1.2 )</p>

<p>Of course, you can use a custom BPF filter in order to save only the packets you're really interested into :)</p>

<p><strong>Added <code>--no-spoofing</code> argument ( alias for <code>--spoofer NONE</code> ).</strong> ( since v1.1.2 )</p>

<p>If you want to use bettercap as a local proxy/sniffer to debug or reverse engineer some application, you can easily disable the spoofing using the <code>--no-spoofing</code> argument.</p>

<p><strong>New <code>--check-updates</code> option will check if a new version of bettercap is available.</strong> ( since v1.1.3 )</p>

<p>You can now check if a new version is available directly from bettercap.</p>

<p><strong>First prototype of HTTPS transparent proxy with realtime crafted certificate and/or custom .pem file.</strong> ( since v1.1.4 )</p>

<p>Yep, since v1.1.4 bettercap is also able to intercept and proxy HTTPS traffic using <strong>certificate pinning</strong>, both using a realtime built certificate or a custom PEM file.</p>

<p><strong>Added dynamic ARP agent/sniffer that will reply to ARP who-has requests when needed.</strong> ( since v1.1.4 )</p>

<p>As new <strong>legit</strong> ARP requests are intercepted on the network, the program will take care of generating a proper ( spoofed of course :P ) response.</p>

<p><strong>Implemented half-duplex mode for weird routers that whenever receive an <code>ARP_OPREPLY</code> suddenly sends an <code>ARP_OPREQUEST</code> to the real ip, screwing up MITM</strong> ( since v1.1.4 )</p>

<p>This was a new feature I implemented in order to fix a weird behaviour me and some users experienced with particular routers, a full description of this new mode can be found <a href="http://www.bettercap.org/about-the-new-half-duplex-option/">here</a>.</p>

<p><strong>Now the user can target more than one address at once</strong> ( since v1.1.4, tnx to <strong>@mvrilo</strong> )</p>

<p>The <code>--target</code> argument now supports a comma separated list of targets.</p>

<p><strong>Now the user can load more than one spoofer at once</strong> ( since v1.1.4, tnx to <strong>@minotaur-0</strong> )</p>

<p>The <code>--spoofer</code> argument now supports a comma separated list of spoofing modules.</p>

<p><strong>New argument to manually specify the gateway address</strong> ( since v1.1.5, tnx to <strong>@misterade</strong> )</p>

<p>The gateway address can now be manually specified on the command line, this is an optional argument which is needed only when you already know the gw address and don't want bettercap to search for it.</p>

<p><strong>New <code>--sniffer-source</code> argument to read a pcap file instead of sniffing from the network interface.</strong> ( since v1.1.5 )</p>

<p>If you're running bettercap as a simple sniffer/cretendials harvester, you can "replay" an already captured pcap file and feed it to the program instead of capturing real time traffic.</p>

<p><strong>Updated hw-prefixes file with latest version from nmap repository.</strong> ( since v1.1.6 )</p>

<p>This made the "mac-address to vendor" lookup more accurate.</p>

<p><strong>Implemented custom upstream proxy options ( <code>--custom-proxy</code>, <code>--custom-https-proxy</code> ) both for HTTP and HTTPS.</strong> ( since v1.1.6 )</p>

<p>A new set of arguments is available in order to specify a custom HTTP/HTTPS upstream proxy address.</p>

<h3 id="thefuture">The Future</h3>

<p>If you're interested in upcoming features, there's a "TODO" list available <a href="https://github.com/evilsocket/bettercap/blob/master/TODO.md">here</a>, some of these items are done and the code has already been pushed to the dev branch, others are still to be done and I'm still not sure about some, these are the major upcoming features.</p>

<p><strong>Implement <code>--ignore ADDR,ADDR,ADDR</code> option to filter out specific addresses from the targets list.</strong> ( READY in the developer branch )</p>

<p>If there're one or multiple ip addresses that are causing a lot of traffic and that you're not interested to, you can use this argument to completely ignore them.</p>

<p><strong>Rewrite proxy class using em-proxy library.</strong></p>

<p>I'm currently working on a complete rewriting of the <strong>Proxy</strong> class that will dramatically increase its performances thanks to the great <a href="https://github.com/igrigorik/em-proxy">em-proxy</a> gem by <strong>Ilya Grigorik</strong>.</p>

<p><strong>Active packet filtering/injection/etc</strong></p>

<p>This still needs to be started, but in the future there will be a modular packet injector/filter ( pretty much like the modular HTTP(S) transparent proxy but for raw packets ^_^ ), probably powered by the <a href="https://github.com/gdelugre/ruby-nfqueue">nfqueue</a> Ruby gem by <strong>Guillaume Delugré</strong>.</p>

<p><strong>BSD Support.</strong> ( !!!Help wanted here!!! )</p>

<p>Bettercap is already compatible with Mac OS X and basically every distribution of GNU/Linux, I'd like some BSD guru to help me to make it compatible with *BSD systems as well.</p>

<p><strong>HTTP/2 Support.</strong></p>

<p>Self explanatory, still in TODO.</p>]]></description><link>http://www.evilsocket.net/2015/12/01/past-present-and-future-of-bettercap/</link><guid isPermaLink="false">b39e9c0c-3ee0-463b-b332-fbe92ad496bf</guid><category><![CDATA[open source]]></category><category><![CDATA[hacking]]></category><category><![CDATA[project]]></category><category><![CDATA[bettercap]]></category><category><![CDATA[mitm]]></category><category><![CDATA[oss]]></category><category><![CDATA[changelog]]></category><category><![CDATA[progress]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Tue, 01 Dec 2015 17:04:02 GMT</pubDate></item><item><title><![CDATA[Karma: How Open Source changed my life.]]></title><description><![CDATA[<p>( or “How the anarchy of ideas can change things” )</p>

<p>This time I've decided to write a purely personal post, mainly because I've reached a stage in my life in which I believe I've understood a number of things that I'd like to share, in the hopes of helping someone facing similar circumstances to my own.</p>

<p>I don't feel my knowledge of the English language would have allowed me to express myself accurately, so I wrote this in <a href="http://www.evilsocket.net/2015/10/26/karma-come-lopen-source-ha-cambiato-la-mia-vita/">Italian</a>, and had it translated from a friend of mine ( tnx! ).</p>

<h1 id="whoiamandwhatopensourcemeanstome">Who I am and what Open Source means to me  </h1>

<p>For those who do not know me, I'd like to introduce myself by explaining what I've always considered Open Source to mean, a very fitting introduction to the story I'd like to tell you. <br>
As what is left of the Royal Library of Alexandria has been preserved, or the Colosseum, Saint Peter's, art, and music, so are ideas, things that we have preserved. Sometimes these are good, productive ideas, like the discovery of a new cure, others debatable (religions, barbaric customs, violence) but nevertheless <strong>free</strong>. <br>
The beauty of the things that belong to all of us, like works of art and ideas, is that they have always been free... you are free to partake in a religion, you are free to choose not to, and so on. My “Ideas” are my code, your code, they are the code of millions of programmers all over the world who, like me, have decided to share them with whoever wants them, preserving what little good our generation will leave behind as a legacy.</p>

<p>Oh, one other thing I'd like to add in introducing myself... <strong>the child in me has never accepted that pretty toys cost so much</strong>.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/me.jpg" alt="me"></p>

<h1 id="dsploitthestoryofanexperiment">dSploit, the story of an experiment.  </h1>

<p>Years ago, having purchased my first android terminal, good little nerd that I am, I began gathering information on programming, operating systems, and so on... I had, after all, been using Linux for ever, Java I remembered from the old days of project-based jobs... how hard could it be to learn? <br>
So I signed up at <a href="http://www.xda-developers.com/">XDA</a>, read their guides (<strong>thanks, guys!!! &lt;3</strong>) and began experimenting... I needed an initial idea, so I decided to combine my background on network security with my first experiment, namely my first Android app.</p>

<p>The idea was to somehow replicate <strong>ettercap</strong>'s features, in other words, to carry out a MITM attack on a WiFi network from a mobile phone, using an Android  application. So I started researching on Google to see if someone had already pulled off something similar (<strong>heaven forbid that I'd waste my time on an unoriginal idea! XD</strong>) and not only did I find out that someone else had had the same idea, they were distributing it as a “semi-free” product with purchasable features... <strong>unacceptable!</strong> <br>
Not only had my idea been “stolen” ( LOL! ) but it had been ruined and transformed into something hideous... I couldn't take it.  </p>

<p>What started out as a project soon became my little “ethical revenge” :D <br>
It took me all of three days to learn how to program on Android, and set up my first prototype of what would soon be known as <strong>dSploit</strong>.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/dsploit.jpg" alt="dsploit"></p>

<p>Needles to say that the interface was as ugly as sin, slower than molasses, and as bugged as an old mattress... but it worked, and moreover, it was <strong>free</strong>. <br>
I immediately released the code on Github, and posted a link with a brief introduction on XDA.</p>

<p>I had no idea that those tiny steps would turn my life around, in just a few years.</p>

<p>The project literally exploded, the next day my inbox was clogged with replies to my XDA thread. People asking for more information, wanting to know how to compile the code, but most of all, people comparing it with that other app, the semi-free thing that had “ruined” my idea.</p>

<p>I started working on it like a dog. During the day, I kept up with my job as a PHP programmer for a company in Rome, at night and during my summer break, I wrote miles of code, considered new concepts, new functions, things those “other people” hadn't even thought of.</p>

<p><strong>My idea was for everyone, and my idea worked... my idea was free.</strong></p>

<p>After a while I began exchanging emails with a couple of people that had developed the “other” app, sometimes we'd exchange tips, at other times we just chatted. Turns out, they were far from the “evils suits” I'd thought them to be; they were smart, friendly guys, but most of all they were open to new ideas. <br>
I became especially friendly with one of them, and we carried on talking every now and again over the following two or three years. During this period I changed jobs, and moved to a new home, however my life hardly changed, I was still your average guy, with an average salary.</p>

<p>Then, over a very short period of time, two months give or take, everything changed.</p>

<p>The tornado hit on what seemed to be a very typical morning at the office. My friend from that other company wrote to me, saying something on these lines (I'll never forget it):</p>

<blockquote>
  <p>Hey How are things? When are you planning on leaving that crappy job and joining us? You're our kind of stuff, you've always been. </p>
</blockquote>

<p>As chaotic as it was, everything began to make sense. Those seemingly insignificant, disconnected events had, maybe, been leading me to where I was destined to go.</p>

<p>Without going into the details of the transition, the only relevant thing that happened during my first “job interview” which was in Amsterdam, mind you, was that my girlfriend, with whom I was about to celebrate our sixth anniversary, decided it was time she moved on, due to issues we'd already accepted and discussed, yada, yada, yada.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/amsterdam.jpg" alt="haxpo"></p>

<p>Let's fast-forward to today; it's now more than a year that I've been working on my own, from home, and yet, I have a very high salary, the work is thrilling, and working hours very flexible... lately, I've met loads of people, some I know are just passing through, others I'm sure are here to stay... I've been able to indulge in things I couldn't even dream about before, I travelled the world, and have seen more places in this last year than I've seen in a lifetime. I've been able to help many people I hold dear who needed some solid help, but most of all, I've realized something about money.... it doesn't make you happy, but it gives you the necessary freedom to build that happiness, and freedom has been the only real thing I've sought after all my life.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/lol.jpg" alt="friends"></p>

<p>All these things (and for those who have been paying attention, it was really quite clear where I was going with this) I couldn't have achieved without that money, that came from an idea I had decided to set <strong>free</strong>... now that project has been forked, downloaded, cloned, improved upon, and belongs to the community, as it should.</p>

<p>I wanted to share this story to tell you a little about myself, debunk a few “myths” about the creation of dSploit, but most of all to give hope to all those who, like me, stay up all night in the name of an idea... be free, guys, let your ideas be preserved, and let them lead you where you are destined to go.</p>]]></description><link>http://www.evilsocket.net/2015/10/27/karma-how-open-source-changed-my-life/</link><guid isPermaLink="false">9664caac-d555-4408-8f85-c153d28d602f</guid><category><![CDATA[open source]]></category><category><![CDATA[dsploit]]></category><category><![CDATA[life]]></category><category><![CDATA[job]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Tue, 27 Oct 2015 14:08:05 GMT</pubDate></item><item><title><![CDATA[Karma: Come l'Open Source ha cambiato la mia vita.]]></title><description><![CDATA[<p><strong>The English version of this post can be found <a href="http://www.evilsocket.net/2015/10/27/karma-how-open-source-changed-my-life/">here</a>.</strong></p>

<p>( o anche "Come l'anarchia delle idee può cambiare le cose" )</p>

<p>Questa volta voglio scrivere un post di carattere puramente personale, <br>
principalmente perchè sono arrivato ad un certo punto della mia vita <br>
nel quale penso di aver capito alcune cose che mi fa piacere condividere e che magari possono aiutare tante persone nella mia stessa situazione.</p>

<p>In Italiano perchè, purtroppo, la mia conoscenza della lingua Inglese <br>
non è così approfondita da potermi esprimere al meglio.</p>

<h1 id="chisonoecosasignificaopensourceperme">Chi sono e cosa significa Open Source per me  </h1>

<p>Per chi non mi conoscesse, mi vorrei presentare esponendo quella <br>
che è sempre stata la mia idea di Open Source, ottimo argomento di <br>
introduzione alla storia che vi voglio raccontare.</p>

<p>Così come ciò che è rimasto dell antica libreria di Alessandria d'Egitto <br>
è stato preservato nel tempo, così come il Colosseo, San Pietro, l'arte, la 
musica, anche le idee sono cose che abbiamo preservato. <br>
A volte idee giuste, produttive, come la scoperta di una nuova cura, altre <br>
opinabili ( religioni, usanze barbare, violenza ) ma pur sempre <strong>libere</strong>. <br>
La bellezza di ciò che appartiene a tutto il mondo, come le opere d'arte e <br>
le idee, è che sono sempre state libere ... sei libero di condividere una <br>
religione, sei libero di non farlo, e così via. <br>
Le mie idee, sono il mio codice, il vostro codice, sono il codice di <br>
milioni di programmatori in tutto il mondo che come me, hanno deciso di <br>
donarle a chiunque le voglia e così, preservare quel poco di buono che la <br>
nostra generazione potrà avere come lascito.</p>

<p>Ah, un altra cosa per presentarmi ... <strong>il bambino che c'è in me non ha mai <br>
accettato che i bei giocattoli costassero così tanto.</strong></p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/309252_10150321637414223_2120926431_n.jpg" alt="me"></p>

<h1 id="dsploitstoriadiunesperimento">dSploit, storia di un esperimento.  </h1>

<p>Anni fa, comprato il mio primo terminale android da bravo nerd, subito <br>
iniziai ad informarmi sulla sua programmazione, sistema operativo, e così <br>
via ... del resto, usavo Linux da sempre, Java lo ricordavo dai tempi <br>
dei vecchi lavori a progetto ... quanto mai poteva essere complicato <br>
imparare?</p>

<p>Così mi iscrissi ad <a href="http://www.xda-developers.com/">XDA</a>, lessi le loro guide ( <strong>grazie ragazzi!!! &lt;3</strong> ) ed <br>
iniziai a sperimentare ... mi serviva un idea per iniziare, così decisi <br>
di mischiare il mio background nella sicurezza delle reti con il mio primo <br>
esperimento, ovvero la mia prima applicazione per Android.</p>

<p>L'idea era quella di replicare in qualche modo le funzionalità di <strong>ettercap</strong>, <br>
ovvero di eseguire un attacco MITM su una rete WiFi, tramite un applicazione <br>
Android, direttamente dal cellulare. <br>
Così iniziai a cercare su Google per vedere se qualcuno avesse già fatto <br>
qualcosa di simile ( <strong>non sia mai avessi dovuto sprecare il mio tempo su <br>
un idea non originale! XD</strong> ) e non solo scoprii che qualcun'altro aveva già <br>
avuto la mia stessa idea, ma che la stavano distribuendo come prodotto "semi <br>
free" con funzionalità a pagamento ... <strong>inaccettabile!</strong></p>

<p>Non solo mi avevano "fregato" ( LOL! ) l'idea, ma l'avevano anche rovinata <br>
e ne avevano fatto qualcosa di orribile ... non potevo accettare questa cosa.</p>

<p>Quello che era nato come un esperimento divenne la mia piccola "vendetta etica" :D</p>

<p>Nel giro di tre giorni, non solo avevo imparato a programmare per Android, <br>
ma avevo già pronto il primo prototipo di quello che di li a breve, sarebbe <br>
stato chiamato <strong>dSploit</strong>.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/201138_10151199203439223_1398967788_o.jpg" alt="dSploit"></p>

<p>Inutile dire che aveva un interfaccia brutta come la morte, era lento come un <br>
topo morto e pieno di bug ... ma funzionava e soprattutto era <strong>libero</strong>. <br>
Rilasciai immediatamente il codice su Github, e postai un link con una breve <br>
presentazione del progetto su XDA.</p>

<p>Non sapevo che quelle due piccole cose, di li a qualche anno, avrebbero rivoluzionato <br>
la mia vita.</p>

<p>Il progetto fece un esplosione pazzesca, il giorno dopo trovai l'email intasata <br>
di risposte al thread su XDA, gente che chiedeva più informazioni, gente che <br>
voleva sapere come compilare il codice ma soprattutto, gente che faceva confronti <br>
con l'altra applicazione, quella semi free che aveva "rovinato" la mia idea.</p>

<p>Di li mi misi a lavorarci sopra come un mulo, di giorno svolgevo il mio lavoro <br>
( come sviluppatore PHP presso un azienda di Roma ), di notte e durante le ferie
( era estate ) scrivevo fiumi di codice, consideravo idee, nuove funzionalità, cose
alle quali nemmeno "quegli altri" avevano mai pensato.</p>

<p><strong>La mia idea era di tutti e la mia idea funzionava ... la mia idea era libera.</strong></p>

<p>Dopo un po di tempo instaurai uno scambio di email con un paio delle persone <br>
dell'azienda che aveva sviluppato "l'altra" applicazione, a volte ci scambiavamo <br>
consigli e a volte si chiacchierava. Non erano affatto "i mostri con la cravatta" <br>
che avevo immaginato, anzi, erano dei ragazzi brillanti, simpatici e soprattutto <br>
aperti a nuove idee. <br>
Divenni particolarmente amico con uno di loro due e continuammo a chiacchierare <br>
in chat di tanto in tanto per i successivi due o tre anni, periodo durante il <br>
quale cambiai lavoro e casa ma nonostante questo il mio stile di vita rimase <br>
sostanzialmente sempre lo stesso, una persona normalissima con uno stipendio <br>
normalissimo. </p>

<p>Finchè, durante un brevissimo lasso di tempo durato all'incirca due mesi, tutto <br>
cambiò.</p>

<p>Il vortice arrivò una mattina qualunque, mentre ero in ufficio a lavorare, quando <br>
il mio vecchio amico dell'altra società si fece nuovamente vivo in chat, esordendo con <br>
la frase ( non la scorderò mai ):</p>

<blockquote>
  <p>Hey Come va? Quando hai intenzione di lasciare quel lavoro merdoso ed unirti a noi? 
  Tu sei nostro materiale, lo sei sempre stato.</p>
</blockquote>

<p>Tutto, per quanto caotico, iniziò ad avere un senso, tutti quei piccoli ed insignificanti <br>
eventi apparentemente disconnessi tra loro, forse mi stavano portando dove ero destinato <br>
ad andare.</p>

<p>Inutile parlare dei dettagli della transizione, l'unica cosa rilevante fu che, durante <br>
il primo "colloquio di lavoro" ( ad Amsterdam, non dico altro ... ) la mia ragazza "storica", <br>
con la quale avrei festeggiato sei anni insieme da li a breve, decise di lasciarmi, <br>
per problemi di coppia che entrambi avevamo già ammesso, discusso e bla bla bla.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/10418552_10152389867564223_419786986_o.jpg" alt="Amsterdam"></p>

<p>Facciamo un salto in avanti e arriviamo ad oggi, ormai è più di un anno che lavoro da solo, da casa mia, <br>
ma lo stipendio è altissimo, il lavoro eccitante e gli orari molto flessibili ... in questo periodo di tempo ho conosciuto molte nuove persone, alcune delle quali solo di passaggio altre, sono sicuro, saranno amiche per sempre ... ho avuto modo di permettermi cose che prima non potevo neanche immaginare, ho girato il mondo e visto più nazioni straniere in questo anno che in tutto il resto della mia vita, ho potuto aiutare tante persone a me care che avevano bisogno di un aiuto concreto, ma soprattutto ho capito una cosa dei soldi ... non danno la felicità, ma danno la libertà necessaria per crearsela, e per tutta la vita la libertà è l'unica vera cosa che ho inseguito costantemente.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/10/10423845_10204088889206985_7021097546528158727_n.jpg" alt="amici"></p>

<p>Tutte cose che ( e per chi ha seguito bene sarà risultato ovvio dove volevo andare a parare ), <br>
senza quei soldi non mi sarei mai potuto permettere e quei soldi venivano da un idea che <br>
avevo deciso di rendere <strong>libera</strong> ... ora il progetto è stato forkato, scaricato, clonato, migliorato ed appartiene alla comunità così come è giusto che sia.</p>

<p>Ho voluto condividere questa storia per raccontare un po di me, sfatare alcuni "miti" dietro la nascita di dSploit ma soprattutto  per dare una speranza a tutti coloro che come me passano nottate insonni in nome di un idea ... siate liberi ragazzi, fate in modo che le vostre idee vengano preservate e vi portino li dove sono destinate a portarvi.</p>]]></description><link>http://www.evilsocket.net/2015/10/26/karma-come-lopen-source-ha-cambiato-la-mia-vita/</link><guid isPermaLink="false">6676e0ae-a8d1-4d63-b200-dd6f12d7ef65</guid><category><![CDATA[open source]]></category><category><![CDATA[dsploit]]></category><category><![CDATA[vita]]></category><category><![CDATA[life]]></category><category><![CDATA[italian]]></category><category><![CDATA[italiano]]></category><category><![CDATA[lavoro]]></category><category><![CDATA[job]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 26 Oct 2015 13:26:01 GMT</pubDate></item><item><title><![CDATA[How to use old GSM protocols/encodings to know if a user is Online on the GSM Network AKA PingSMS 2.0]]></title><description><![CDATA[<p>In the last few months I’ve been playing with Android’s low level GSM API, a few years ago the (in)famous <strong>sendRawPdu</strong> API was available, allowing a developer to manually encode a SMS message at a very low level before sending it to the GSM baseband itself and quite a few applications sending all kind of weird SMS ( flash sms, silent sms, etc ) were born ( for a brief overview of PDU encoding refer to <a href="http://www.smartposition.nl/resources/sms_pdu.html">this page</a> ).</p>

<p>(Un)fortunately Google decided to remove that API, it’s still not sure if they did it for security related purposes or during some refactoring of their IPC IBinder mechanism, but nowadays it’s no more available unless you use some very old phones/firmwares ( on most devices they removed the ttyUSB serial interfaces to send AT commands to the GSM modem as well ).</p>

<p>Until a couple of months ago, when I found the <strong>SmsManager.sendDataMessage</strong> API which, apparently, it’s not used anywhere ( if you search for it you’ll find only a few examples, but nothing regarding how to use it with manually encoded PDUs ). <br>
Using this API we’re able to manually encode our SMS, moreover we can specific a “port” as one of its arguments which will identify what kind of sms we’re gonna send, in this post I’ll talk about port 2948, namely the port used to send <strong>WAP PUSH notifications</strong>.</p>

<p>WAP PUSH messages were an old mechanism to basically force a remote device to visit a URL encoded in the SMS payload itself ( I know, security wise it was very dumb, but we’re talking about the 90s ), this specific request is called a “<strong>Service Load</strong>” (SL) request, where an XML payload like the following was encoded in a binary form and sent along the PDU to the device.</p>

<pre><code class="language-xml">&lt;?xml version="1.0"?&gt;  
&lt;!DOCTYPE sl PUBLIC "-//WAPFORUM//DTD SL 1.0//EN"  
                    "www.wapforum.org/DTD/sl.dtd"&gt;
&lt;sl href="http://some-evil-site.com/evil-content.html"/&gt;  
</code></pre>

<p>Nowadays this protocol is no more handled for obvious reasons … I said <strong>handled</strong> and not <strong>supported</strong> because the GSM basebands software is actually still able to receive it, but the higher level software ( the OS and its components ) will simply ignore it. <br>
For instance, on Android 5.0 you can see the following logs ( <code>logcat -b radio</code> ) when the device receives such payload:</p>

<pre><code>D/WAP PUSH( 1287): Rx: 0a0603...  
D/RILC    (  185): SOCKET RIL_SOCKET_1 REQUEST: SMS_ACKNOWLEDGE length:20  
D/RILC    (  185): RequestComplete, RIL_SOCKET_1  
E/RILC    (  185): Send Response to RIL_SOCKET_1  
D/RILJ    ( 1287): [9277]&lt; SMS_ACKNOWLEDGE  [SUB0]  
V/WAP PUSH( 1287): appid found: 2:application/vnd.wap.slc  
W/WAP PUSH( 1287): wap push manager not found!  
V/WAP PUSH( 1287): fall back to existing handler  
V/WAP PUSH( 1287): Delivering MMS to: com.google.android.talk com.google.android.apps.hangouts.sms.MmsWapPushDeliverReceiver  
</code></pre>

<p>So the event is delivered to the Google Hangouts application ( the default SMS/MMS handler on my phone ) which simply <strong>will ignore this kind of payloads</strong> unless they are simple MMS instead of anything else ( WAP PUSHes in our case ):</p>

<pre><code class="language-java">public class MmsWapPushDeliverReceiver extends BroadcastReceiver  
{
  public void onReceive(Context paramContext, Intent paramIntent)
  {
    if (("android.provider.Telephony.WAP_PUSH_DELIVER".equals(paramIntent.getAction())) &amp;&amp; ("application/vnd.wap.mms-message".equals(paramIntent.getType())))
      RealTimeChatService.a(paramIntent.getByteArrayExtra("data"));
  }
}
</code></pre>

<p>This means that, although the device will receive the data, <strong>no kind of notification will be shown to the user</strong> and the data itself won’t be saved anywhere in the system, but simply discarded.</p>

<p>Having said that, there’s a tiny detail that’s very handy for us … after delivering the WAP PUSH message, the destination <strong>operator BTS will reply to us with a delivery report</strong>. This report will be sent only if the device is turned on and completely able to receive the message ( turned on and with enough GSM network coverage ). <br>
In fact, the sendDataMessage API accepts as its last argument a delivery PendingIntent, in other words our application will be informed as soon as the delivery report will be sent back.</p>

<p>We can take advantage of this to do the following:</p>

<ul>
<li>Craft a WAP PUSH message encoding it manually.</li>
<li>Pass it to the sendDataMessage API and register a delivery intent.</li>
<li>The WAP PUSH will be sent to the target mobile phone and we’ll receive the delivery notification if the phone is turned on, if it’s not we’ll receive it as soon as it will be turned on.</li>
<li>The target user won’t notice absolutely anything.</li>
</ul>

<p>So, we can basically track a target user GSM network activity invisibly, knowing exactly when the target’s device is turned on without him having a single chance to notice anything.</p>

<p><a href="https://github.com/evilsocket/pdusms">Here</a>'s a very simple PoC application I've made to show how to use such API, the same kind of PDU can be sent using a normal GSM serial dongle and some software like Gnokii.</p>]]></description><link>http://www.evilsocket.net/2015/07/27/how-to-use-old-gsm-protocolsencodings-know-if-a-user-is-online-on-the-gsm-network-aka-pingsms-2-0/</link><guid isPermaLink="false">81a2fefe-c780-4eaf-a5c1-acd1dde28873</guid><category><![CDATA[sms]]></category><category><![CDATA[gsm]]></category><category><![CDATA[mms]]></category><category><![CDATA[wap]]></category><category><![CDATA[wap push]]></category><category><![CDATA[wap push notifications]]></category><category><![CDATA[delivery report]]></category><category><![CDATA[pdu]]></category><category><![CDATA[SmsManager.sendDataMessage]]></category><category><![CDATA[SmsManager]]></category><category><![CDATA[sendDataMessage]]></category><category><![CDATA[ping sms]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 27 Jul 2015 20:01:50 GMT</pubDate></item><item><title><![CDATA[Bettercap - A complete, modular, portable and easily extensible MITM framework.]]></title><description><![CDATA[<p>Today I want to present my last project called <strong>bettercap</strong>.</p>

<p><a href="http://www.bettercap.org/">Bettercap</a> is a complete, modular, portable and easily extensible MITM tool and framework with every kind of diagnostic and offensive feature you could need in order to perform a man in the middle attack.</p>

<p><img src="http://www.evilsocket.net/content/images/2015/07/quantum_of_solace_james_bond_roll_parody_rick_astley_rickroll_desktop_1680x1050_wallpaper-249024.jpg" alt="rickrolld"></p>

<p><strong>MOTIVATIONS</strong></p>

<blockquote>
  <p>Yet another MITM tool? C'mon, really?!!?</p>
</blockquote>

<p>This is exactly what you are thinking right now, isn't it? :D <br>
But allow yourself to think about it for 5 more minutes ... what you should be really asking is:</p>

<blockquote>
  <p>Does a complete, modular, portable and easy to extend MITM tool actually exist?</p>
</blockquote>

<p>If your answer is "ettercap", let me tell you something:</p>

<ul>
<li>ettercap <strong>was</strong> a great tool, but it made its time.</li>
<li>ettercap filters <strong>do not</strong> work most of the times, are outdated and hard to implement due to the specific language they're implemented in.</li>
<li>ettercap is freaking <strong>unstable</strong> on big networks ... try to launch the host discovery on a bigger network rather than the usual /24 ;)</li>
<li>yeah you can see connections and raw pcap stuff, <strong>nice toy</strong>, but <strong>as a professional researcher I want to see only relevant stuff</strong>.</li>
<li>unless you're a C/C++ developer, you can't easily extend ettercap or make your own module.</li>
</ul>

<p>Indeed you could use more than just one tool ... maybe <a href="http://linux.die.net/man/8/arpspoof">arpspoof</a> to perform the actual poisoning, <a href="http://mitmproxy.org/">mitmproxy</a> to intercept HTTP stuff and inject your payloads and so forth ... I don't know about you, but I <strong>hate</strong> when I need to use a dozen of tools just to perform one single attack, especially when I need to do some black magic in order to make all of them work on my distro or on OSX ... what about the <a href="https://en.wikipedia.org/wiki/KISS_principle">KISS</a> principle?</p>

<p>So <strong>bettercap</strong> was born ( isn't the name pure genius? XD ).</p>

<p>You can find infos on the project on the <a href="http://www.bettercap.org/">official website</a> or on its <a href="https://github.com/evilsocket/bettercap">github repository</a>.</p>

<p>Enjoy!</p>]]></description><link>http://www.evilsocket.net/2015/07/25/bettercap-a-complete-modular-portable-and-easily-extensible-mitm-framework/</link><guid isPermaLink="false">b45a5d8a-4d28-485d-b492-a8d9d05cd96a</guid><category><![CDATA[project]]></category><category><![CDATA[bettercap]]></category><category><![CDATA[ettercap]]></category><category><![CDATA[mitm]]></category><category><![CDATA[man in the middle]]></category><category><![CDATA[arp spoofing]]></category><category><![CDATA[arp poisoning]]></category><category><![CDATA[transparent proxy]]></category><category><![CDATA[oss]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Sat, 25 Jul 2015 18:02:09 GMT</pubDate></item><item><title><![CDATA[How to root the LG Watch Urbane ( B285 )]]></title><description><![CDATA[<p>A few days ago I've bought a <strong>LG Watch Urbane</strong> from the Google Store since it seemed to me the very first "elegant" wear device. <br>
I really like old fashioned wrist watches so I waited for something similar to be on the market before getting a Wear device.</p>

<p>Unfortunately, being it a relatively new device, there aren't many informations on the web on how to root it, so I started asking for infos on XDA and finally, with the help of <a href="http://forum.xda-developers.com/member.php?u=2313936">suzook</a> and <a href="http://forum.xda-developers.com/member.php?u=5570332">suljo94</a> I've managed to do it. <br>
Apparently, almost the same procedure of the <strong>LG G Watch R</strong> applies, but in order to make it work on the Urbane I needed different files, namely:</p>

<ul>
<li>The specific <strong>TWRP</strong> recovery image for this device. <a href="https://dl.twrp.me/bass/twrp-2.8.6.1-bass.img.html">download</a></li>
<li>The Wear version of the <strong>SuperSU</strong> update zip. <a href="http://rootjunkysdl.com/getdownload.php?file=LG%20G%20Watch/Root/Wear-SuperSU-v2.40.zip">download</a></li>
</ul>

<p>These are the simple steps to follow in order to root the LG Watch Urbane:</p>

<ol>
<li>Connect your device to the USB port of your computer ( I take for granted you have adb and fastboot installed ).  </li>
<li>Enable the developer menu, going into Settings -> Informations and tapping on the "Build" entry for 7 times.  </li>
<li>Go to the unlocked Developer Options settings menu and enable ADB Debugging.  </li>
<li>Unplug the device and plug it back, it should ask you if you want to allow your computer to connect to it, of course, allow it.  </li>
<li>Now open a terminal, and execute <strong>adb reboot bootloader</strong> to get into the bootloader.  </li>
<li>To unlock it, execute <strong>fastboot oem unlock</strong> ( This will wipe your device data! ).  </li>
<li>Setup the wiped device, and execute steps from 1 to 4 again.  </li>
<li>Again, <strong>adb reboot bootloader</strong>.  </li>
<li>Flash the TWRP image by issuing <strong>fastboot flash recovery twrp-2.8.6.1-bass.img</strong> ( make sure you have the img file in the same folder you're working in ).  </li>
<li>Now copy the SuperSU zip archive <strong>adb push Wear-SuperSU-v2.40.zip /sdcard/</strong>.  </li>
<li>Start the TWRP recover by executing <strong>adb reboot recovery</strong>.  </li>
<li>Use the <strong>Install</strong> option, select the zip file of SuperSU and flash it ( do <strong>not</strong> enable signature verification or the whole process will fail! ).  </li>
<li>Reboot your device and you're ready to go, enjoy the root ^_^</li>
</ol>]]></description><link>http://www.evilsocket.net/2015/06/15/how-to-root-the-lg-watch-urbane-b285/</link><guid isPermaLink="false">0b00d7dc-436e-4083-9b8d-9ddffa8a43b0</guid><category><![CDATA[android]]></category><category><![CDATA[LG Watch Urbane]]></category><category><![CDATA[root]]></category><category><![CDATA[android wear]]></category><category><![CDATA[wear]]></category><category><![CDATA[TWRP]]></category><category><![CDATA[SuperSU]]></category><category><![CDATA[su]]></category><category><![CDATA[LG G Watch R]]></category><category><![CDATA[XDA]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 15 Jun 2015 18:47:17 GMT</pubDate></item><item><title><![CDATA[Introducing FIDO, a Minimalistic, IDE-agnostic C/C++ Project Generator.]]></title><description><![CDATA[<p>I don't know you, but I always find myself performing the same kind of stuff over and over again dozens of times per month, such as:</p>

<ul>
<li>Create project folder.</li>
<li>Create <strong>src</strong> and <strong>include</strong> folders.</li>
<li>Fill them with a basic <strong>main.c(pp)</strong></li>
<li>Create the <strong>Makefile</strong>, fill tue rules.</li>
</ul>

<p>What about remembering all the times how to set the <strong>SYSROOT</strong> variable when I'm using the Android NDK? <br>
Or maybe create the <strong>CMakeLists.txt</strong> and try to remember each directive, which I don't, so I find myself googling for the same kind of stuff over and over ... and btw it's funny since I happen to use CMake for years now.</p>

<p>So I decided that I had enough of this, when I want to test just a simple line of C/C++ code it takes me more time to create all the project folder tree than to write the code itself ... and <strong>FIDO</strong> was born.</p>

<p><a href="https://github.com/evilsocket/fido">FIDO</a> is a minimalistic C/C++ IDE-agnostic project generator supporting various templates, currently it sopports:</p>

<pre><code>     android-make-c : Create a native Android C project based on Makefile.
   android-make-cpp : Create a native Android C++ project based on Makefile.
android-ndk-build-c : Create a native Android C project based on the ndk-build utility.
            cmake-c : Create a C project based on CMake.
          cmake-cpp : Create a C++ project based on CMake.
             make-c : Create a C project based on Makefile.
           make-cpp : Create a C++ project based on Makefile.
</code></pre>

<p>The installation is easy, I'll package it for PIP soon, but for now you just need to:</p>

<pre><code>python setup.py build
sudo python setup.py install
</code></pre>

<p>Once you installed it, all you need to do is to invoke <strong>fido create [template-name] [project-name]</strong> and it will automagically create everything for you in less than one second.</p>

<p>This is an ASCII cast you can watch as an example:</p>

<p><a href="https://asciinema.org/a/8te8gnp36ii7iypj2j1eg5b6m" target="_blank"><img src="https://asciinema.org/a/8te8gnp36ii7iypj2j1eg5b6m.png" style="width: 100%;"></a></p>

<p>Enjoy ^_^</p>]]></description><link>http://www.evilsocket.net/2015/05/18/introducing-fido-a-minimalistic-cc-project-generator-supporting-templates/</link><guid isPermaLink="false">2906151d-0af1-4e8e-ae24-742307071d22</guid><category><![CDATA[c]]></category><category><![CDATA[c++]]></category><category><![CDATA[fido]]></category><category><![CDATA[project]]></category><category><![CDATA[generator]]></category><category><![CDATA[project generator]]></category><category><![CDATA[template]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 18 May 2015 15:35:21 GMT</pubDate></item><item><title><![CDATA[Android Native API Hooking with Library Injection and ELF Introspection.]]></title><description><![CDATA[<p>This post can be considered both the part 2 of the previous "<a href="http://www.evilsocket.net/2015/05/01/dynamically-inject-a-shared-library-into-a-running-process-on-androidarm/">Dynamically inject a shared library into a running process on Android/ARM</a>" and a proof of concept of the same, namely what can be done with library injection on Android.</p>

<h1 id="tldr">TL;DR  </h1>

<p>I've updated the source code of the <a href="https://github.com/evilsocket/arminject">arminject</a> project on github adding a library that once injected into a process will hook its <strong>open</strong> API and print some logs to the logcat, the <strong>make test</strong> command will basically start a new <strong>Chrome</strong> browser process, use the <strong>injector</strong> discussed in the previous post to inject <strong>libhook.so</strong> into it and wait for its logs to appear, an example output could be like:</p>

<pre><code>@ Attaching to process com.android.chrome ...
@ Injecting library /data/local/tmp/libhook.so into process 8511.
@ Calling dlopen in target process ...
@ dlopen returned 0xb5202dc4

I/LIBHOOK ( 8511): [8511] open('/data/data/com.android.chrome/app_chrome/.com.google.Chrome.gJY5h4', 194)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/data/data/com.android.chrome/shared_prefs/com.android.chrome_preferences.xml', 577)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/data/data/com.android.chrome/files/android_ticl_service_state.bin', 0)
I/LIBHOOK ( 8511): [8511] open('/data/data/com.android.chrome/files/ticl_storage.bin', 0)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/data/data/com.android.chrome/files/android_ticl_service_state.bin', 577)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
I/LIBHOOK ( 8511): [8511] open('/dev/ashmem', 2)
...
...
</code></pre>

<h1 id="hookingsystemfunctions">Hooking System Functions  </h1>

<p>As I basically wrote everywhere in the source to avoid any kind of misunderstanding, the libhook.so code is almost totally based on <strong>Andrey Petrov</strong>'s blog post "<a href="http://shadowwhowalks.blogspot.it/2013/01/android-hacking-hooking-system.html">Android hacking: hooking system functions used by Dalvik</a>", although I had to modify and fix its original version since it didn't work ( page align errors, memory protection faults and so forth ).</p>

<p>The main concept is quite simple yet neat, once the library is injected inside the target process, its <strong>constructor</strong> will be executed. <br>
A constructor function is declared like this:</p>

<pre><code class="language-prettyprint lang-c">__attribute__((constructor)) somefunction() {  
    // something
}
</code></pre>

<p>This means that "somefunction" will be executed as soon as the library is loaded.</p>

<p>This allowed me to exploit Petrov's code at runtime and patch the process relocation table, an <strong>ELF</strong> structure that holds the addressess of system functions used by the program. <br>
The logic steps to do this are:</p>

<ul>
<li>Get the base pointer of the module using <strong>dlopen</strong>.</li>
<li>Given its pointer, lookup the symbol ( <strong>open</strong> in our case ) inside its (sym|str)tab.</li>
<li>Search the symbol inside the <strong>reloc</strong> table by index.</li>
<li>Backup its original address and finally patch it with our own hook function address.</li>
</ul>

<p>Once the hook function is called, it will log its parameters and then call the original function we previously backupped:</p>

<pre><code class="language-prettyprint lang-c">int hook_open(const char *pathname, int flags) {  
    HOOKLOG( "[%d] open('%s', %d)", getpid(), pathname, flags );

    return __open( pathname, flags );
}
</code></pre>

<p>Obviously this method can be applied to any kind of function, even Dalvik high level native API.</p>

<p>Enjoy :)</p>]]></description><link>http://www.evilsocket.net/2015/05/04/android-native-api-hooking-with-library-injecto/</link><guid isPermaLink="false">635fe7ae-706d-4d7b-b3a0-5de267b1aff2</guid><category><![CDATA[hooking]]></category><category><![CDATA[api hooking]]></category><category><![CDATA[library]]></category><category><![CDATA[android]]></category><category><![CDATA[injection]]></category><category><![CDATA[elf relocation]]></category><category><![CDATA[arm]]></category><category><![CDATA[elf]]></category><category><![CDATA[open]]></category><category><![CDATA[dalvik]]></category><category><![CDATA[plt]]></category><category><![CDATA[relocation]]></category><category><![CDATA[relocation table]]></category><category><![CDATA[symtab]]></category><category><![CDATA[strtab]]></category><dc:creator><![CDATA[Simone Margaritelli]]></dc:creator><pubDate>Mon, 04 May 2015 17:35:13 GMT</pubDate></item></channel></rss>