{"id":139,"date":"2015-04-02T01:05:36","date_gmt":"2015-04-02T05:05:36","guid":{"rendered":"https:\/\/www.ccrossan.com\/?p=139"},"modified":"2015-04-17T19:53:52","modified_gmt":"2015-04-17T23:53:52","slug":"april-fools-day-2015-whats-in-pandoras-box","status":"publish","type":"post","link":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/","title":{"rendered":"April Fools Day 2015 &#8211; What&#8217;s in Pandora&#8217;s Box"},"content":{"rendered":"\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=crossan007\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n<h1>The Idea<\/h1>\n<p>So, I&#8217;ve seen the\u00a0<a href=\"http:\/\/www.ex-parrot.com\/pete\/upside-down-ternet.html\">Upside-Down-Ternet<\/a>\u00a0many times, and I began thinking&#8230;How can I leverage this idea on one of my wife&#8217;s favorite websites &#8211; Pandora.<\/p>\n<p>She listens to Pandora for a good part of the day from our home internet connection&#8230; Perfect! I can set up a transparent http proxy, and manipulate requests for Pandora as they come through.<\/p>\n<p>Now, what should I play? \u00a0 <a href=\"https:\/\/www.youtube.com\/watch?t=16&amp;v=astISOttCQ0\" target=\"_blank\">This <\/a>of course. And may more things. \u00a0And maybe\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=aEi_4Cyx4Uw\">What does the spleen do?<\/a><\/p>\n<h1>The Implementation<\/h1>\n<h2>Determining an &#8220;attack vector&#8221;<\/h2>\n<p>I fired up Chrome&#8217;s developer tools while listening to a pandora stream, and was quite pleasantly surprised: the audio is transferred over HTTP (correct &#8211; no encryption), in MP3 format. (And I discovered a little too late that the Pandora ONE Player will play audio\/mp3 streams, while the free pandora player will only play audio\/mp4 streams &#8211; This is important later on!) \u00a0How easy this will be! \u00a0All I&#8217;ll need to do is watch for the \u00a0specially crafted URL requesting resources from http:\/\/audio-*.pandora.com\/ (and *.p-cdn.com) access and respond accordingly &#8211; In this case, with an mp3 pre-staged on my intercepting server.<\/p>\n<h2><\/h2>\n<h2>Base Environment<\/h2>\n<p>My &#8220;host&#8221;\u00a0in this scenario is a VM running on Hyper-V on my Windows 8.1 Desktop. \u00a0The VM is running Ubuntu 14 as a guest OS, and has \u00a02 cores with 256 MB ram, and one network adapter.<\/p>\n<h2>Phase 1: Configuring Squid3 &amp; iptables<\/h2>\n<p><a href=\"http:\/\/wiki.squid-cache.org\/Features\/Redirectors\" target=\"_blank\">Squid3 <\/a>is a proxy server that supports something called &#8220;transparent mode.&#8221; \u00a0In conjunction with <a href=\"http:\/\/www.netfilter.org\/documentation\/HOWTO\/packet-filtering-HOWTO-7.html\" target=\"_blank\">iptables<\/a>, squid can be a very effective <a href=\"http:\/\/dansguardian.org\/\" target=\"_blank\">content filter<\/a>, caching proxy, or the perfect tool to carry out an April fools prank.<\/p>\n<p>In this scenario, we&#8217;ll be setting up our linux machine to &#8220;Masquerade&#8221; as the machines that will be passing traffic\u00a0to (through) it. In much the same manner as\u00a0how your existing home router works: You have one <a href=\"https:\/\/www.ietf.org\/rfc\/rfc1918.txt\">public IP address<\/a>,\u00a0and all of the requests from computers within your network (using <a href=\"https:\/\/www.ietf.org\/rfc\/rfc1918.txt\">private IP addresses<\/a>) \u00a0appear to come from that one public IP. This is called <a href=\"http:\/\/computer.howstuffworks.com\/nat.htm\">NAT<\/a>.<\/p>\n<p>Since this linux machine will facilitate the transfer of all traffic from the &#8220;victim&#8221; machines to the internet, It&#8217;s in the perfect location to identify (and manipulate) Pandora requests.<\/p>\n<p>OK, OK, enough theory, let&#8217;s get some code<\/p>\n<h3>Iptables<\/h3>\n<ol>\n<li>Enable ip_forwarding (this is temporary, and will go away after a reboot of the \u00a0&#8220;host&#8221; machine)\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">echo 1 &amp;gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/pre>\n<\/li>\n<li>Configure iptables to pass traffic (Never configure it this way if you&#8217;re actually building an edge device. \u00a0Since all of my devices &#8211; both &#8220;host&#8221; and &#8220;victim&#8221; machines are on the same physical network, I took some liberties with security)\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">iptables -F\r\niptables -t nat -F\r\niptables -P INPUT ACCEPT\r\niptables -P OUTPUT ACCEPT\r\niptables -P FORWARD ACCEPT<\/pre>\n<\/li>\n<li>Next, we need to tell iptables to &#8220;masquerade,&#8221; or that is to &#8220;NAT&#8221; the traffic that comes from the local subnet, and is destined for the internet.\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">iptables -t nat -A POSTROUTING -s 172.16.9.0\/24 -j MASQUERADE<\/pre>\n<\/li>\n<li>Great, but what about our prank? \u00a0 Let&#8217;s explicitly redirect traffic destined for the IP segment owned by Pandora (you can find this using whois)\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">iptables -t nat -A PREROUTING -d 208.85.40.0\/21 -p tcp --dport 80 -j DNAT --to-destination 172.16.9.155:3128<\/pre>\n<\/li>\n<\/ol>\n<h3>Squid3<\/h3>\n<ol>\n<li>First, install squid using your favorite packaging tooapt-get install squid3<\/li>\n<li>Configure Squid. \u00a0I&#8217;ve taken the liberty of trimming down the config file as thin as possible for this scenario. \u00a05 lines!\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">redirect_program \/home\/administrator\/pandora.pl\r\nhttp_access allow all\r\nhttp_port 3128 transparent\r\nstrip_query_terms off\r\ncoredump_dir \/var\/spool\/squid3<\/pre>\n<\/li>\n<li>Next, we need to write the redirect_program. \u00a0Having not actually read the Squid3 documentation, and surmising based on operation &#8211; This is loaded at the time the Squid3 service is started, and continually runs in the background. \u00a0Squid3 then passes URLs from clients into the script through the pipeline. \u00a0The script then passes a URL back to Squid3. \u00a0In this circumstance, we use some regex to identify all requests for a Pandora song (<em>http:\/\/audio.*?pandora\\.com<\/em> and\u00a0<em>http:\/\/.*\\.p-cdn\\.com<\/em>)\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">#!\/usr\/bin\/perl\r\nuse strict;\r\n$| = 1;\r\nwhile (&amp;lt;&amp;gt;) {\r\nmy @elems = split;\r\nmy $url = $elems[0];\r\nif ($url =~ m#^http:\/\/audio.*?pandora\\.com#i) {\r\n$url = &quot;http:\/\/172.16.9.155\/test.mp4&quot;;\r\nprint &quot;$url\\n&quot;;\r\n}\r\nif ($url =~ m#^http:\/\/.*\\.p-cdn\\.com#i) {\r\n$url = &quot;http:\/\/172.16.9.155\/test.mp4&quot;;\r\nprint &quot;$url\\n&quot;;\r\n}\r\nelse{\r\nprint &quot;$url\\n&quot;;\r\n}\r\n}<\/pre>\n<\/li>\n<li>Restart Squid3\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">service squid3 restart<\/pre>\n<\/li>\n<\/ol>\n<h3>Apache2<\/h3>\n<p>Since we&#8217;re actually replacing the song in Pandora with a &#8220;payload&#8221; track, we need some way of hosting this audio. \u00a0Additionally, we need the host to respond with the &#8220;payload&#8221; track for <i>any and all incoming requests<\/i>. \u00a0Queue: Apache mod_rewrite.<\/p>\n<ol>\n<li>Edit the\u00a0 \/etc\/apache2\/sites-enabled\/000-default.conf file, and add these three lines. \u00a0This causes any inbound HTTP requests to return the test.mp4 file (with the correct MIME association, so as not to break &#8220;free&#8221; Pandora)\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">RewriteEngine on\r\nRewriteRule .* \/test.mp4\r\nAddType audio\/mp4 .mp4<\/pre>\n<\/li>\n<li>Place the test.mp4 file at \/var\/www\/html<\/li>\n<\/ol>\n<h2>Phase 1.5: Test Proof of Concept<\/h2>\n<ol>\n<li>Set a host on the LAN to use the afforementioned box as a default gateway.<\/li>\n<li>Launch Pandora<\/li>\n<li>Validate that only the payload song\u00a0will play.<\/li>\n<\/ol>\n<h2>Phase 2: Deploy to LAN<\/h2>\n<p>I have a standard FiOS router as my default gateway, and the device does not give total control over the DHCP server settings. \u00a0Of particular interest here is the <em>option routers\u00a0<\/em>parameter. \u00a0This allows the DHCP server to dictate to the clients\u00a0<em>what IP address they should use as a default gateway<\/em>. \u00a0Obviously if this prank is going to affect more than my sandbox, I need the other devices on the LAN to pass all of their traffic through the &#8220;host&#8221;<\/p>\n<h3>Configure isc-dhcp-server<\/h3>\n<ol>\n<li>Install isc-dhcp-server using your favorite package manager\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">apt-get install isc-dhcp-server<\/pre>\n<\/li>\n<li>modify the lines below in the <em>\/etc\/dhcp\/dhcpd.conf<\/em> file. \u00a0Define some hosts if you&#8217;d like to exclude them from the prank. \u00a0All hosts with a\u00a0<em>host<\/em>\u00a0block will be issued an IP in the\u00a0<em>deny unknown clients<\/em>\u00a0pool: \u00a0this is not; however, what determines their gateway, but rather the\u00a0<em>options routers<\/em> clause in the\u00a0<em> host\u00a0<\/em> block. \u00a0 One very important thing here is to set the lease time rather low. \u00a0I don&#8217;t want this prank to cause some random device to get an IP and hold onto it for the default of 8 days. Bumblebee happens to be my desktop:\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">option domain-name &quot;ccrossan.com&quot;;\r\noption domain-name-servers 172.16.9.1,8.8.8.8,8.8.4.4;default-lease-time 100;\r\nmax-lease-time 100;\r\n\r\nhost bumblebee\r\n{\r\nhardware ethernet 00:24:8C:93:7C:EE;\r\nfixed-address 172.16.9.100;\r\noption routers 172.16.9.1;\r\n}subnet 172.16.9.0 netmask 255.255.255.0\r\n{\r\noption routers 172.16.9.155;\r\n\r\npool {\r\ndeny unknown clients;\r\nrange 172.16.9.100 172.16.9.150;\r\noption routers 172.16.9.1;\r\n}\r\npool\r\n{\r\nallow unknown clients;\r\nrange 172.16.9.200 172.16.9.250;\r\noption routers 172.16.9.155;\r\n}<\/pre>\n<\/li>\n<li>Re-start the DHCP\u00a0server<\/li>\n<li>Disable DHCP on the FiOS router.<\/li>\n<li>Watch hilarity ensue as users launch Pandora in their browsers only to hear your specially selected track!<\/li>\n<\/ol>\n<p>Thanks for reading. \u00a0If you stuck with it this far, you&#8217;re a trooper.<\/p>\n<p>Please leave any comments or suggestions you may have below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Idea So, I&#8217;ve seen the\u00a0Upside-Down-Ternet\u00a0many times, and I began thinking&#8230;How can I leverage this idea on one of my wife&#8217;s favorite websites &#8211; Pandora. She listens to Pandora for a good part of the day from our home internet connection&#8230; Perfect! I can set up a transparent http proxy, and manipulate requests for Pandora &hellip; <a href=\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">April Fools Day 2015 &#8211; What&#8217;s in Pandora&#8217;s Box<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[62],"tags":[63,68,25,69,64,66,65,67,70],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"April Fools Day 2015 - What&#039;s in Pandora&#039;s Box - Charles&#039; Blog\" \/>\n<meta property=\"og:description\" content=\"The Idea So, I&#8217;ve seen the\u00a0Upside-Down-Ternet\u00a0many times, and I began thinking&#8230;How can I leverage this idea on one of my wife&#8217;s favorite websites &#8211; Pandora. She listens to Pandora for a good part of the day from our home internet connection&#8230; Perfect! I can set up a transparent http proxy, and manipulate requests for Pandora &hellip; Continue reading April Fools Day 2015 &#8211; What&#8217;s in Pandora&#8217;s Box &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/\" \/>\n<meta property=\"og:site_name\" content=\"Charles&#039; Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-02T05:05:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-04-17T23:53:52+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"crossan007\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/crossan007.dev\/blog\/#website\",\"url\":\"https:\/\/crossan007.dev\/blog\/\",\"name\":\"Charles&#039; Blog\",\"description\":\"SharePoint | PowerShell | Exchange | SCCM | Ubuntu | PHP | JavaScript | A\/V Live Production | More...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/crossan007.dev\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/#webpage\",\"url\":\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/\",\"name\":\"April Fools Day 2015 - What's in Pandora's Box - Charles&#039; Blog\",\"isPartOf\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/#website\"},\"datePublished\":\"2015-04-02T05:05:36+00:00\",\"dateModified\":\"2015-04-17T23:53:52+00:00\",\"author\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979\"},\"breadcrumb\":{\"@id\":\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/crossan007.dev\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"April Fools Day 2015 &#8211; What&#8217;s in Pandora&#8217;s Box\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979\",\"name\":\"crossan007\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/crossan007.dev\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g\",\"caption\":\"crossan007\"},\"url\":\"https:\/\/crossan007.dev\/blog\/author\/crossan007\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/","og_locale":"en_US","og_type":"article","og_title":"April Fools Day 2015 - What's in Pandora's Box - Charles&#039; Blog","og_description":"The Idea So, I&#8217;ve seen the\u00a0Upside-Down-Ternet\u00a0many times, and I began thinking&#8230;How can I leverage this idea on one of my wife&#8217;s favorite websites &#8211; Pandora. She listens to Pandora for a good part of the day from our home internet connection&#8230; Perfect! I can set up a transparent http proxy, and manipulate requests for Pandora &hellip; Continue reading April Fools Day 2015 &#8211; What&#8217;s in Pandora&#8217;s Box &rarr;","og_url":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/","og_site_name":"Charles&#039; Blog","article_published_time":"2015-04-02T05:05:36+00:00","article_modified_time":"2015-04-17T23:53:52+00:00","twitter_misc":{"Written by":"crossan007","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/crossan007.dev\/blog\/#website","url":"https:\/\/crossan007.dev\/blog\/","name":"Charles&#039; Blog","description":"SharePoint | PowerShell | Exchange | SCCM | Ubuntu | PHP | JavaScript | A\/V Live Production | More...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/crossan007.dev\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/#webpage","url":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/","name":"April Fools Day 2015 - What's in Pandora's Box - Charles&#039; Blog","isPartOf":{"@id":"https:\/\/crossan007.dev\/blog\/#website"},"datePublished":"2015-04-02T05:05:36+00:00","dateModified":"2015-04-17T23:53:52+00:00","author":{"@id":"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979"},"breadcrumb":{"@id":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/crossan007.dev\/blog\/fun\/april-fools-day-2015-whats-in-pandoras-box\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/crossan007.dev\/blog\/"},{"@type":"ListItem","position":2,"name":"April Fools Day 2015 &#8211; What&#8217;s in Pandora&#8217;s Box"}]},{"@type":"Person","@id":"https:\/\/crossan007.dev\/blog\/#\/schema\/person\/bd99569cd81332c8fd866d023848b979","name":"crossan007","image":{"@type":"ImageObject","@id":"https:\/\/crossan007.dev\/blog\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fff72c74fb6a0da29accf0db83ad4b4b?s=96&d=mm&r=g","caption":"crossan007"},"url":"https:\/\/crossan007.dev\/blog\/author\/crossan007\/"}]}},"_links":{"self":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts\/139"}],"collection":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/comments?post=139"}],"version-history":[{"count":13,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/posts\/139\/revisions\/167"}],"wp:attachment":[{"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/media?parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/categories?post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crossan007.dev\/blog\/wp-json\/wp\/v2\/tags?post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}