<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[HowNetWorks - Medium]]></title>
        <description><![CDATA[Empowering people by exposing the Internet’s inner workings. - Medium]]></description>
        <link>https://medium.com/hownetworks?source=rss----e956d1ce543---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>HowNetWorks - Medium</title>
            <link>https://medium.com/hownetworks?source=rss----e956d1ce543---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:44:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/hownetworks" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How did I turn my Browser into a Port Scanner? Tricksy but doable]]></title>
            <link>https://medium.com/hownetworks/how-did-i-turn-my-browser-into-a-port-scanner-tricksy-but-doable-c37db85f9adc?source=rss----e956d1ce543---4</link>
            <guid isPermaLink="false">https://medium.com/p/c37db85f9adc</guid>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ossi Herrala]]></dc:creator>
            <pubDate>Tue, 10 Jan 2017 14:30:58 GMT</pubDate>
            <atom:updated>2017-01-10T14:29:00.723Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern web browsers are full of features. It’s possible to watch movies, listen to music, and make phone and video calls with just a few clicks. Some of these features can also be used for things not intended in the design. This text describes one of those unintended usages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b50l4_wC3sb2WeoRTStn7A.gif" /><figcaption>Port scanning from browser in action!</figcaption></figure><p>What makes real-time voice and video calls possible? Much of it is thanks to <a href="https://en.wikipedia.org/wiki/WebRTC">WebRTC</a> (Web Real-Time Communication), a collection of protocols and programming interfaces in modern browsers. Of particular interest for us are protocols named <a href="https://en.wikipedia.org/wiki/STUN">STUN</a> (Session Traversal Utilities for NAT) and <a href="https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT">TURN</a> (Traversal Using Relays around NAT).</p><p>In a nutshell, STUN is a simple query from browser to server. Browser asks “what’s my IP address?” and the server returns what it thinks your IP is. This helps the browser set up a browser-to-browser channel for real-time communication. This feature was also used in security flaw named <a href="https://en.wikipedia.org/wiki/DNS_leak"><em>DNS leak</em></a>. TURN is an extension to STUN, for example allowing browser to proxy real-time communications via a compatible TURN server. Usually STUN is used over the UDP protocol and TURN over the TCP protocol.</p><p>And we can also use these tools to run a port scan from the browser. Awesome! But, there’s always a but. It’s not possible to scan a random target. This works only against a dedicated server. Both TCP and UDP port scans are possible and the process of scanning is quite simple: Use browser’s WebRTC capabilities to send STUN/TURN requests to server using different server port each time and observe the results. We just need JavaScript to be ran on browser and a dedicated STUN/TURN server to be contacted.</p><h4>Why not just use HTTP(S) requests?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DwL0yFM6KHC2t-2vT3aBHA.png" /><figcaption>Screenshot of Safari’s error message saying “Not allowed to use restricted network port”.</figcaption></figure><p>We asked the same thing! It would be so much simpler than TURN for TCP scanning. But as it turns out, browsers don’t allow HTTP connections to arbitrary TCP ports. And HTTP doesn’t cover UDP.</p><p>For the curious, Chromium source has a list of <a href="https://chromium.googlesource.com/chromium/src/+/ba78b86d7b4ef5140ef9838d41ca471b3075ef32/net/base/port_util.cc">restricted ports</a>. The list contains mostly the ports users would probably like to see port scanned.</p><h3>How is this browser port scan thingie even useful?</h3><p>Browser based port scanning can be used to test Internet connectivity. Is there a firewall blocking some TCP or UDP ports? If Teamspeak, Jabber or IRC client can’t connect, where is the fault? Browser can provide a second opinion.</p><p>We also found out that at least one router intercepted DNS requests (UDP port 53) and didn’t allow STUN through (but DNS worked fine). Another router crashed when performing the scan. This comes in handy when we attempt to detect devices modifying your packets on your path to the Internet.</p><p>The implementation is left as an exercise to the reader. Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c37db85f9adc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hownetworks/how-did-i-turn-my-browser-into-a-port-scanner-tricksy-but-doable-c37db85f9adc">How did I turn my Browser into a Port Scanner? Tricksy but doable</a> was originally published in <a href="https://medium.com/hownetworks">HowNetWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[URI:telegram]]></title>
            <link>https://medium.com/hownetworks/uri-telegram-b71b843ce196?source=rss----e956d1ce543---4</link>
            <guid isPermaLink="false">https://medium.com/p/b71b843ce196</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[telegram]]></category>
            <dc:creator><![CDATA[jviide]]></dc:creator>
            <pubDate>Mon, 21 Nov 2016 16:05:39 GMT</pubDate>
            <atom:updated>2016-11-22T13:29:27.276Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>TL;DR:</strong> Update Telegram’s macOS clients to version 2.28 or newer. Earlier versions leak URLs from secret chats. NCSC-FI has released an <a href="https://www.viestintavirasto.fi/en/cybersecurity/vulnerabilities/2016/haavoittuvuus-2016-135.html">advisory in English</a>.</p><p><strong><em>Updated 2016–11–22:</em></strong><em> Added a link to the English language advisory.</em></p><p>The <a href="https://medium.com/hownetworks/uri-teller-a-call-for-the-curious-20694617db1c">previous</a> blog post describes the reasons why we created <a href="https://uriteller.io/">URI:teller</a>. Around October 26 our very own Jani Kenttälä (<a href="https://medium.com/u/cb820947f08e">janikenttala</a>) was putting URI:teller through its paces by testing the bajillion different messengers he has installed on his Mac. One of those apps was <a href="https://telegram.org/">Telegram’s</a> macOS client. That particular client fetched link previews via an external Telegram server, even for <a href="https://telegram.org/faq#secret-chats">secret chats</a> which are supposed to be end-to-end encrypted. Uh-oh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ULK9CqcGnHjKIMKNfBMGRw.gif" /><figcaption>Jani and Ossi demonstrating the effect with Telegram macOS 2.27.51100.</figcaption></figure><p>We promply reported this to Juhani Eronen of <a href="https://www.viestintavirasto.fi/en/cybersecurity.html">NCSC-FI</a>. Based on NCSC-FI’s additional testing the macOS client was alone in leaking URLs from secure chats, other official Telegram mobile/desktop clients did not do so. NCSC-FI in turn contacted Telegram, who issued a fix in the client version 2.28. The update is now available from <a href="https://macos.telegram.org/">Telegram’s website</a> and the <a href="https://telegram.org/dl/macos/store">Mac App Store</a>.</p><p>Check NCSC-FI’s <a href="https://www.viestintavirasto.fi/en/cybersecurity/vulnerabilities/2016/haavoittuvuus-2016-135.html">advisory in English</a>. We thank both NCSC-FI and Telegram for their quick actions on this issue. And of course Jani will get a magnificent bonus for his heroic effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oi--TZUl11tWBZNPR_wXcQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b71b843ce196" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hownetworks/uri-telegram-b71b843ce196">URI:telegram</a> was originally published in <a href="https://medium.com/hownetworks">HowNetWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[URI:teller & a Call for the Curious]]></title>
            <link>https://medium.com/hownetworks/uri-teller-a-call-for-the-curious-20694617db1c?source=rss----e956d1ce543---4</link>
            <guid isPermaLink="false">https://medium.com/p/20694617db1c</guid>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[jviide]]></dc:creator>
            <pubDate>Thu, 03 Nov 2016 09:29:34 GMT</pubDate>
            <atom:updated>2016-11-03T09:36:11.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUhaWO1v1Sr5b09RfYY7yw.png" /></figure><p>Last friday we quietly rolled out a new service called <a href="https://uriteller.io/">URI:teller</a>. When I say “quietly” I don’t count our friends whom we immediately spammed with links to <a href="https://uriteller.io/">uriteller.io</a>. Sorry about that, friends! #notsorry</p><h3>URI:what?</h3><p>We built URI:teller to scratch a specific itch: Verifying that end-to-end encrypted messaging apps don’t leak links we exchange via chats.</p><p>A major selling point of end-to-end encrypted (<a href="https://en.wikipedia.org/wiki/End-to-end_encryption">E2EE</a>) chat apps is that only the intended recipient can decrypt the data. No outsider, indeed not even those controlling the app’s central servers, should be able to read your messages. One could reasonably assume that absolutely nothing sent over the private pipeline leaks out. <a href="https://whispersystems.org/">Signal</a>, <a href="https://www.whatsapp.com/">WhatsApp</a> and <a href="https://wire.com/">Wire</a> are well known examples, with new contenders springing up all the time.</p><p>On the other hand most of these apps offer link previews. Enter a URL and up pops a sneak peek of its contents. How <em>do</em> secure chats achieve this without inadvertently revealing parts of the messages — the links — to a third party?</p><p>And this is what URI:teller can help to figure out. By clicking the big blue button on the front page you create a pair of unique URLs, a <strong>trap</strong> and a <strong>monitor</strong>. The monitor URL leads to a page showing a live-updating list of who’s visited the trap URL. Copy and paste the trap to your E2EE messenger of choice and follow the monitor to see who’s calling back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*_uR9n6xbOAunq2mHAEYS9Q.gif" /><figcaption>Demoing URI:teller with <a href="https://bitly.com/">bitly</a>. Yeah, bitly’s a URL shortener and not an E2EE messenger. Sorry. As a result our animated GIF department has been fired.</figcaption></figure><h3>Pick Your Battles</h3><p>Thus far our main focus has been in instant messaging. It’s a huge part of our daily lives as JavaScript-writing, latte-sipping digital monad nomads who are just totally <em>with it</em>.</p><p>There are other delicious uses for URI:teller. Some URL shorteners follow passed links, as do social media sites. How enterprise messengers such as Skype or Cisco deal with links is also worth looking into — there’s some <a href="http://arstechnica.com/security/2013/05/think-your-skype-messages-get-end-to-end-encryption-think-again/">historical precedent</a> there. Oh, and don’t forget <a href="https://en.wikipedia.org/wiki/Data_loss_prevention_software">DLP</a>, another fan favorite in enterprise contexts.</p><p>Still, secure messaging is a topical target for scrutiny. E2EE communication is getting attention in the mainstream. Just now, while writing this blog post, Time featured Signal in their <a href="http://time.com/4549647/best-apps-year-2016/">list</a> of 50 best apps of the year. Electronic Frontier Foundation is also about to redo their <a href="https://www.eff.org/secure-messaging-scorecard">secure messaging scorecard</a>. Amnesty International recently came out with an <a href="https://www.amnesty.org/en/latest/campaigns/2016/10/which-messaging-apps-best-protect-your-privacy/">article</a> scoring chat apps based on their privacy… ness.</p><p>URI:teller presents one angle for such evaluation. Someone who needs to pick or recommend a messaging option can use the service to make a slightly more educated choice.</p><h3>A Plea for Help</h3><p>Now we need help. We have checked the apps we are personally interested in, and are ready to move on to new adventures. These artisanal lattes don’t pay for themselves! But the matter of the fact is that the world is full of systems which URI:teller could be applied to.</p><p>We ask of you, brave net warriors, go forth and pit URI:teller against the multitude of chat apps, enterprise messaging platforms, DLPs, you name it. If you find anything interesting do tell us and the world about it — tweets with the hashtag <a href="https://twitter.com/hashtag/uriteller">#uriteller</a> are a great avenue for that. You have no obligation to inform us, though.</p><p>Another way to contribute is to take a gander at the repository at <a href="https://github.com/HowNetWorks/uriteller">https://github.com/HowNetWorks/uriteller</a>. The service is developed in the open and the code is MIT licensed. Learn from our mistakes, maybe even fix them! Our aim has also been to make it relatively simple to spin up your own URI:teller instance. Who knows, maybe someone will run with this idea and take it even further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMwaPS7mF6tDe81AJOxdBQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20694617db1c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hownetworks/uri-teller-a-call-for-the-curious-20694617db1c">URI:teller &amp; a Call for the Curious</a> was originally published in <a href="https://medium.com/hownetworks">HowNetWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t waste cycles with modulo bias!]]></title>
            <link>https://medium.com/hownetworks/dont-waste-cycles-with-modulo-bias-35b6fdafcf94?source=rss----e956d1ce543---4</link>
            <guid isPermaLink="false">https://medium.com/p/35b6fdafcf94</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[openbsd]]></category>
            <category><![CDATA[random]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Ossi Herrala]]></dc:creator>
            <pubDate>Wed, 02 Nov 2016 09:58:41 GMT</pubDate>
            <atom:updated>2016-11-02T09:42:10.821Z</atom:updated>
            <content:encoded><![CDATA[<p>TL;DR Use proper function to generate uniform random values (like arc4random_uniform()) instead of fighting against modulo bias yourself.</p><p>Today, after reading <a href="https://paragonie.com/blog/2016/05/how-generate-secure-random-numbers-in-various-programming-languages">a blog post about generating random numbers in various programming languages</a>, my brain told me I don’t remember how modulo bias happens and how not to be biased.</p><p>I skimmed through two Google hits (<a href="https://zuttobenkyou.wordpress.com/2012/10/18/generating-random-numbers-without-modulo-bias/">here</a> and <a href="https://www.mindstick.com/Interview/22779/why-do-people-say-there-is-modulo-bias-when-using-a-random-number-generator">here</a>, go read them to refresh your knowledge about modulo bias) and the former had this example code to produce uniform random numbers between 0 and n-1:</p><pre>int x;</pre><pre>do {<br>    x = rand();<br>} while (x &gt;= n);</pre><pre>return x;</pre><p>rand() function computes pseudo-random integers between 0 and MAX_RAND (in my OS X MAX_RAND is 0x7fffffff, or 2147483647 in decimal).</p><p>What happens if I want to do a simple dice roll of six sided die (random value from range 0 to 5)? Above example keeps generating and testing new random values until it hits number smaller than six, discarding all values from range 6 to 2147483647. Probability to find one per iteration is about 0.000000279%. It might take a while to find one.</p><p>OpenBSD, famous for it’s high quality source code, offers a function called arc4random_uniform() for generating uniformly distributed random values between 0 and n–1. See the s<a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/crypt/arc4random_uniform.c">ource code</a> and <a href="http://man.openbsd.org/arc4random_uniform">manual page</a>. Here’s snippet of that code:</p><pre>uint32_t r, min;</pre><pre>min = -upper_bound % upper_bound;</pre><pre>for (;;) {<br>    /* arc4random() is OpenBSD&#39;s rand() on steroids */<br>    r = arc4random();<br>    if (r &gt;= min) break; <br>}<br> <br>return r % upper_bound;</pre><p>Now, there’s a clever trick in that small snippet. For our dice roll example (upper_bound = 6) we can calculate (unsigned 32 bit arithmetic here):</p><pre>min = -6 % 6 = (2^32 - 6) % 6 = 4</pre><p>and then in the for loop we get random number and discard only values where <a href="http://man.openbsd.org/arc4random">arc4random()</a> returns number smaller than min (in this case we discard values 0, 1, 2 and 3). Now the probability to get good hit on first iteration of loop is super high. Awesome.</p><p>Now go and stop wasting time with modulo bias like I did this morning :) Or continue further with…</p><h3>Testing it in practice</h3><h4>Naive way</h4><pre>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;</pre><pre>int uniform(int n) {<br>    int x;</pre><pre>    do {<br>        x = rand();<br>    } while (x &gt;= n);</pre><pre>    return x;<br>}</pre><pre>int main() {<br>    int r = uniform(6);<br>    printf(&quot;%d\n&quot;, r);<br>}</pre><p>Ten runs with the above code results average run time of 6.7 seconds. Really expensive dice rolls!</p><h4>OpenBSD way</h4><pre>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;</pre><pre>uint32_t uniform(uint32_t upper_bound) {<br>    uint32_t r, min;</pre><pre>    min = -upper_bound % upper_bound;</pre><pre>    for (;;) {<br>        r = arc4random();<br>        if (r &gt;= min) break;<br>    }</pre><pre>    return r % upper_bound;<br>}</pre><pre>int main() {<br>    uint32_t r = uniform(6);<br>    printf(&quot;%d\n&quot;, r);<br>}</pre><p>Ten runs with above code completes with average time of 0.00 seconds. Much better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35b6fdafcf94" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hownetworks/dont-waste-cycles-with-modulo-bias-35b6fdafcf94">Don’t waste cycles with modulo bias!</a> was originally published in <a href="https://medium.com/hownetworks">HowNetWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dnsnitch knows Your name servers, do you?]]></title>
            <link>https://medium.com/hownetworks/dnsnitch-knows-your-name-servers-do-you-f03b6d28f4c?source=rss----e956d1ce543---4</link>
            <guid isPermaLink="false">https://medium.com/p/f03b6d28f4c</guid>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[domain-names]]></category>
            <dc:creator><![CDATA[Ossi Herrala]]></dc:creator>
            <pubDate>Sun, 30 Oct 2016 20:52:27 GMT</pubDate>
            <atom:updated>2016-11-01T20:21:15.401Z</atom:updated>
            <content:encoded><![CDATA[<p>Almost every article about DNS tells it’s the “Internet’s Phonebook”. DNS translates human comprehensible names (like “medium.com”) into numeric IP addresses (“104.16.123.127”). DNS means Domain Name System and the servers are commonly called name servers. Clever or not, but sadly IP address doesn’t mean “Internet Phonebook Address”.</p><p>However, DNS is more than phone book to translate names into numbers. It’s big decentralised network of independent machines around the world building a big tree of knowledge giving names and other information to every device connected to the internet. DNS is important. It’s as important as your contacts in your mobile phone. Do you remember your significant other’s phone number? Or your mother’s? No? Do you know the IP address of any of the web pages you use daily? No? DNS is important.</p><p>If you have simple home or office network setup, you probably have one name server helping your day-to-day life inside that small modem or router box. If you look into your computer’s network settings there’s probably mention about name server with it’s IP address (maybe something like “192.168.1.1”). This is your networks name server which serves your humble home network and it’s needs for naming information. However, how does that humble “192.168.1.1” know name of everything in internet?</p><p>Your small humble name server must connect to other name servers with desperate need for information. It might be using the free alternatives like Google’s or OpenDNS’s name servers, or it might connect to your internet service provider’s name servers.</p><p>I got curious. Who are the actors in the huge tree of knowledge called DNS? When I go to Youtube for my daily doze of Simon’s Cat or other feline related education, who (in the field of DNS servers) know I went there?</p><p>dnsnitch is a small prototype to determine who are the last DNS servers to contact web page I visit. Here’s what it looks like on my laptop when using OpenDNS:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*C0bG03dfdqng1qviWE3FFQ.gif" /><figcaption>dnsnitch in action when browser is using OpenDNS</figcaption></figure><p>Just the information I wanted.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f03b6d28f4c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hownetworks/dnsnitch-knows-your-name-servers-do-you-f03b6d28f4c">dnsnitch knows Your name servers, do you?</a> was originally published in <a href="https://medium.com/hownetworks">HowNetWorks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>