{"id":589,"date":"2016-01-03T16:48:43","date_gmt":"2016-01-03T14:48:43","guid":{"rendered":"http:\/\/valentijn.sessink.nl\/?p=589"},"modified":"2020-06-27T09:04:01","modified_gmt":"2020-06-27T07:04:01","slug":"upside-downternet-v2-0","status":"publish","type":"post","link":"https:\/\/valentijn.sessink.nl\/?p=589","title":{"rendered":"Upside Downternet v2.0"},"content":{"rendered":"\n<p>I&#8217;ve always wanted to implement <a title=\"the original upside-down-ternet by Pete Stevens\" href=\"http:\/\/www.ex-parrot.com\/pete\/upside-down-ternet.html\">upside-down-ternet<\/a>, but lacked the resources. But now it&#8217;s 2016 and you can make your wifi-stealing-neighbour&#8217;s web browser do all the hard work. This means that a simple OpenWRT router will have enough power to flip the internet &#8211; all of it, except for the ssl-protected areas. <\/p>\n\n\n\n<p><strong>Update 2019\/2020: this site is SSL-protected as well &#8211; as is most of the internet. Sorry, but upsidedownternet, being CSS or otherwise, won&#8217;t do much anymore.<\/strong><\/p>\n\n\n\n<!--more-->\n\n\n\n<p>If you&#8217;re hanging around long enough, you probably remember &#8220;Upside-Down-Ternet&#8221;, a very clever way to (sort of) protect your wireless internet against your neighbours &#8211; if they&#8217;re not from Australia, that is.<\/p>\n\n\n\n<p>Back in the day, you had to download all the images on a page, rotate them 180 degrees (with imagemagick or another scripted image editor) and then serve them to the client (the web browser) again. To be able to do that, you needed storage space and processing power, which pretty much ruled out using OpenWRT. But now it&#8217;s 2016, and turning images upside down would, obviously, be a better job for your neighbour&#8217;s web browser&#8217;s CSS handling routines. For this, a simple search-and-replace in the HTML code is sufficient.<\/p>\n\n\n\n<p>Here&#8217;s what you&#8217;ll need:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>a Linux-system that is able to run &#8220;<a title=\"We'll use Privoxy for modifying web page data\" href=\"http:\/\/www.privoxy.org\/\">privoxy<\/a>&#8220;. OpenWRT is just fine for that. Feel free to use heavier machinery, but a simple sub-\u20ac100 router is just what you need.<\/li><li>Command line access to this machine.<\/li><li>Eh, that&#8217;s it. Pretty much. Yeah, some knowledge of Linux config file editing will help you.<\/li><\/ul>\n\n\n\n<p>Also, please note, again, that it&#8217;s 2016 and in the 10 years since the original Upside-Down-ternet, a lot has changed in web site security. If a web page is SSL-based, like many of the larger sites nowadays, you won&#8217;t be able to spoof it&#8217;s content. Most notably, Google is SSL-only, which means you can&#8217;t flip Google search results. Sorry. Think you can? Read&nbsp;<a href=\"https:\/\/www.blackhat.com\/presentations\/bh-dc-09\/Marlinspike\/BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf\">BlackHat-DC-09-Marlinspike-Defeating-SSL.pdf<\/a> and think again.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>There&#8217;s an upside to 2016 as well, which is Unicode. You can semi-flip anything you want by using <a title=\"The original homograph example from 2005\" href=\"https:\/\/groups.yahoo.com\/neo\/groups\/qalam\/conversations\/messages\/3855\">Unicode &#8220;homographs&#8221;<\/a>. And yes, since SSID&#8217;s can be Unicode, your new wifi-network can have an upside down name.<\/p>\n\n\n\n<p>So let&#8217;s start flipping the Internet. In the text below, we&#8217;ll use &#8220;openwrt.example.com&#8221; as your OpenWRT url. First, we&#8217;ll install Privoxy. After that, we&#8217;ll add a wifi-subnet to proxy through it. Finally, we&#8217;ll configure Privoxy. We do it this way to make sure installing Privoxy works &#8211; otherwise this blog could make for a whole lot of useless configuration editing.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Go to openwrt.example.com\/cgi-bin\/luci\/admin\/system\/packages and install privoxy. Better not install luci-app-privoxy or its&#8217; cousins, I won&#8217;t use it.<\/li><li>Go to openwrt.example.com with SSH and see if you can login and look around. Is \/etc\/privoxy\/ there? Is \/etc\/config\/privoxy there?<\/li><\/ol>\n\n\n\n<p>Did that work? Good. Let&#8217;s configure the network:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Add a new wireless SSID. Go to openwrt.example.com\/cgi-bin\/luci\/admin\/network\/wireless, click &#8220;Add&#8221;. Now a very funny thing is, that ESSID&#8217;s can be Unicode these days. This means, that you can name your new Wifi-station &#8220;\u0287\u01ddu\u0279\u01dd\u0287u\u028dop\u01ddp\u0131sdn&#8221;, &#8220;\u026fos\u0279\u01ddpu\u0250&#8221;, &#8220;\u025fdo\u029e u\u01ddp \u025fn\u0250&#8221;, &#8220;u\u01dd\u028coq\u01dd\u0287s\u0279\u01ddpuo&#8221; or whatever you can think of.<\/li><li>On this same page, there is a list of networks, right under &#8220;Interface Configuration&#8221;. Choose &#8220;create&#8221; here and name your new network. Let&#8217;s call it &#8220;upsidedown&#8221;.<\/li><li>Set any wireless options you would like to set, then click &#8220;save&#8221; or &#8220;save and apply&#8221;.<\/li><li>Go to openwrt.example.com\/cgi-bin\/luci\/admin\/network\/network\/upsidedown. Change &#8220;unmanaged&#8221; to &#8220;static address&#8221; and add an IP-address. For example, use 10.171.205.7 with 255.255.255.0 as netmask. Click &#8220;save&#8221; &#8211; do this before clicking the DHCP stuff or your changes will be lost. So do click &#8220;save&#8221;, then click &#8220;setup DHCP server&#8221;. Click &#8220;save&#8221; again &#8211; the defaults are fine.<\/li><li>Now go to the tab &#8220;firewall settings&#8221; and click &#8220;unspecified or create&#8221;. Name the new zone &#8220;upsidedown&#8221;. Click &#8220;save&#8221;.<\/li><li>Go to openwrt.example.com\/cgi-bin\/luci\/admin\/network\/firewall\/forwards\/ to create a new port forward. Any TCP-traffic heading for port 80 will be redirected to Privoxy, so add a rule named <em>upsidedown-privoxy<\/em>, protocol <em>TCP<\/em>, external zone <em>upsidedown<\/em>, external port <em>80<\/em>, internal zone <em>upsidedown<\/em>, internal IP address <em>10.171.205.7<\/em> (the one we used in step 4), internal port <em>8118<\/em> (the default for Privoxy). Click <em>Add<\/em>.<\/li><li>Go to openwrt.example.com\/cgi-bin\/luci\/admin\/network\/firewall\/rules\/ and add a forward rule to enable traffic to https-sites. Yes, that&#8217;s the downside of upside-down: in order for the user to experience some sort of internet, you will probably need to enable some sort of https access. Alternatively, you could try to redirect search traffic intended for Google (which is https-only) to bing.com (which is http), but that is left as an excercise to the reader. So add a forward rule with the name of <em>upsidedown-ssl<\/em>, source zone <em>upsidedown<\/em>, destination zone <em>wan<\/em> (or whatever you call your internet), click <em>add and edit<\/em>.<\/li><li>Change protocol to TCP, enter 443 for destination port and click save. There should be a rule now that says &#8220;<small>Any TCP From <var>any host<\/var> in <var>upsidedown<\/var> To <var>any host<\/var>, port <var>443<\/var> in <var>wan<\/var><\/small>&#8221; which has <i>accept forward<\/i> for action.<\/li><\/ol>\n\n\n\n<p>All right, we&#8217;re done here. Click &#8220;save and apply&#8221; somewhere. Now the only thing we need to configure is Privoxy.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>&nbsp;Log into your router and go to <em>\/etc\/config\/<\/em> to edit <em>privoxy<\/em>. Add &#8211; actually replace &#8211; the following lines. Replacing means, that any other occurence of <em>filterfile<\/em>, <em>actionsfile<\/em>, <em>listen_address<\/em> etcetera should be commented out or deleted:\n<pre>list filterfile 'upsidedown.filter' \nlist actionsfile 'upsidedown.action'\nlist listen_address '10.171.205.7:8118'\noption accept_intercepted_requests '1'\nlist permit_access '10.171.205.0\/24'<\/pre>\n<\/li><li>Go to <em>\/etc\/privoxy\/<\/em> and add a file named <em>upsidedown.filter<\/em>. In it:\n<pre>FILTER: upsidedown Replace &lt;head....&gt; with &lt;head...&gt;&lt;style&gt;...&lt;\/style&gt;\ns|(&lt;head[^&gt;]*&gt;)|$1&lt;style&gt;body{transform: rotate(180deg);}&lt;\/style&gt;|i<\/pre>\n<\/li><li>Add another file to \/etc\/privoxy\/, this time <em>upsidedown.action<\/em>:\n<pre>{ +filter{upsidedown} }\n\/<\/pre>\n<\/li><li>Start privoxy by typing\n<pre>\/etc\/init.d\/privoxy enable; \/etc\/init.d\/privoxy restart<\/pre>\n<\/li><\/ol>\n\n\n\n<p>That should be all! Now connect to your new wifi-network and see if it works. Reload this site and check, is it upside down?<\/p>\n\n\n\n<p><strong>2019\/2020 Update: this site is https now and you won&#8217;t be able to rotate it using http interception&#8230; sorry!<\/strong><\/p>\n\n\n\n<p>Oops. It isn&#8217;t. Please check.<\/p>\n\n\n\n<p><style>#upsidedown{transform:rotate(180deg);}<\/style><\/p>\n\n\n\n<div id=\"upsidedown\">Cool! It works! Now for some final notes.\n<p>&nbsp;<\/p>\n<ol>\n<li>As said before, https-sites won&#8217;t turn upside down and you won&#8217;t be able to fix that easily. We&#8217;re doing MITM here and that&#8217;s simply getting too hard for the average user or sysadmin.<\/li>\n<li>A second remark is regarding the CSS I&#8217;m using. I am by no means a web programmer of any kind. This means that my replacement filter probably isn&#8217;t good enough. Drop me a line if you know better and I&#8217;ll see what I can do. Yes, I&#8217;ve read about all the -moz-translate, -webkit-translate and the like, I thought just using translate would be enough so that&#8217;s what I&#8217;m using.<\/li>\n<li>I only accept port 80 and port 443 and that is on purpose. So this network will not let you use any other protocols, it will just serve 443 and 80. Should you want to provide some sort of Free Public Wifi, then enable everything from zone <i>upsidedown<\/i> to zone <i>wan<\/i> and leave out the special rule for https.<\/li>\n<li>Please like the <a href=\"https:\/\/www.facebook.com\/upsidedownternet2.0\/\">Facebook page<\/a>.<\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve always wanted to implement upside-down-ternet, but lacked the resources. But now it&#8217;s 2016 and you can make your wifi-stealing-neighbour&#8217;s web browser do all the hard work. This means that a simple OpenWRT router will have enough power to flip the internet &#8211; all of it, except for the ssl-protected areas. Update 2019\/2020: this site&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,3,22],"tags":[110,9,112,111],"class_list":["post-589","post","type-post","status-publish","format-standard","hentry","category-diversen","category-happy-hacking","category-vrije-software","tag-hacking","tag-linux","tag-openwrt","tag-upsidedownternet"],"_links":{"self":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts\/589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=589"}],"version-history":[{"count":31,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts\/589\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=\/wp\/v2\/posts\/589\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/valentijn.sessink.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}