<?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[Stories by Nate Bush on Medium]]></title>
        <description><![CDATA[Stories by Nate Bush on Medium]]></description>
        <link>https://medium.com/@BushMinusZero?source=rss-b2ac0a3c5fb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4uCZQWtOBcjXi3SkuKtHHA.png</url>
            <title>Stories by Nate Bush on Medium</title>
            <link>https://medium.com/@BushMinusZero?source=rss-b2ac0a3c5fb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:42:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@BushMinusZero/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Site Is HTTPS, So I’m Safe, Right?]]></title>
            <link>https://medium.com/better-programming/the-site-is-https-so-im-safe-right-fc452ce79da7?source=rss-b2ac0a3c5fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc452ce79da7</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Nate Bush]]></dc:creator>
            <pubDate>Tue, 23 Aug 2022 14:40:16 GMT</pubDate>
            <atom:updated>2022-08-23T17:19:16.337Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Site Is HTTPS, so I’m Safe, Right?</h3><h4>You might assume you don’t need to worry about man-in-the-middle (MITM) attacks, but what about phone apps or embedded websites?</h4><figure><img alt="anakin skywalker: beware of mitm. Padmé (smiling): the website is https, so i’m safe, right? anakin: staring at her. Padmé: right? (not smiling anymore)" src="https://cdn-images-1.medium.com/max/500/0*WpDD4PJqDexQJWhT.jpg" /><figcaption>imgflip.com</figcaption></figure><h3>What is a man-in-the-middle attack?</h3><p>Public internet connections are inherently unsafe because of the risk of a MITM attack. I’m not saying that you should never use public wifi connections. Still, next time you are at Starbucks or the airport, you should be extra careful to take precautions like VPNs and avoid visiting websites that might expose sensitive personal information. If you regularly travel, consider investing in a <a href="https://www.pcmag.com/picks/the-best-mobile-hotspots">portable wifi hotspot</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*iVaIJTs0mIgzOKrbhEULgw.png" /><figcaption>Local man-in-the-middle attack on public wifi</figcaption></figure><p>How does the MITM attack work?</p><ol><li>The attacker performs an ARP poisoning (e.g., ARP spoofing) attack, which maps the wifi router’s IP address to the mac address of the attacker’s machine. Now the traffic of unsuspecting users will be sent to the attacker instead. This attack is straightforward to execute if the attacker is also connected to the same wifi router.</li><li>A user requests a web server but unknowingly is communicating with the attacker’s machine. The attacker can read the request headers and unencrypted requests.</li><li>The attacker forwards the user’s request to the web server. The web server is unaware an attack is taking place.</li><li>The web server processes the user’s request. Again, the attacker can read the response headers and unencrypted traffic.</li><li>The attacker forwards the response from the web server to the user. The web page will load normally for the user as if the attacker did not exist.</li></ol><p>At this point, an attacker has successfully inserted themselves in between you and the web server. The most often recommended solution mitigation to the risk of MITM is to avoid websites that don’t use TLS (e.g., websites that don’t use HTTPS). But when you load an HTTPS website, a series of web requests are made to load HTML, CSS JavaScript, images, and other assets, but those are not guaranteed to be HTTPS.</p><p>Fortunately, for most modern browsers, including Google Chrome, we don’t need to worry about this <a href="https://security.googleblog.com/2019/10/no-more-mixed-messages-about-https_3.html">since release 81</a>. After this change in 2020, if you visit an HTTPS website, Chrome will automatically upgrade HTTP requests to HTTPS and block them if the upgrade fails. This setting is configurable for each website since some websites might not support automatic upgrading traffic to HTTPS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*XrUz6k1k4mRHs2LwxUSYRA.png" /><figcaption>Screenshot navigating to Site settings in Chrome</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*5rLvpMPOeRT9ADoeWqCIOg.png" /><figcaption>Screenshot of how to toggle on/off the insecure content setting in Chrome</figcaption></figure><p>Take a look at this example website. Try loading with and without the insecure content setting enabled (if you are on a secure connection, of course). The URL is here:</p><p><a href="https://googlesamples.github.io/web-fundamentals/fundamentals/security/prevent-mixed-content/active-mixed-content.html">Active mixed content example</a></p><p>If you open Chrome dev tools and navigate to the network panel, you can see nine additional requests for content after the initial HTTPS request, and three of those requests (highlighted in red) are not secure.</p><p>These are called mixed content websites since loading the entire webpage requires making both HTTP and HTTPS requests. Fortunately, most browsers already prevent loading behind-the-scenes HTTP content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*2B2Lfcbo9A3cw8yEazHAgQ.png" /><figcaption>Screenshot of the network panel in Chrome developer tools blocking three HTTP requests</figcaption></figure><p>If these requests weren’t blocked and left unencrypted, your data could be at serious risk because the lack of encryption leaves you vulnerable to a MITM attack. We’ve discussed how a MITM attack works, but what can an attacker do after they nefariously place their system “in the middle”? Here are a couple of exploits:</p><ol><li>Data exposure: the attacker can view unencrypted content, which might contain private information. Even if it does not contain personal information, the nature of the data could expose the user to unwanted scrutiny about their private lives and, in some regimes, be used to censor or limit civil liberties. For example, passive contents like images are not always requested with HTTPS. Still, if the attacker intercepts images from religious, dating, or pornographic websites, then they can learn personal information used to victimize the user.</li><li>Code injection: the attacker replaces benign web content with malicious content. In the example above, since the simple-example.js was unencrypted, the attacker could replace the code with arbitrary JavaScript. Injecting malicious JavaScript could be used to exploit other system vulnerabilities, such as simply extracting data or compromising the user’s browser and potentially their entire system.</li></ol><h3>The Top 4 Most Popular Browsers Are Secure!</h3><p>Today, Chrome, Safari, Edge, and Firefox, on the most recent versions, are secure against man-in-the-middle attacks when visiting websites secured by HTTPS because they prevent the mixed content MITM exploit described above.</p><p>However, if you are in the 8% that use Samsung Internet, Opera, or UC Browser, then I’m sorry — you’ll need to verify for yourselves. The main risk is in the long-tail of browsers categorized below as “Other.” Because they have much lower investment and scrutiny, I wouldn’t assume they have adopted recent security features like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LlwuRvlUuaQcKcDhZiL27A.png" /><figcaption><a href="https://gs.statcounter.com/browser-market-share#monthly-202107-202207-bar">StatCounter browser market share over the last year</a></figcaption></figure><p>For example, the UC Browser downloads JavaScript and runs it immediately without warning if you visit the same active mixed content URL from above. The full title of the app is <a href="https://play.google.com/store/apps/details?id=com.UCMobile.intl&amp;hl=en_US&amp;gl=US">UC Browser-Safe, Fast, Private</a>. It’s not safe and not private if there is an attacker in your network. The UC Browser accounts for almost 1% of browsers globally and <a href="https://gs.statcounter.com/browser-market-share/all/china/#monthly-202107-202207-bar">about 12% of users in China</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Yg-3UQfn9xD4-bgdmZQY7Q.png" /><figcaption>Screenshot of <a href="https://play.google.com/store/apps/details?id=com.UCMobile.intl&amp;hl=en_US&amp;gl=US">UC Browser-Safe, Fast, Private</a> on Android</figcaption></figure><h3>Are Android and iOS Applications Secure?</h3><p>Not necessarily! You might not be as secure as you think, whether you pass the time, thumb jamming to some flappy bird or tower defense game, or browsing mind-numbing social media apps. Communication from your iOS or Android applications to their app’s web server is not guaranteed to be secured by TLS.</p><p>Both Apple and Google strongly encourage developers to implement security best practices, but they allow developers to opt out of guaranteed HTTPS security. Unlike your Chrome browser in the example above, these settings are controlled by the developers, not the user.</p><p>Both Apple and Google allow the developer to configure the application to communicate unencrypted and in the clear. iOS refers to this as an “exception,” implying that this might not be allowed perpetually.</p><p>The <a href="https://developer.android.com/guide/topics/manifest/application-element#usesCleartextTraffic">Android security documentation of this configuration</a>:</p><blockquote>Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP. The default value for apps that target API level 27 or lower is &quot;true&quot;. Apps that target API level 28 or higher default to &quot;false&quot;.</blockquote><p>Here is a similar <a href="https://www.hackingwithswift.com/example-code/system/how-to-handle-the-https-requirements-in-ios-with-app-transport-security">article documenting the process for iOS</a>.</p><h3>Let’s Find an Example on Android!</h3><p>Inspecting network traffic on Android isn’t as straightforward as Chrome tools on a desktop client. I can’t merely open the network tab in Chrome developer tools to inspect traffic. It requires significant effort to set up, so I won’t go into detail here. Leave a comment if you would be interested in an article on the topic.</p><p>First, I downloaded and set up the <a href="https://portswigger.net/burp/communitydownload">Burp Suite security testing toolkit</a> by PortSwigger, which has a free commercial edition with slightly limited capabilities. I connected an Android device to my MacBookPro with a USB cable and configured an HTTPS proxy. You can follow <a href="https://blog.nviso.eu/2020/11/19/proxying-android-app-traffic-common-issues-checklist">this tutorial on proxying Android application traffic</a> for detailed setup instructions.</p><p>Essentially, I’m performing a MITM attack on my android phone except by using a USB cable instead of ARP spoofing like in the earlier example.</p><p>Without any prior research, I searched for and downloaded several unpopular news apps from the Google Play Store. After three attempts, I got a hit. The application “<a href="https://play.google.com/store/apps/details?id=info.newsapps.russianews&amp;hl=en_US&amp;gl=US">Russia News | Russia &amp; World News Headlines</a>” almost exclusively communicates over HTTP. Check out the traffic below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*VKLGE9EOFb3u3CZqfPebzw.png" /><figcaption>Screenshot of Burp Suite intercepting traffic from the “Russia News | Russia &amp; World News Headlines” android application as of August 21, 2022</figcaption></figure><p>Note that there were no security warnings when downloading or loading content within the application. An attacker running a MITM attack on my network would be capable of intercepting, reading, and modifying any of these requests.</p><h3>What Can One Do?</h3><p>Great, apps are not necessarily secure. Excellent, it’s not clear which applications are safe and which ones aren’t. You shouldn’t be expected to perform an in-depth security analysis before putting an app into your regular scrolling rotation. There are two things you should be doing:</p><ol><li>Only use trusted networks. Should you connect to the wifi at your local dive bar? Maybe not. If you need internet on your laptop while traveling, use your phone as a hotspot, or buy a portable wifi hotspot.</li><li>Download a trusted VPN and leave it on… always. ExpressVPN, NordVPN, etc. There are many options. Do some research and pick one that is best for you.</li><li>Avoid in-app browsers. Besides security, if you value your privacy, then you should be avoiding them anyway. See “<a href="https://www.theverge.com/2022/8/19/23312725/in-app-browser-tracking-facebook-instagram-privacy-tool">This site exposes the creepy things in-app browsers from TikTok and Instagram might track</a>.”</li></ol><h3>Wrap Up</h3><p>I hope this article somewhat demystifies MITM as an attack, where the attack surface lies, and how you can protect yourself. You might have found it surprising that android and iOS applications are not as secure as browsing in your web browser. I’m looking forward to future security improvements for Android and iOS.</p><p>I suspect they are working to eliminate these vulnerabilities and protect users by requiring that all application traffic be HTTPS. However, this might take time since applications often call out third-party services that may not support HTTPS. Until then, use VPNs and stay safe.</p><p>And let me know if I missed anything. I guarantee I did.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc452ce79da7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/the-site-is-https-so-im-safe-right-fc452ce79da7">The Site Is HTTPS, So I’m Safe, Right?</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Which NLP Task Does NOT Benefit From Pre-trained Language Models?]]></title>
            <link>https://pub.towardsai.net/which-nlp-task-does-not-benefit-from-pre-trained-language-models-90430ed1207e?source=rss-b2ac0a3c5fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/90430ed1207e</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[machine-translation]]></category>
            <dc:creator><![CDATA[Nate Bush]]></dc:creator>
            <pubDate>Thu, 18 Aug 2022 16:02:37 GMT</pubDate>
            <atom:updated>2022-08-18T19:31:25.229Z</atom:updated>
            <content:encoded><![CDATA[<p>There is such a long history of pre-trained general language representation models with a massive impact that we take for granted that they are a completely 100% necessary foundation for all NLP tasks. There were two separate step function innovations that pushed the accuracy of all NLP tasks forward: (1) statistical language models like Word2Vec and GloVe and, more recently, (2) neural language models like <a href="https://arxiv.org/pdf/1810.04805.pdf">BERT</a>, <a href="https://arxiv.org/abs/1802.05365">ELMo</a>, and recently <a href="https://huggingface.co/bigscience/bloom">BLOOM</a>. Inserting pre-trained neural language models at the beginning of a modeling workflow is <strong><em>almost</em></strong> guaranteed to increase performance, but there is at least one situation where it does not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*_ERKOXAe1WKiKvY8SBGQ9Q.png" /><figcaption>Sidebar: why the sesame street theme?!</figcaption></figure><h3>Named Entity Recognition (NER)</h3><p>Look no further than the original BERT paper titled “<a href="https://arxiv.org/pdf/1810.04805.pdf">BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding</a>” to see a detailed analysis of how pre-trained BERT embeddings improve NER performance in section 5. The BERT diagram below shows a typical machine learning workflow for exploiting any language model for general NLP tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*n2ckqoZ-PXgtd8VcZODncg.png" /><figcaption>Source: <a href="https://arxiv.org/pdf/1810.04805.pdf">https://arxiv.org/pdf/1810.04805.pdf</a> — Overall pre-training and fine-tuning procedures for BERT</figcaption></figure><p>The papers also show significant improvement on Question Answering (QA) evaluated against <a href="https://rajpurkar.github.io/SQuAD-explorer/">SQUAD</a>, and a hodgepodge of natural language understanding (NLU) tasks called <a href="https://openreview.net/pdf?id=rJ4km2R5t7">GLUE</a>.</p><h3>Entity Disambiguation (ED)</h3><p>The global ED task also achieved new state-of-the-art results across multiple datasets using BERT. See the related work section of this “<a href="https://arxiv.org/pdf/1909.00426.pdf">Global Entity Disambiguation with BERT</a>” for a rundown of various workflows for applying BERT as a preprocessing step for ED.</p><h3>Extractive Summarization (ES)</h3><p>A simple variant of BERT achieving once again state-of-the-art performance on several ES datasets can be found in “<a href="https://arxiv.org/pdf/1903.10318.pdf">Fine-tune BERT for Extractive Summarization</a>”.</p><h3>Sentiment Analysis (SA)</h3><p>Once again, sentiment analysis is equally graced by the existence of BERT language models in the recent paper “<a href="https://arxiv.org/abs/2201.03382">BERT for Sentiment Analysis: Pre-trained and Fine-Tuned Alternatives</a>”.</p><p>I could keep going… but I won’t. The glory of pre-trained language models is obvious. We only need to stand on the shoulders of giants who spent countless hours preparing massive corpora of data, deploying expensive GPUs to pre-train these models for us. These models aren’t a silver bullet, though.</p><p>The main natural language task that has failed to show consistent performance improvements from sesame street and friends is <strong><em>Neural Machine Translation (NMT)</em></strong>.</p><h3>NMT usually doesn’t benefit from Pre-trained language models</h3><p>It’s difficult to find papers that discuss why it doesn’t work, and it’s easy to imagine why. Writing papers about what doesn’t work is not very popular… and unlikely to gain recognition or be frequently quoted. Ah shoot — so why am I writing this article again?</p><p>I found one paper that covered this topic: “<a href="https://arxiv.org/pdf/1804.06323.pdf"><strong>When and Why are Pre-trained Word Embeddings Useful for Neural Machine Translation?</strong></a><strong>” </strong>and it was an interesting read. They break NMT down into two categories of tasks:</p><ol><li>NMT for low-resource languages</li><li>NMT for high-resource languages</li></ol><p>What they mean by <strong><em>low/high</em></strong> resource language is in reference to the size of the parallel corpus that can be obtained. For the world&#39;s most popular languages, it can be easy to find open-source large parallel corpora online. The largest such repository is <a href="https://opus.nlpl.eu/">OPUS</a>, the Open Parallel Corpus, which is an amazing resource for any machine learning engineer looking to train NMT models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*r-KehZVUzzfh2xypQeQz7Q.png" /><figcaption>Source: <a href="https://opus.nlpl.eu/">OPUS</a> - high resource parallel corpus between English (en) and Chinese (zh)</figcaption></figure><p>The image above shows that the open parallel corpus between English and Chinese has 103 million parallel sentences or 172K parallel documents. But what if you wanted to train an NMT model to translate Farsi to Chinese? In that case, you only have 6 million parallel sentences from 517 documents to work with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*5XxAnMEChA3kB9wjqBcv7Q.png" /><figcaption>Source: <a href="https://opus.nlpl.eu/">OPUS</a> - low resource parallel corpus between Farsi (fa) and Chinese (zh)</figcaption></figure><p>As you might expect, low-resource languages benefit from pre-trained language models and are able to achieve better performance when fine-tuning the embeddings while back-propagating errors through the NMT network. <strong>Surprisingly, however, for high-resource languages, the effect of using pre-trained language models as a pre-processing step before NMT model training does NOT result in performance gains.</strong></p><p>It’s critical to point out that language models only make sense to use for machine translation if they are trained on both source and target language (for example, Chinese and English in the first example). These are commonly referred to as multilingual embedding models or language agnostic embeddings. They are able to achieve the interesting result that words in multiple languages achieve similar vector representations in the embedding space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*ioG0y5gTgOrQzOJF_OzIBw.png" /><figcaption>Source: <a href="https://ai.googleblog.com/2020/08/language-agnostic-bert-sentence.html#:~:text=A%20multilingual%20embedding%20model%20is,semantic%20information%20for%20language%20understanding.">AI Googleblog</a></figcaption></figure><p>But how are multilingual language models trained? Turns out they are trained over the exact same data as NMT: a massive parallel corpus between the source and target language. So, is there a fundamental shortcoming to language models that prevent them from being effective for this NLP task? No, language models use the same data as NMT models, and they are both built from the same powerhouse building block: the transformer.</p><p>To review, language models and NMT are trained over the same data, using very similar fundamental architectures. When you consider the similarities, there isn’t really anything new that the language models are bringing to the table so it shouldn’t be surprising to you that BERT, ELMo, ERNIE, and our other sesame street friends aren’t appearing in NMT papers touting huge breakthroughs in model performance.</p><p>A skeptical reader will likely be able to poke holes in this explanation. There are certainly devisable use cases were training an LM on a large parallel corpus but then training BERT + NMT workflow on a much smaller corpus would intuitively result in performance gains. But I think it’s unlikely that a serious deep learning engineer would attempt to build an NMT model without all available data at their disposal… outside of purely academic curiosities.</p><p>I tip-toed over some hairy details, so I recommend reading <a href="https://arxiv.org/pdf/1804.06323.pdf">the original paper</a> if you’re interested!</p><p>I hope you enjoyed this short exploration into the intuition behind what makes NLP algorithms successful. Please like, share, and follow for more deep learning knowledge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90430ed1207e" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/which-nlp-task-does-not-benefit-from-pre-trained-language-models-90430ed1207e">Which NLP Task Does NOT Benefit From Pre-trained Language Models?</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Observing Russia Diverting Internet Traffic in Occupied Ukraine]]></title>
            <link>https://medium.com/@BushMinusZero/observing-russia-diverting-internet-traffic-in-occupied-ukraine-1789a4a1351c?source=rss-b2ac0a3c5fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/1789a4a1351c</guid>
            <category><![CDATA[ukraine]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[russia-ukraine-war]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Nate Bush]]></dc:creator>
            <pubDate>Tue, 16 Aug 2022 05:38:13 GMT</pubDate>
            <atom:updated>2022-08-16T05:38:13.665Z</atom:updated>
            <content:encoded><![CDATA[<p>Many of us are on the edge of our seats, closely tracking the ongoing invasion of Ukraine. Not surprisingly, a significant part of this war is happening in the information space on News, Television, Facebook, Telegram, and Twitter. Russia is fighting a hybrid war; boots on the ground in Ukraine coupled with <a href="https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RE4Vwwd">deployment of cyberattacks</a> against Ukraine and their allies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*gfDI4-BN8qdH3f3T-w5dIA.png" /><figcaption><a href="https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RE4Vwwd">https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RE4Vwwd</a></figcaption></figure><p>Recent articles, like <a href="https://www.nytimes.com/interactive/2022/08/09/technology/ukraine-internet-russia-censorship.html">this NYT article</a> and <a href="https://www.reuters.com/world/europe/russia-reroutes-internet-traffic-occupied-ukraine-its-infrastructure-2022-05-02/">this Reuters article</a>, have uncovered how Russia has hijacked internet in occupied territories of Ukraine to route traffic through Moscow, instead of through Kyiv and western Europe, as was previously the case. Presumably, Russia will capitalize on this move by monitoring and censoring internet to and from these territories. So far there haven’t been reports of DNS poisoning, IP geo-blocking, or man-in-the-middle injection or monitoring but it’s definitely feasible.</p><p>There are some parallels to the Great Firewall (GFW) of China. All internet traffic going in or out of China must flow through hardware operated by the Cyberspace Administration of China (CAC), which is under the control of the CCP. One of the functions of the firewall is to selectively prevent content from being accessed. Russia now has a similar arrangement with occupied Ukraine. Although Chinese censorship methods have been extensively studied, we do not yet know the full capabilities of Russian censorship. But Russian government is not subtle with its use of cyber attacks and misinformation so I suspect we will learn more soon.</p><p>It’s essential that the open internet be preserved so people can connect with one another and exchange ideas freely and without fear of retaliation. A first step to internet preservation is knowing when internet freedom is being threatened. Perhaps a more critical step is democratizing the knowledge of how the internet actually works, how censorship works, and how to circumvent censorship systems.</p><p>I thought it would be interesting to reproduce, at least partially, the conclusions of these articles and share with people a quick and dirty analysis of internet censorship in progress. To understand the analysis you need to understand, at least vaguely, the Internet Protocol and Internet Control Message Protocol.</p><p>Traceroute… traces the route your internet traffic would take between client and server. In a simplified sense, the internet is composed of a network of sparsely interconnected servers. Each server is only connected to a few other servers. The traceroute tool tracks which servers you must “hop” to in order to reach your desired destination (e.g. a web server hosting the website you typed in your browser).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*b365kcvgImc2XXljVZLKUg.png" /><figcaption><a href="https://blog.paessler.com/what-you-need-to-know-about-traceroute">https://blog.paessler.com/what-you-need-to-know-about-traceroute</a></figcaption></figure><p>The path it takes is not 100% deterministic. IP relies on routing algorithms like Open Shortest Path First (OSPF) and Routing Information Protocol (RIP) which takes into account number of hops, size of packets and/or metadata in the request header at each router in the path. The path can also be restricted by telecommunications infrastructure to determine which routers can be used by the algorithm. More information on IP routing:</p><ul><li><a href="https://www.cloudflare.com/learning/network-layer/what-is-routing/">What is routing?</a></li><li><a href="https://blog.paessler.com/what-you-need-to-know-about-traceroute">What do you need to know about traceroute?</a></li></ul><p>In the next section I run a traceroute in occupied Ukraine.</p><p>The general approach I took was this:</p><p><strong>1. Identify IP addresses in currently occupied territories of Ukraine.</strong> To do this I would need a Geolocation to IP service that allows me to search for a geolocation and return IP addresses (most do the inverse of this). I downloaded <a href="https://db-ip.com/db/lite.php">db-ip’s free IP geolocation database</a> and filtered by city names.</p><pre>import pandas as pd</pre><pre>col_names = [&#39;ip_start&#39;, &#39;ip_end&#39;, &#39;continent&#39;, &#39;country&#39;, &#39;stateprov&#39;, &#39;city&#39;, &#39;latitude&#39;, &#39;longitude&#39;]</pre><pre>df = pd.read_csv(PATH_TO_CSV, names=col_names, header=None)<br>df = df[df[&#39;country&#39;] == &#39;UA&#39;]<br>kherson = df[df[&#39;city&#39;] == &#39;Kherson (Korabelnyi district)&#39;]<br># Kherson has IPs from 188.191.145.0 to 188.191.145.255</pre><p>First we need to find IP addresses in that range that are actually in use. I ran through the range of IP addresses, pinging each one until I got a response.</p><p><strong>2. Map out the IP addresses used to route data into Kherson.</strong> Using a local VPN to change the starting point of my analysis, I ran a <a href="https://linux.die.net/man/8/traceroute">traceroute</a> command to track the route between my client and the server in Kherson.</p><pre>from subprocess import Popen, PIPE</pre><pre>p = Popen([&#39;traceroute&#39;, &#39;-m&#39;, &#39;50&#39;, host], stdout=PIPE)</pre><pre>while True:<br>    line = p.stdout.readline().decode()<br>    ...</pre><p>I’m skipping over the boring data parsing bits but I’ll post the code on Github. Here is the path the traffic took from Los Angeles, US to Kherson, UA. The first number is the hop number, skipping over local network and ignoring repeats. The second column is the IP address of each router between the client and the server. Not super interesting without so geo information.</p><pre>4 185.193.156.255<br>5 77.247.126.2<br>6 213.248.74.63<br>7 89.221.35.158<br>8 195.22.211.57<br>9 195.22.214.27<br>10 87.226.181.87<br>12 185.64.45.205<br>13 31.40.132.131<br>14 91.206.110.45<br>15 188.191.144.1<br>16 188.191.144.43</pre><p><strong>3. Lookup the geolocation of the IP addresses en route.</strong> I could have used the db-ip database for this but I wanted to cross check the geos with another source of information. IP geo data isn’t super accurate and free datasets can get out-of-date quickly. I used the <a href="https://app.ipgeolocation.io/">ipgeolocation.io</a> API to verify IP addresses returned by the <strong>traceroute</strong> command.</p><pre>import requests</pre><pre>response = requests.get(&#39;https://api.ipgeolocation.io/ipgeo&#39;, params={&#39;apiKey&#39;: IPGEOLOCATION_API_KEY, &#39;ip&#39;: ip})</pre><p>Finally, I used <a href="https://plotly.com/python/lines-on-maps/">plotly</a> to display the data on a map. You can see that it goes through Moscow and other servers in Russia… which verifies information from the news articles above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08K4F4ocuF3phEay5-pzLA.png" /><figcaption>traceroute map of IP geolocations from LA to Kherson</figcaption></figure><p>I repeated the same analysis with Kharkiv, another city under Russian occupation and it was interesting to see that internet traffic was not being routed through Russia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCsoMtw5YrjnzNAQVAI1pQ.png" /><figcaption>traceroute map of IP geolocations from LA to Kharkiv</figcaption></figure><p>It would be interesting to see a temporal analysis, from a wider range of IP addresses and geolocations (both source and destination IP addresses). There are companies that closely monitor the internet for network shifts. And not just security companies. Internet services companies that rely on fast streaming pay close attention to network algorithms, routing paths, and latency to optimize user experiences. What I’ve shown here is a very simple toy project compared to their capabilities.</p><p>Nonetheless, here is a Gist link to <a href="https://gist.github.com/BushMinusZero/3f907b19b555c8af0f4b7bd953322344">the full script</a>. Good luck.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1789a4a1351c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cuttlefish on ARM64 in AWS]]></title>
            <link>https://medium.com/@BushMinusZero/cuttlefish-on-arm64-in-aws-b1f60d937614?source=rss-b2ac0a3c5fb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1f60d937614</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[arm64]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Nate Bush]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 01:45:49 GMT</pubDate>
            <atom:updated>2022-08-13T16:59:46.984Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*7We5NJcmypwwCWz4BjPiig.jpeg" /><figcaption>Cuttlefish <a href="https://source.android.com/setup/create/cuttlefish">https://source.android.com/setup/create/cuttlefish</a></figcaption></figure><p>You want to create an automated test suite for your android app. Maybe you even want to streamline testing by executing tests within your CD/CI pipeline. Most companies, including Apple, Google, <a href="https://engineering.fb.com/2016/07/13/android/the-mobile-device-lab-at-the-prineville-data-center/">Facebook</a>, and Amazon, are (or were at some point — I’m hedging here) doing this with device farms — imagine racks of physical devices connected to powered USB hubs, controlled by a central workstation, and maintained by a team of engineers. This is hard work. Wouldn’t it be nice testing could move into the cloud?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nxwt-VPtEKlRrR2e" /><figcaption>Facebook device lab: <a href="https://techcrunch.com/2016/07/13/facebook-lifts-the-veil-on-its-mobile-device-lab/">https://techcrunch.com/2016/07/13/facebook-lifts-the-veil-on-its-mobile-device-lab/</a></figcaption></figure><p>There are some amazing cloud-based solutions for running tests remotely. In 2015, <a href="https://aws.amazon.com/device-farm/">the AWS device farm</a> was launched allowing developers to deploy across desktop browsers and real mobile devices; without having to manage testing infrastructure. Crazy awesome. Of course, there are similar services out there with overlapping features and lower price points.</p><p>Perhaps I have a unique use-case, but I was unable to find a cloud-based service that met the requirements of the the project I was working on. I wanted to run test automation software for an arm64 android app in the cloud, with root access to the device for running specific security test suites. The AWS device farm, although super frictionless, didn’t allow for the level of device setup required to perform automated security tests in the way I needed.</p><p>Enough about my project though. Let’s talk about the solution: setting up arm64 cuttlefish on AWS EC2 instances for running my arm64 android application. Before I share my development notes, I want to make a huge shoutout to Jun Sun for publishing the best Cuttlefish tutorials in existence: <a href="https://junsun.net/wordpress/2020/04/how-to-build-run-android-cuttlefish-emulator-on-aws/">How to build/run Android Cuttlefish emulator on AWS</a> and <a href="http://junsun.net/wordpress/2019/09/how-to-build-run-cuttlefish-on-pc-arm64/">How to Build/Run Android Cuttlefish Emulator on PC/ARM64</a>.</p><p>I was able to replicate Jun’s article for Ubuntu 20.04 and Ubuntu 22.04 on a1.metal EC2 instances, a more up-to-date Cuttlefish version, and connect with VNC with minor changes to his tutorial. But because those minor changes were hard-fought, tooth-and-nail victories, I thought them worth sharing.</p><h4>Step 1: Create an EC2 instance with the following properties</h4><ul><li><a href="https://aws.amazon.com/ec2/instance-types/a1/">a1.metal</a> (works on any *.metal EC2 instances)</li><li>arm64 enabled</li><li>Ubuntu 20.04 and Ubuntu 22.04 (both worked for me)</li><li>200 gb storage, depending on what you plan to do with these instances</li><li>setup SSH keys for easy access, of course</li></ul><h4>Step 2: Verify that KVM is available on your instance.</h4><p>If not, verify that you are running the current machine type. You can’t launch an emulator inside a VM unless KVM is enabled. <a href="https://www.linux-kvm.org/page/Main_Page">Why?</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5bc47490ae211fe0205eeaf2fed41df8/href">https://medium.com/media/5bc47490ae211fe0205eeaf2fed41df8/href</a></iframe><h4>Step 3. Setup x86_64 binaries</h4><p>Here are some interesting articles about multi-arch, in case that is new to you too: <a href="https://wiki.debian.org/Multiarch/HOWTO">Multiarch/HOWTO</a> and <a href="https://android.googlesource.com/device/google/cuttlefish/+/HEAD/multiarch-howto.md">Adjusting APT Sources for Multiarch</a>. The TL;DR is that you can modify your <strong>/etc/apt/sources.list</strong> file to instruct apt where to find packages, like so…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/620289cddd3c6e870c46b0d636ef4a85/href">https://medium.com/media/620289cddd3c6e870c46b0d636ef4a85/href</a></iframe><h4>4. Install <a href="https://go.dev/">Go</a></h4><p>This should install <strong>golang-1.18</strong>. Must be at least 1.18</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10cd1f117d65761e4b771a825f96f610/href">https://medium.com/media/10cd1f117d65761e4b771a825f96f610/href</a></iframe><h4>5. Download, build, and install the Cuttlefish host Debian package:</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4cebd8f4d02cbf012b120aa149908346/href">https://medium.com/media/4cebd8f4d02cbf012b120aa149908346/href</a></iframe><h4>6. Reboot after verifying SSH configs are OK</h4><pre># Add to /etc/ssh/sshd_config:<br>RSAAuthentication yes<br>PubkeyAuthentication yes</pre><pre># make sure permissions are correct<br>sudo chmod 700 ~/.ssh/<br>sudo chmod 600 ~/.ssh/*</pre><pre># now reboot<br>sudo reboot</pre><h4>7. Download and install CVD and an android image.</h4><ul><li>Follow steps 3 through 9 from <a href="https://android.googlesource.com/device/google/cuttlefish/">the Cuttlefish documentation</a></li><li>Downloaded the following from the Android <a href="http://ci.android.com/">Branch Grid</a></li></ul><h4>8. Launch CVD with a VNC server attached in a screen</h4><pre>screen<br>HOME=$PWD ./bin/launch_cvd -start_vnc_server</pre><h4>9. Connect with local VNC (replacing the necessary components)</h4><pre>ssh -i ~/.ssh/YOUR_SSH_KEY.pem -L 6444:127.0.0.1:6444 -C -N -l ubuntu YOUR_IP_ADDRESS</pre><p>Download JAR from <a href="https://www.tightvnc.com/download.php">Download TightVNC</a></p><pre>java -jar tightvnc-jviewer.jar -ScalingFactor=50 -Tunneling=no -host=localhost -port=6444</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*R0k7BZ3TGfRHXNzxbBevvg.png" /><figcaption>Screen capture of VNC feed connected to Cuttlefish emulator running in Arm64 on Android.</figcaption></figure><p>I would prefer to use WebRTC but I wasn’t able to get it working on arm64. I’m 99% sure that it doesn’t support arm64 arch so no surprise there. VNC is good enough… although it was removed as a launch_cvd option on the latest AOSP master, forcing folks to migrate toward WebRTC. Let me know if you can crack this!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1f60d937614" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>