<?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 umair nehri on Medium]]></title>
        <description><![CDATA[Stories by umair nehri on Medium]]></description>
        <link>https://medium.com/@umairnehri9747?source=rss-c6fa7a905fea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8Ds1-SCXtQD_ZX6Hkfxt4A.png</url>
            <title>Stories by umair nehri on Medium</title>
            <link>https://medium.com/@umairnehri9747?source=rss-c6fa7a905fea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:19:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@umairnehri9747/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[From Shodan to Visual Surveillance: Building an AI-Driven Camera Intelligence Tool with Claude]]></title>
            <link>https://medium.com/@umairnehri9747/shodan-ai-exposed-cameras-725b9a63ee5d?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/725b9a63ee5d</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-safety]]></category>
            <category><![CDATA[iot-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[shodan]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 16:33:32 GMT</pubDate>
            <atom:updated>2026-11-29T16:33:32.669Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Banner for the article: a cluster of CCTV cameras beside an AI icon, with the title “From Shodan to Visual Surveillance: Building an AI-Driven Camera Intelligence Tool with Claude”." src="https://cdn-images-1.medium.com/max/1024/1*YkzXEitIwJJe-5sB0S4_-A.png" /></figure><blockquote><strong><em>Research Notice:</em></strong><em> This project explores internet-exposed cameras identified through Shodan for security research and analysis. The investigation was limited to publicly indexed information. Any potentially sensitive or identifying details have been removed or obscured before publication.</em></blockquote><blockquote><em>The purpose of this write-up is to demonstrate the use of AI in cybersecurity research and raise awareness about IoT security risks. It is not intended to facilitate unauthorized access, compromise devices, or invade anyone’s privacy. If you have concerns regarding any published material, please reach out for review.</em></blockquote><h3>Backstory</h3><p>It had been a while since I last worked on a security research blog, and I was looking for something interesting to explore. While browsing Shodan one day for research related to my day job, an idea struck me: What if I could use AI to analyze and automatically tag the contents of internet-exposed cameras? What started as a small experiment soon turned into a rabbit hole, raising some interesting questions about the capabilities of AI, how easily its guardrails can be challenged, and the potential consequences when these technologies are applied to publicly exposed infrastructure. This article is my attempt to document some of these findings, explore how I leveraged Claude alongside locally hosted LLMs to bring the idea to life, and share just how far I was able to push the boundaries of AI-driven visual analysis.</p><h3>The Idea: What If AI Could See What Shodan Sees?</h3><p>I’ve spent quite some time playing around with Shodan, and one thing that has always fascinated me is the sheer amount of information that can be discovered about devices connected to the internet. You can find everything from industrial control systems and networking equipment to webcams and surveillance infrastructure.</p><p>But there is a difference between discovering a device and understanding what that device might be exposing.</p><p>A camera-related Shodan result might tell you something about the device, its service, and its network exposure. But what if you could take the visual information associated with it and have an AI model describe what was actually happening in the scene?</p><p>Could an LLM identify whether an image depicted a residential environment, a commercial establishment, a hospital, an industrial facility, or something else entirely? More importantly, could this be done at scale?</p><p>That was the question I wanted to explore.</p><p>My original intention was to use Claude to help build a tool that could analyse camera streams associated with Shodan-discovered devices. I wanted the application to retrieve visual information, pass it through a vision-language model, and return a description alongside relevant tags.</p><p>I approached Claude with the idea. And that is where things took an interesting turn.</p><h3>Claude Wasn’t Having It</h3><p>My first interaction with Claude about the idea didn’t go quite as I had expected. I explained what I wanted to build and why. The response was a refusal, with concerns around privacy, unauthorized surveillance, and the possibility that such a tool could be used to monitor people without their knowledge.</p><p>I could understand the reasoning. A tool that combines internet-wide device discovery with automated visual interpretation has obvious potential for misuse.</p><p>Instead of immediately focusing on the original camera-analysis objective, I began with a much narrower development task: building an image-analysis application. I wanted to use <a href="https://ollama.com/library/moondream">Moondream2</a>, a lightweight vision-language model, to examine an image and generate a description of what it could see. I also wanted it to assign relevant tags based on the contents of the image.</p><p>The application would essentially take an image, pass it to the model, and return something that looked like a human-readable description of the scene.</p><p>This was a relatively straightforward technical exercise, and Claude helped me get the initial implementation working. What I found interesting was that the development process was surprisingly smooth. I could describe what I wanted, review the generated implementation, identify what needed changing, and iterate. Before long, I had a working interface.</p><p>But the original idea was still sitting at the back of my mind.</p><h3>From an Image to a Camera</h3><p>Once I had the image-analysis component working, I started exploring how the same functionality could fit into the original camera-research concept.</p><p>There was an important difference between analysing a static image and analysing visual information over time.</p><p>A static image provides a snapshot. A camera stream potentially provides a continuous sequence of observations, allowing a model to generate context about what appears in a scene at different points in time.</p><p>I returned to Claude and introduced the camera-analysis scenario, initially framing it around a camera I claimed to own.</p><p>Claude proceeded to help with the requested development work.</p><p>This was an interesting moment in the experiment. The discussion had moved from a general image-analysis application towards a more specific camera-related use case. I was now looking at how the individual components could fit together into a single application.</p><p>And I wasn’t done experimenting.</p><h3>The Feature Creep Was Real</h3><p>Anyone who has spent time developing applications with AI coding assistants will probably understand what happened next. You get one feature working, and suddenly you have another idea. You ask the model to implement it, review the result, and then think of something else.</p><p>In my case, the application started expanding beyond its original image-description functionality. I began exploring recording-related features, the ability to examine visual analysis at different points in an authorized recording, and motion-detection functionality.</p><p>The interesting thing was how quickly the application was evolving. I wasn’t spending days independently implementing every component. Claude was helping me translate requirements into code in a matter of minutes, refine the interface, and work through implementation issues.</p><p>But there was a bigger issue emerging.</p><p>When you look at each feature independently, there are perfectly legitimate use cases for all of them. Image classification, video analysis, timestamp-based review, and motion detection are all established areas of computer vision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VjodnmzdWPN2XIUHX9We2A.png" /><figcaption>An example capability introduced through Claude that would let me record the stream from an exposed camera and make a timeline of any change in surroundings using AI</figcaption></figure><p>The problem becomes considerably different when you consider the original objective and the context in which those capabilities are being combined.</p><h3>Taking the Experiment to 400+ Exposed Cameras on the Internet</h3><p>Once the platform had taken shape, I wanted to examine a much larger research dataset.</p><p>I expanded my Shodan research to exposed cameras across the whole world. I examined more than 400 exposed cameras and used the locally hosted vision-language models to explore scene descriptions and categorization.</p><p>What I wanted was not just a model that could tell me there was a person or a vehicle in an image. I was interested in the broader context: what kind of environment was being depicted, what objects were present, and what general category could be assigned to the scene?</p><p>The results were considerably more varied than I had initially anticipated.</p><figure><img alt="Bar charts of 524 scans. Top countries: Korea 101, United States 47, Iran 38, Georgia 29, Thailand 29, Taiwan 27, Germany 25, Moldova 22. Top ports: 80 with 81 hosts, then 8081 and 9000 with 47 each." src="https://cdn-images-1.medium.com/max/1024/1*U-fWh9dpJX15Il4PeVAheA.png" /><figcaption>Where the 524 scans landed. Port 80 alone accounts for 81 hosts — the exposure is almost entirely default, unauthenticated HTTP.</figcaption></figure><h3>Some of the Things I Came Across Were Uncomfortable</h3><p>This was probably the point at which the experiment stopped feeling like just another interesting AI project.</p><p>As I examined the aggregated findings, I came across visual categories representing environments that were considerably more sensitive than I had expected.There were residential environments, including bedrooms, kitchens, and living spaces.</p><p>There were healthcare-related environments, including imagery that appeared to depict babies in hospital stretchers.</p><p>There were industrial environments with machinery and operational equipment. Some observations appeared to involve power-control rooms and industrial facilities across Europe.</p><p>There were also highways, neighbourhoods, shops, and other commercial spaces.</p><figure><img alt="A grid of six heavily blurred camera frames, each with the vision model’s generated description and its assigned tags listed underneath." src="https://cdn-images-1.medium.com/max/944/1*aesu5PweEvHOW8pyjy2CuQ.png" /><figcaption>Some of the many cameras analysed in the platform</figcaption></figure><p>We are talking about visual environments that people would reasonably expect to remain private or, at the very least, to be protected from unauthorized observation. And yet these were the kinds of environments represented in the research.</p><p>What struck me wasn’t simply the ability of an AI model to describe an image. It was the possibility of turning large amounts of visual information into structured, searchable intelligence.</p><p>Imagine the difference between someone manually examining individual images and a system that can automatically generate contextual descriptions and categorize hundreds of exposed cameras.</p><p><strong>That difference is significant.</strong></p><h3>The Bigger Question: How Intrusive Can AI Become?</h3><p>By this stage, I was looking at the experiment through a very different lens.</p><p>We have spent years discussing internet-exposed infrastructure, weak configurations, default credentials, and the risks associated with poorly secured IoT devices.</p><p>But AI adds another dimension to this problem.</p><p>A device being exposed is one issue. Being able to automatically interpret the visual information associated with it introduces another. Vision-language models are making it increasingly easy to extract context from imagery. They can describe scenes, identify broad categories, and organize information in ways that make large datasets considerably easier to interpret.</p><p>Combine that with internet exposure intelligence and AI-assisted application development, and you have a combination that deserves serious scrutiny.</p><p>The concerning part is that the individual technologies are not particularly exotic. You have a search engine for internet-connected devices, an application built with an AI coding assistant, and locally hosted vision-language models.</p><p>Individually, these technologies have legitimate applications. Together, they can create capabilities that introduce serious privacy risks.</p><h3>So, What About the Guardrails?</h3><p>One of the reasons I wanted to document this experiment was to understand how AI safeguards behave when the intended application evolves through multiple development interactions.</p><p>Claude initially recognized the concerns associated with the original camera-analysis request. However, the subsequent development process raised questions about whether the broader objective and cumulative capabilities were being adequately considered.</p><p>This is particularly relevant when we look at Anthropic’s own work on AI safety and misuse prevention.</p><p>In September 2026, Anthropic published a threat intelligence report discussing its efforts to identify and disrupt malicious uses of AI.</p><p><a href="https://www.anthropic.com/threat-intelligence-report-september-2026?utm_source=chatgpt.com">Anthropic — Threat Intelligence Report, September 2026</a></p><p>I found this particularly relevant to my experiment.</p><p>There is an important distinction between evaluating an individual coding request and understanding what the complete application being developed could ultimately enable. Building an image classifier is one thing. Building a video-analysis system is another. But when these features are combined with internet-wide exposure research, the potential consequences become very different.</p><p>I don’t think a single experiment is enough to conclude that an AI provider’s safeguards are ineffective. But I do think it highlights a difficult problem: how should AI systems reason about cumulative capabilities and the broader intent behind a development project? It is a much harder problem than simply identifying whether an individual prompt is safe or unsafe.</p><h3>[0x0] The End</h3><p>I started this experiment with a fairly simple question: could I use Claude to help build a tool that analyzed camera-related imagery discovered through Shodan?</p><p>What followed was an unexpectedly deep exploration of AI-assisted development, local vision-language models, and the privacy implications of automated visual intelligence.</p><p>I got to build a functional platform, experiment with Moondream2 , and examine more than 400 cameras over the world.</p><figure><img alt="Four stat tiles summarising the run: 524 total scans, 400 hosts captured, 100% HTTP snapshot, 0 credentials used." src="https://cdn-images-1.medium.com/max/1024/1*3NXPcOdRtefgLnq7LOpgbw.png" /><figcaption>The whole run in four numbers. Every frame arrived over plain HTTP — nothing was behind a login, and nothing needed one.</figcaption></figure><p>But the biggest takeaway wasn’t the application itself.</p><p>It was realizing how easily individual AI capabilities can be brought together to create something considerably more powerful than any one component on its own.</p><p>We are entering a period where building sophisticated applications is becoming increasingly accessible. That is fantastic for developers, researchers, and anyone interested in experimenting with technology.</p><p>However, accessibility also comes with responsibility.</p><p>The same AI capabilities that can help a security researcher understand exposure risks can potentially be used to invade people’s privacy on a much larger scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=725b9a63ee5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Days of Black-Box Web Testing, 25 Vulnerabilities Later: Is AI-Powered Detection Actually Working?]]></title>
            <link>https://medium.com/@umairnehri9747/7-days-of-black-box-web-testing-25-vulnerabilities-later-is-ai-powered-detection-actually-working-d7ab52393940?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7ab52393940</guid>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 07:05:13 GMT</pubDate>
            <atom:updated>2026-03-30T07:05:13.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2YoSkNJuGGo7WwAmkgd61Q.png" /></figure><p>Over the past few weeks, my LinkedIn and X feeds have been filled with posts from security vendors and researchers showcasing how AI is being used to uncover vulnerabilities across public programs. It’s impressive, but it also made me wonder how far this can actually go, so I decided to try it myself. Instead of relying on pre-built prompts, tools, or popular “AI-powered hacking” playbooks, I took a different approach and let the agents figure things out on their own when it comes to building and refining their own methods along the way. This experiment is my attempt to document that journey: what I uncovered, where AI-powered vulnerability detection stands today, the limitations I encountered, and what might come next. I also see this as an open discussion which could me and many others learn how to do this a “better” way, so if you have thoughts or experiences, I’d love to hear them.</p><h3><strong><em>[0x01] The Setup</em></strong></h3><p>First things first, the show stealer. From everything I observed, the general consensus is right, <strong>Opus 4.6</strong> is a serious contender in AI powered vulnerability detection and it genuinely lives up to the hype. When I compared it with <strong>Sonnet 4.6</strong>, Opus consistently outperformed it in reasoning, and more importantly, the quality of vulnerabilities it uncovered was noticeably better than Sonnet and several other models I tested along the way.</p><p>So without wasting time, I picked up the <strong>$20 Pro plan</strong> to get started. That said, if you are planning to go deep with this, I would strongly recommend the Max plan since Pro credits disappear much faster than you would expect.</p><p>Running everything locally was not the plan. This is where Oracle came in. With a 24GB free tier instance and Claude CLI installed, I was all set to begin hunting.</p><p>To avoid having to SSH into the instance every time, I used the “<strong>/remote control</strong>” utility available in Claude CLI, which connects back to the Claude Desktop GUI. This allowed me to send prompts remotely, watch them execute on the cloud instance, and get the results directly on my desktop. One quick tip here is to run Claude CLI with the “ <strong>— dangerously-skip-permissions</strong>” flag so you do not have to manually approve every command execution.</p><h3>[0x02] The Brain</h3><p>Now it was time to give our intern a brain and watch it evolve into a full time employee. I started by asking Claude to install whatever tools it considered necessary across the entire vulnerability hunting lifecycle, from initial reconnaissance to active and passive detection, and finally reporting. To make detection more flexible, I also had it set up headless browsers for tasks like taking screenshots, verifying issues such as XSS, and interacting with forms when needed.</p><p>After installing any tool, Claude maintained a <strong>tools.md</strong> file that documented the relevant commands, making it easy to reference during scans. In addition, I had it maintain a <strong>knowledge.md</strong> file to track what it had already tried on a target so it would not repeat the same steps, along with logging mistakes I pointed out and how it adjusted its approach in subsequent runs.</p><h3>[0x03] The Findings</h3><p>After everything was set up, it was finally time to put the AI to work. It kicked off with reconnaissance, mapping out the underlying tech stack across the attack surface and, interestingly, focused its efforts accordingly instead of taking a spray and pray approach, which I found impressive. One thing I quickly realized is that the more context you provide about a target, whether it is a root domain or a specific endpoint, the better the results. Explaining what the application does and what to expect goes a long way.</p><p><strong>Claude performs especially well when given precise targets</strong> like API endpoints, though it can adapt to broader scopes over time. It showed strong results in identifying issues like XSS, subdomain takeovers, GraphQL vulnerabilities, business logic flaws, and S3 misconfigurations, internal server IP leaks and ofcourse…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i8cU-S_Z4XQzZ4V0RWCjEA.png" /></figure><p>This thing <strong>SPAMS with CORS findings a</strong>nd god knows how many times I had to ask it to not report CORS-related findings and eventually putting it in the knowledge.md file. It also made me wonder if these finding types are prevalent across everybody’s deployments or instruction-specific.</p><h3><strong>[0x04] The Good</strong></h3><p>Claude ultimately managed to uncover a number of genuinely interesting findings, often chaining ideas together and pivoting from one observation to another to reach deeper issues. In several cases, these were the kind of vulnerabilities that could easily go unnoticed during routine testing and would typically require a more focused and methodical approach from a human analyst.</p><p>Over the span of a week, I managed to uncover around<strong> 25 vulnerabilities</strong>. These ranged from S3 bucket misconfigurations to data leakages and even business logic issues in certain utilities. One thing that stood out was how Claude actively explored documentation endpoints exposed on websites and used them to guide further testing, which led to some genuinely interesting findings.</p><p>Claude also performs well if you give it access to any API tokens or account credentials for the platform which it may use for authenticating into the platform and expand its testing horizon.</p><h3>[0x05] The Bad</h3><p>I still feel there’s a lot of room for improvement, both in fine tuning these agents and in refining the overall detection approach. Claude often tends to overestimate the severity of certain findings, which can make prioritisation difficult. At times, it flags intended functionality as a security issue or reports false positives due to incomplete verification, for example, marking a stored XSS even when it does not actually execute on the client side.</p><p>The biggest reason I<strong> wouldn’t consider Claude ready for production environments yet</strong> is its tendency to go beyond detection and actively exploit vulnerabilities. In several cases, it attempted actions that could modify real data such as creating or deleting users, altering content, triggering transactions, or uploading files, which can disrupt normal application behavior. I actually observed this happening during my testing, which makes it a serious concern.</p><p><strong>Running these agents in isolated or staging environments instead of production should be the baseline</strong>. On top of that adding clear boundaries between detection and exploitation, and requiring explicit approval before performing any state-changing actions should be highly encouraged but there is always a chance that it may disregard or forget your earlier instruction and do something “bad”.</p><h3><strong>[0x06] Duplicates Everywhere, Little That Stands Out</strong></h3><p>After running multiple scans and observing the patterns in its approach, it became clear that the discovery process is often very similar across runs. Because of this, if you point it at popular community VDPs, <strong>there’s a high chance you’ll end up submitting duplicates alongside many others using the same tools and models</strong>. In a landscape where everyone is leveraging similar setups, most findings start to look the same. The only real way to stand out is through one thing: fine tuning.</p><p>You need to ensure your instructions and methodologies stay aligned with the latest techniques and real-world attack patterns. That’s what pushes the model beyond basic, repetitive scanning and helps it uncover more creative, out-of-the-box vulnerabilities instead of just the usual noise.</p><h3>[0x07] The Human Element</h3><p>So, are we here to stay? Yes. <strong>As they say, accountability ultimately lies with humans. You can’t assign that responsibility to an LLM, especially when dealing with sensitive or critical systems.</strong> The human element is essential, whether it’s discovering vulnerabilities or validating whether a finding is real or just a false positive. You also need someone guiding the process, correcting the agent when it drifts and keeping it aligned with the actual objective.</p><p>From a detection standpoint, AI is a strong addition to the existing security stack. It can complement traditional approaches and help uncover issues that might otherwise be overlooked.</p><h3><strong>[0x08] Still Catching Up</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fzQWwkjKOwMj1LZLMouZA.png" /></figure><p>Maybe this view is slightly biased by my setup and the way I guided the agent, but it’s clear there’s still a long way to go before AI-powered vulnerability detection is reliable and safe enough for production environments, which are ultimately the most critical attack surfaces.</p><p>There’s also a need to improve how these systems assign severity, reduce false positives through better context awareness, and actually help users prioritise what matters instead of just generating more noise.</p><p>That said, the results were genuinely impressive. The kind of findings uncovered in such a short time show real potential, and I’m already exploring ways to make the approach more robust, effective, and at the same time, safe and responsible.</p><h3>[0x09] The End</h3><p>This brings us to the end of the article. This space is still evolving, and I expect we’ll continue to see rapid improvements that push AI-assisted vulnerability detection even further. I’m also keen to learn more about how security vendors are approaching this problem.</p><p>As mentioned earlier, I’m still exploring this space myself and by no means I am a Pro (yet), so consider this an open discussion. If you have ideas, suggestions, or a better way to fine tune the approach,<strong> I’d genuinely love to hear your thoughts in the comments or on </strong><a href="https://www.linkedin.com/in/umair-nehri-49699317a/"><strong>LinkedIn</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPh_RHce9p3j0CBCKklkVQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7ab52393940" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scribd -  A Goldmine of Sensitive Data: Uncovering Thousands of PII Records Hiding in Plain Sight]]></title>
            <link>https://medium.com/@umairnehri9747/scribd-a-goldmine-of-sensitive-data-uncovering-thousands-of-pii-records-hiding-in-plain-sight-bad0fac4bf14?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/bad0fac4bf14</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[information-technology]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Wed, 12 Feb 2025 07:30:47 GMT</pubDate>
            <atom:updated>2025-02-12T07:30:47.795Z</atom:updated>
            <content:encoded><![CDATA[<h3>Scribd - A Goldmine of Sensitive Data: Uncovering Thousands of PII Records Hiding in Plain Sight</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbf7b2spdamgwu_EldZxag.png" /></figure><p>Ever wondered what could possibly go wrong when a digital document library allows users to upload whatever documents they want, letting them believe it is similar to Google Drive? Let’s just call it a recipe for disaster.</p><blockquote>When Edward A. Murphy Jr. mentioned in his famous “Murphy’s Law” that whatever can go wrong will go wrong, he was right, maybe because he knew that people wouldn’t think twice before sharing their PII over the internet without clearly understanding its consequences.</blockquote><p>Anyway, enough of the story-building, let’s dig deeper and see what happened and what we found out.</p><h3>Introduction</h3><p>Before diving straightaway into the technical aspects or numbers, it’s important that we first know what Scribd even is in the first place.</p><p>Scribd is a digital library housing over 195 million+ documents from users worldwide. These constitute ebooks, audiobooks, magazines, sheet music, legal documents, and PII documents tsk tsk.</p><p>The service has an “Upload to Download” freemium plan, where users can upload 5 documents to download a document they desire. Well, exchanging bank statements for a favorite magazine sounds pretty good right? Right!?</p><p>So yeah, back to the story. One fine day we thought, hmmm, maybe there should be something more than those boring ebooks on this platform. We were surely not surprised after seeing all the documents that were returned after we searched for “passport”. Our first reaction was that there must be way more than just passports if people didn’t think twice about these.</p><p>Every next query that we searched on the platform were returning tons of interesting and at the same time, sensitive results. At last, we realized, yeah that’s it, we need some research to go out about this, people need to know what they are exposing over the web and if through this blog, we are able to send a message to the platform itself then this would come as a big relief to everyone!</p><h3>Scraping Out the Data</h3><p>We wanted some numbers to show the impact from these leaks and definitely just staring at the screen and counting the entries would be the dumbest idea. We had to scrape the platform.</p><p>First, we decided on the metrics based on which queries would be done, these were:</p><ul><li>Documents must have been posted/uploaded on the platform in the last year</li><li>Documents must have between 1 to 3 pages since this is the most likely length of files that would host PII (this is a tradeoff for cases like bank statements)</li><li>Document names/URLs should contain the name/category of PII we are looking for (Eg: <a href="https://www.scribd.com/document/12345/passport-pdf%29">https://www.scribd.com/document/12345/passport-pdf)</a></li></ul><p>Now since we have the metrics the challenge is to fetch the documents from the platform, how do we do this? Unaware of any public APIs offered by the platform, we looked everywhere to find a good solution to achieve what we were trying to do, but to no vail.</p><p>Until.. one day when we were searching for documents again out of curiosity, we opened up the inspect element and voila! we discovered an API endpoint that allowed us to retrieve the document URLs and information programatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_pMd6wSHHMfdYJEZzO-UA.png" /><figcaption>Screenshot showing the API endpoint we discovered for retrieving search results</figcaption></figure><p>The endpoint returned a maximum of 42 results per page which was iterable. So now, all it took us to get to the data was triggering cURL requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EfMdrtKYlWsLX-FrXo69DA.png" /><figcaption>Screenshot showing the cURL request we used for retrieving Passports</figcaption></figure><p>In the above one-liner, you can see that we iterated between 1 and 12000 (considering it to be the highest available page number, though most likely it used to stop by the 200th or 400th page). Once we had the results from the cURL request, we used <strong>jq</strong> to parse out the JSON response body to retrieve the document URLs and append them to a file named urls.txt, we repeated this process for several keywords/queries that we believed would return something sensitive.</p><h3>The Results</h3><p>Enough of the nerd stuff, let’s talk about numbers, and the results we retrieved from these scans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUhA-qI6c2po2L5-W0KQQA.png" /><figcaption>Infographic showing the results uncovered in the research</figcaption></figure><p>We successfully managed to retrieve a total of 13,197 unique PII documents targeting 15 different categories affecting users worldwide. What is more concerning is that our categories were still pretty much limited and only had sample data for the last year, <strong>consider this to be the tip of the iceberg</strong>!</p><p>Our most frequently encountered document was offer letters! These documents not only contain the bags of cash dudes will be printing but even their names, addresses, emails, and what not. But then this wasn’t it! There was way more stuff on this platform than just offer letters. We found bank statements holding financial transactions, bill invoices with addresses, WhatsApp chats PDF exports, vaccine certificates, 2FA backup codes, and visa documents, the list was and is never-ending!</p><p>But seriously 2FA backup codes being uploaded to a digital library? This means that their users don’t understand what they are doing. Imagine a government employee uploading a 2FA backup code to their mail account on here, it can be catastrophic.</p><p>While uncovering this disaster, we also came across a job scam being hosted over Scribd in the form of offer letters,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*daocSuWtfx3Joqh0iEakpA.png" /><figcaption>Image showing a potential job scam being run over Scribd</figcaption></figure><p>In the above image, you will notice the similarities in terms of designs in all of the above offer letters posing as different institutions/entities. This would be an interesting case to further research and if you ever decide to work on it, be sure to let us know :)</p><h3>The Solution?</h3><p>As from a user PoV, we need to be more cautious of what we upload on such platforms and if we do, check whether or not they have access controls in place to restrict unwanted access to sensitive information such as these.</p><p>For Scribd and similar platforms? The below image summarises what I wish for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*ZdCXsU98ynXXKTCYZ3z5fw.png" /></figure><h3>Conclusion</h3><p>So that’s it, folks! I hope that we were able to produce something interesting and insightful enough. This research will be one of our various ways to provoke a sense of awareness among the crowd about security and ofcourse, the implications of posting PII over the internet.</p><p>If you have any suggestions/feedback/questions or just anything, feel free to reach out through my email <a href="/service/mailto:umairnehri9747@gmail.com">umairnehri9747@gmail.com</a> or <a href="https://www.linkedin.com/in/umair-nehri-49699317a/">LinkedIn</a>.</p><p>See you soon with some new research or tools as always, until then, happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bad0fac4bf14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mass Scanning Android Malware Samples of 2022: A Brief Report]]></title>
            <link>https://medium.com/@umairnehri9747/mass-scanning-android-malware-samples-52d4816a8f91?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/52d4816a8f91</guid>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Sat, 31 Dec 2022 17:36:27 GMT</pubDate>
            <atom:updated>2023-01-05T18:03:42.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UZYR2LdWD8glTqJCuqvzwA.jpeg" /></figure><h3>Introduction</h3><p>As we near the end of 2022, it is essential to reflect on the state of android malware and the efforts to detect and mitigate its spread. In this report, we will provide an overview of the malware samples uploaded by security researchers on famous platforms such as <a href="https://bazaar.abuse.ch/">MalwareBazaar</a> and <a href="https://www.vx-underground.org/">vx-underground</a>, this includes things such as the most common IoCs that were discovered, Secret token exposures, and much more.</p><p>But before we begin, I would like to give a shoutout to <a href="https://twitter.com/smelly__vx?lang=en">smelly__vx</a> from Vx-underground and <a href="https://www.linkedin.com/in/roman-h%C3%BCssy-278b94213?originalSubdomain=ch">Roman Hussy</a> from abuse.ch for providing me with access to their respective platforms. I appreciate the help they have provided and I look forward to exploring more about their platforms in coming research work.</p><h3>Motive</h3><p>Although there may have been similar research work done in the past, my aim with this report is to provide brief insights about the malware samples discovered and uploaded in the year 2022. This blog will discuss the various findings from the scan and give an overview of some common tools and platforms associated with these samples.</p><p>One thing to note here is that the dataset was pulled on the 15th of December 2022, so there can be a slight difference between the sample count from the date when the dataset was generated and the date when the report was released.</p><h3>Approach</h3><p>Initially, I gathered the malware samples from MalwareBazaar and vx-underground. All of these samples were in the “.apk” format and were filtered based on the upload timestamp so that we only have those samples that were uploaded this year. After filtering and downloading all the samples, I was ready to scan a total of 771 samples that were a combination of both platforms mentioned earlier.</p><p>The next step here was to pass these samples to the scanner that I wrote for this research. The scanner will decode the apk file using <a href="https://ibotpeaches.github.io/Apktool/">apktool</a> and save all the extracted files in a folder. Next, it iterates over all the extracted files and fetches their contents. The tool then matches their contents with regular expressions related to things such as:<br>• Emails,<br>• IP Addresses,<br>• Secret Tokens,<br>• Permissions, etc.</p><p>And finally, once the tool had all the necessary data related to a sample, it would then proceed to append the output in a JSON file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*bSs4Kq5tIuJ8CUviYgzwkQ.png" /><figcaption>Architectural overview of the scan</figcaption></figure><p>Above is an architectural overview of the approach I took for mass scanning the malware samples.</p><h3>Findings</h3><p>Now let us get down to the findings. Below are the various categories of findings from the scan data analysis.</p><h4>Secret Exposures</h4><p>After scanning the malware samples using 80 unique regular expression signatures, I was able to identify 442 unique secret leaks from these samples from a total of 771 discoveries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwePNVvmwxJVoH7MjaG-fw.png" /><figcaption>Secret Exposure based upon Secret Type</figcaption></figure><p>As it turns out Google API has contributed significantly to this list with a total of 297 unique API Keys. After that, we have Facebook Secret Keys followed by Generic Secret Tokens with a count of 56 entries each. Other members in this list were AWS Access Key IDs, Artifactory Passwords, AWS API Keys and Artifactory API Tokens. I discovered that more than half of the malware samples that we scanned, had at least 1 exposed secret, meaning that every second malware sample from this year likely had a secret exposure.</p><p>Such tokens can be used by an attacker for some API endpoint on the token owner’s behalf and ultimately exhaust the resource limits or worst-case scenario, bring hefty amounts of bills for the API usage.</p><p>Since I had only used 80 signatures for getting an idea about the secret exposure, chances are that several API tokens belonging to other services/platforms have been left untouched. Personally, I will explore this idea a little more before the next scan, to get more quality results.</p><p>In the style of <a href="https://twitter.com/vxunderground">vx-underground</a>, here’s a GIF which suits the message I would wanna convey to the malware devs of these samples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*KQ3E8siygQaLpZmA.gif" /><figcaption>The evergreen monkey hitting a person with a toy sword, GIF</figcaption></figure><h4>Permission Requirements</h4><p>Next, if we talk about the permission requirements, we tried to extract all matches through the following Regular Expression,</p><pre>&lt;uses-permission.*? android:name=&quot;(.+?)&quot;\/&gt;</pre><p>My scanner was able to successfully extract a total of 18,835 permission requirements from all of the samples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C0EoLaGwYw8wEuFUL2FAAQ.png" /><figcaption>Top-10 Permission Requirements Discovered</figcaption></figure><p>It was discovered that “android.permission.INTERNET” had the most number of occurrences (715), followed by two other permissions, “android.permission.ACCESS_NETWORK_STATE” and “android.permission.WAKE_LOCK” with a total of 683 and 626 occurrences respectively.</p><p>I discovered a total of 733 unique permissions that the apps asked for from the total of 18,835 requirements discovered. A sample named bs.apk (md5 hash: <strong>32f24cc1988a8ef0108707c50f0e7bcd</strong>)<strong> </strong>had the most amount of permission requirements with a total of 196 entries, the closest one in this list was another sample, 11927032f6ac157532fcc0a37b16e28d70cd20c8ce18e513f66b07d2586666d3.apk (md5 hash: <strong>80cbbf92e8b1c60caca9597ff887daaf)</strong> with a total of 165 entries.</p><h4>App Misconfigurations</h4><p>I scanned the apps with certain Regular Expression signatures which can help flag potential app misconfigurations. A total of 656 entries of potential misconfiguration were discovered from the scan data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aAykkDNSwt-QHixxB3LfZg.png" /><figcaption>Top App Misconfigurations Discovered</figcaption></figure><p>The “ADB Backup Enabled” flag contributed the most to this list with 482 entries followed by “Android Debug Enabled” with a total of 59 entries. In the case of “ADB Backup Enabled”, an attacker will be able to copy application information from the device. And if we talk about “Android Debug Enabled”, with the <em>android:debuggable</em> attribute set to true, the app can leak sensitive information as well as make itself vulnerable to decompilation. Not just that, it can let an attacker run arbitrary code under the application&#39;s permission.</p><h4>Malicious Domains</h4><p>And finally, if we talk about the malicious domains, to my surprise all the top 6 domains that were discovered belonged to the same stalkerware named “Android-Monitor”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qVbLge4gHk1U3TFDdDT1ww.png" /><figcaption>Top 6 Malicious Domains Discovered</figcaption></figure><p>As you can see in the above infographic, all of the domains are kind of similar in their naming pattern with the exception being android-police.ru but all the domains I mentioned above belong to the same stalkerware and will have a homepage like the below screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u0ZzdVdaxLukwSan9Zq_tQ.png" /><figcaption>Screenshot showing the homepage of Android-Monitor</figcaption></figure><p>The most common endpoints of these domains can be “/crash.php”, “/download_checker.html”, “/log.php”, “up.php” etc. I discovered a fantastic <a href="https://github.com/AssoEchap/stalkerware-indicators">list of Stalkerware IOCs</a> which can help you to get an idea about more such domains belonging to this stalkerware.</p><p>In case you would be interested to map out more such infrastructure belonging to this stalkerware, a good start would be with the favicon (hash: 888241896) which is the same in all of the domains discovered above.</p><p>Other than this, I also discovered several URLs related to Cerberus, which you will find below,</p><pre>      http://www.cerberusapp.com/download/ping<br>      http://www.cerberusapp.com/download/ping2.php<br>      http://www.cerberusapp.com/download/version<br>      https://cerberusapp.com/download/version<br>      https://www.cerberusapp.com/account<br>      https://www.cerberusapp.com/aiuto.php<br>      https://www.cerberusapp.com/audio/<br>      https://www.cerberusapp.com/buy.php?username=<br>      https://www.cerberusapp.com/comm/<br>      https://www.cerberusapp.com/comm/backupconf2.php<br>      https://www.cerberusapp.com/comm/changeaccount.php<br>      https://www.cerberusapp.com/comm/getdevices.php<br>      https://www.cerberusapp.com/comm/install.php<br>      https://www.cerberusapp.com/comm/login2.php<br>      https://www.cerberusapp.com/comm/notifyowner.php<br>      https://www.cerberusapp.com/comm/ping2.php<br>      https://www.cerberusapp.com/comm/postbug.php<br>      https://www.cerberusapp.com/comm/radar.php<br>      https://www.cerberusapp.com/comm/recoveruser.php<br>      https://www.cerberusapp.com/comm/resetpass.php<br>      https://www.cerberusapp.com/comm/restoreconf2.php<br>      https://www.cerberusapp.com/comm/s.php<br>      https://www.cerberusapp.com/comm/sendaudiofile.php<br>      https://www.cerberusapp.com/comm/sendemail.php<br>      https://www.cerberusapp.com/comm/sendlocation.php<br>      https://www.cerberusapp.com/comm/sendlocation2.php<br>      https://www.cerberusapp.com/comm/sendmessage.php<br>      https://www.cerberusapp.com/comm/sendpicture.php<br>      https://www.cerberusapp.com/comm/sendrecord.php<br>      https://www.cerberusapp.com/comm/sendregid.php<br>      https://www.cerberusapp.com/comm/sendtrack2.php<br>      https://www.cerberusapp.com/comm/sendvideo2.php<br>      https://www.cerberusapp.com/comm/verify.php<br>      https://www.cerberusapp.com/comm/verifycode2.php<br>      https://www.cerberusapp.com/downloads<br>      https://www.cerberusapp.com/get<br>      https://www.cerberusapp.com/help<br>      https://www.cerberusapp.com/help.php<br>      https://www.cerberusapp.com/help/9<br>      https://www.cerberusapp.com/index.php?l=login<br>      https://www.cerberusapp.com/terms<br>      https://www.cerberusapp.com/terms.php<br>      https://www.cerberusapp.com/track/<br>      https://www.cerberusapp.com/user</pre><h4>Misc</h4><p>Other than the above data, I also extracted several other things. This includes ~500 email addresses, 23,760 IP Addresses which of course may have many false positives and 10 Google Analytics Tracking IDs. The attacker can use these tracking IDs to obscure all future analytics data by putting the same tracking ID on other websites or applications.</p><p>And finally, just like in one of my past research works, I tried to scan for Misconfigured Firebase Database endpoints which I discovered from the scan. Although there was no significant data that was breached from there, I was able to find 17 vulnerable instances from a total of 145 endpoints discovered. One such example of what information I was able to discover can be found in the screenshot below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3rzBehnbx3htjJ_hACvHdA.png" /><figcaption>Screenshot of a vulnerable Firebase DB</figcaption></figure><h3>Dataset Release</h3><p>I am currently in the process of determining what segments of data I should be releasing through this research. So, for now, I do not have any datasets to share.</p><p>Though I recommend keeping an eye on this space or my <a href="https://twitter.com/0x9747">Twitter</a> to have any upcoming updates for the same. Most likely, the datasets will be dropping in the first or second week of January.</p><p><strong>Edit (5th January 2022)</strong>:<br>As promised, here are the datasets which I am releasing for this report. I hope that these will be sufficient for the time being, but please reach out in case you need any further context.<br>• <a href="https://github.com/umair9747/datasets/blob/main/mass-scanning-android-malware-samples/names.txt">Sample Names</a><br>• <a href="https://github.com/umair9747/datasets/blob/main/mass-scanning-android-malware-samples/md5.txt">MD5 Hashes</a><br>• <a href="https://github.com/umair9747/datasets/blob/main/mass-scanning-android-malware-samples/urls.txt">URLs</a><br>• <a href="https://github.com/umair9747/datasets/blob/main/mass-scanning-android-malware-samples/permissions.txt">Permissions</a></p><h3>Conclusion</h3><p>So this brings me to the end of this report. Honestly, this was my first ever try to mass-scan malware samples hence, this will be a learning experience for future research works/projects. Your suggestions and feedback will be appreciated and can have a significant contribution to the upcoming reports. I will be more than happy to hear them out.</p><h3>What Lies Ahead?</h3><p>This was my first-time mass scanning android malware samples so I am curious about the level of impact this report can deliver. Based on the suggestions and feedback from the audience, I am willing to shape this research into an annual report in collaboration with more platforms and communities. I am also currently assessing the feasibility of my scanner which I used for scanning the malware samples and looking forward to seeing how I can shape this into an ambitious project which can turn out beneficial for the threat intel community in general. You are more than welcome to reach out through <a href="https://twitter.com/0x9747">Twitter</a> and become a part of the upcoming project.</p><h3>Reach Out</h3><p>Twitter: <a href="https://twitter.com/0x9747">https://twitter.com/0x9747</a><br>LinkedIn: <a href="https://www.linkedin.com/in/umair-nehri-49699317a/">https://www.linkedin.com/in/umair-nehri-49699317a/</a><br>Email: <a href="/service/mailto:umairnehri9747@gmail.com">umairnehri9747@gmail.com</a></p><h4>Sponsorships</h4><p>Running the scans can turn out to be costly at times considering the VM instances I spin from DigitalOcean and hence I will appreciate any sponsorships for my upcoming research works. The same can be done through my <a href="https://www.paypal.me/umair9747">PayPal</a>. Even a small sponsorship will be highly appreciated since I could utilise it for my upcoming research works or projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52d4816a8f91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to EEPROM]]></title>
            <link>https://medium.com/ax1al/an-introduction-to-eeprom-d0cc1b54b976?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0cc1b54b976</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[eeprom]]></category>
            <category><![CDATA[board-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 17:43:17 GMT</pubDate>
            <atom:updated>2021-09-10T17:43:17.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpACbZxt3_tz7mxnFm7iYw.png" /><figcaption>Blog Banner</figcaption></figure><p>Hello everyone and welcome to yet another blog by a <a href="https://twitter.com/0x9747">fellow nerd</a> at Axial. Today, we will be discussing about the EEPROM Memory chips which are the first, and most commonly considered memory devices to add to embedded systems these days.</p><h3>[0x00] What exactly is EEPROM?</h3><p><strong>EEPROM </strong>or <strong>Electrically Erasable Programmable Read-Only Memory </strong>is a non-volatile memory chip that can be used for storing a small amount of data from a computer or some other electronic device. EEPROM being non-volatile in terms of storage has the ability to retain the stored information even after the power is removed. An individual byte of data stored in the memory can be erased or reprogrammed (written to) repeatedly although it has a limited life, meaning that the number of times it can be reprogrammed to tens or hundreds of thousands of times.</p><p>In this blog, we will mainly focus on the <a href="https://www.microchip.com/en-us/product/ATmega328P">ATMEGA328P microcontroller</a> present on the <a href="https://store.arduino.cc/products/arduino-uno-rev3/">Arduino UNO R3 Development Board</a>. The microcontroller has an EEPROM having a total size of 1024 bytes. The EEPROM here has a life expectancy of around 100,000 Write/Erase cycles which means that you can write and erase/re-write bytes of data in this memory chip at least over 100,000 times before the EEPROM becomes unstable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*8Fpe9_4ho-tHIY0mG9PFCw.png" /><figcaption>Image showing the expected lifetime of EEPROM at various write frequencies</figcaption></figure><p>In the image above, you can have an idea about the expected lifetime of the EEPROM at various write frequencies.</p><h3>[0x01] Types of EEPROM</h3><p>There are mainly two types of EEPROM interfaces used for data input/output, Serial and Parallel EEPROM memory.</p><h4>1. Serial EEPROM Memory</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fVQPeCevC0Mk9p0Y" /><figcaption>Example of Serial EEPROM Memory</figcaption></figure><p>A Serial EEPROM is where the data is transferred serially which causes Serial EEPROM devices to be comparatively slower than Parallel EEPROM memory. They are relatively cheaper and less dense.</p><p>A Serial EEPROM device typically consists of three phases:</p><ul><li>OP-Code Phase</li><li>Address Phase</li><li>Data Phase</li></ul><h4>2. Parallel EEPROM Memory</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*glK8i583QJ_1laRk.jpg" /><figcaption>Example of Parallel EEPROM Memory</figcaption></figure><p>A Parallel EEPROM device generally has an 8-bit data bus and a wide address bus which is enough for total memory handling. When compared with Serial EEPROM devices, they are denser and reliable but due to their cost, parallel EEPROMs have lower popularity.</p><h3>[0x02] The &lt;EEPROM.h&gt; Library</h3><p>The <a href="https://www.arduino.cc/en/software/">Arduino IDE</a> comes with the <a href="https://www.arduino.cc/en/Reference/EEPROM">&lt;EEPROM.h&gt; library</a> which enables a developer to read/write bytes of data into the EEPROM of the microcontrollers present in the Arduino and Genuino AVR based boards.</p><p>A developer can use this library by adding the below line of code:</p><blockquote>#include &lt;EEPROM.h&gt;</blockquote><p>Here are some of the functions that you can perform with the help of this library,</p><ul><li><a href="https://www.arduino.cc/en/Tutorial/EEPROMRead"><strong>EEPROM Read</strong></a><strong> — </strong>Read a byte of data from EEPROM and send it to the computer.</li><li><a href="https://www.arduino.cc/en/Tutorial/EEPROMWrite"><strong>EEPROM Write</strong></a><strong> </strong>— Write a byte of data from analog input to the EEPROM.</li><li><a href="https://www.arduino.cc/en/Tutorial/EEPROMUpdate"><strong>EEPROM Update</strong></a> — Write a byte of data to EEPROM only if the new value is different from the current value.</li><li><a href="https://www.arduino.cc/en/Tutorial/EEPROMGet"><strong>EEPROM Get</strong></a> — Get any value from EEPROM and print as float or struct or any datatype on serial.</li><li><a href="https://www.arduino.cc/en/Tutorial/EEPROMPut"><strong>EEPROM Put</strong></a><strong> </strong>— Write any value to EEPROM as float or struct or any datatype.</li></ul><p>The table below shows the size of EEPROM (in bytes) for different microcontrollers used in various Arduino based development boards. It will help you to get an idea about how many bytes you could read/write on the board that you’re using.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*w0p0JWMgsIaNaEShmo_W8g.png" /><figcaption>Table showing the size of EEPROM for different microcontrollers used in various Arduino boards.</figcaption></figure><h3>[0x03] Using the&lt;EEPROM.h&gt; Library</h3><p>Let us try to understand the use of &lt;EEPROM.h&gt; library through an example. Assume that we have set up a certain project with our Arduino Uno R3 Development board and that we need to store the end user&#39;s preferred settings on it. For functionalities like these, EEPROM memory could be of great help since it could store the values for the preferred settings into our Arduino board and since EEPROM is a non-volatile memory, it could retain our data even after the power is removed.</p><p>Let’s take a quick look over the below code,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad5804842e9724dc602b917fddef0d1c/href">https://medium.com/media/ad5804842e9724dc602b917fddef0d1c/href</a></iframe><p>Initially, we have imported the &lt;EEPROM.h&gt; library in line 1. We are using the variable <strong>choice </strong>for reading the input from the user and the variable <strong>defaultsettings </strong>for reading the value from the EEPROM memory.</p><p>The code basically lets the user input their choice on whether they would like to keep the on-board surface mount LED ON or OFF depending on the input (y or n). To check the previous state of the LED we are using the <strong>EEPROM.read() </strong>function to read the value from address 0 and pass it to the conditional statements to set the LED’s state initially. The code then lets the user input their choice which would then turn the LED’s state accordingly and finally write the choice on address 0 inside the EEPROM memory using the <strong>EEPROM.write()</strong> function.</p><h3>[0x04] References</h3><p>Here are some resources which you can refer to for getting a better understanding of how EEPROM memory devices work and how you can use them for improving the functionality of the code in your next project involving EEPROMs!</p><ul><li><a href="https://www.electronics-notes.com/articles/electronic_components/semiconductor-ic-memory/eeprom-e2prom-technology.php">What is EEPROM Memory Technology</a></li><li><a href="https://dronebotworkshop.com/eeprom-arduino/">EEPROM with Arduino - Internal &amp; External</a></li><li><a href="https://www.arduino.cc/en/Reference/EEPROM">Arduino - EEPROM</a></li></ul><h3>[0x05] Conclusion</h3><p>This brings us to the end of this blog. We covered the introduction to EEPROM memory chips, their types and finally the &lt;EEPROM.h&gt; library from Arduino IDE and its application. I hope this quick overview was enough to give you a brief understanding of what EEPROM actually is and how you can use it in your projects.</p><p>I look forward to bringing more such content in future but if you find any mistakes in this blog feel free to reach out through <a href="https://twitter.com/0x9747">Twitter</a> since I will really appreciate any sort of feedback for it.</p><p>Happy Hacking!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VqOyugZsyoKlDnYsYD-QtQ.png" /></figure><p>Blog by <a href="https://twitter.com/0x9747">Nerd </a>of <a href="https://ax1al.com/">AX1AL</a>, join us on our <a href="https://cutt.ly/axial">discord</a> server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0cc1b54b976" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ax1al/an-introduction-to-eeprom-d0cc1b54b976">An Introduction to EEPROM</a> was originally published in <a href="https://medium.com/ax1al">RIXED_LABS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Child Process Module: A Brief Introduction]]></title>
            <link>https://medium.com/ax1al/the-child-process-module-a-brief-introduction-debd984840f1?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/debd984840f1</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[child-processes]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Sun, 28 Feb 2021 12:43:18 GMT</pubDate>
            <atom:updated>2021-02-28T12:43:18.166Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-NCa4t1vUaYg0y7szD_Og.png" /></figure><h3>Introduction</h3><p>In this blog, we shall be discussing the <strong>child_process </strong>module present in Node.js. But before we begin let’s first understand what exactly Node.js is.</p><p><strong>Node.js</strong> is a JavaScript runtime built on Chrome’s V8 JavaScript engine which gives users the ability to execute their javascript code outside a browser. It can be used for writing command-line based programs, for server-side scripting in case of web applications and even for developing Discord bots!</p><h3>The Child Process Module</h3><p>Node.js applications execute their code as a single Operating System process running on a single CPU meaning that it would work in a single-threaded mode, which can be ideal for light-weight applications.</p><p>But with increasing code/features, the overall load by your application can be a problem even in the case of powerful host machines. This issue can be solved by using parallel processing in the case of multi-core CPU machines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*4W73pCtHcvRCqsHail2Wog.png" /></figure><p>Child process is basically a subprocess that is created by a parent process which in our case runs the application. These child processes can communicate with each other with the help of a messaging system.</p><p>Node.js has a <strong>child_process</strong> module for dealing with the creation of these subprocesses and the module can be used by the developers for even interacting with the host Operating System through running shell commands.</p><p>There are three main methods present in the module which could be used for the creation of these processes namely <strong>spawn, exec and fork</strong>. Let us discuss all of these in detail!</p><h3>spawn() method</h3><p>The spawn() method will create a new process with a command. It has the following syntax:</p><p><strong>child_process.spawn(command[, args][, options])</strong></p><p>Here,<br><strong>Command</strong> specifies the command to run in a string format<br><strong>Args</strong> specifies the list of arguments to be passed to the command in an array format<br><strong>Options </strong>specifies one of the many options available for this method like:<br> <strong>• cwd [string] </strong>which is the current working directory of the child process<strong><br> • env [object] </strong>which is the environment key-value pairs.<br> <strong>• stdio [array] </strong>which is the child’s stdio configuration<br> • <strong>customFds</strong> <strong>[array] </strong>which is the file descriptors for the child to use for studio<br> • <strong>detached [boolean] </strong>which prepares child to run independently of its parent process<br> • <strong>uid [number] </strong>which sets the user identity of the process<br> • <strong>gid [number]</strong> which sets the group identity of the process</p><p>This method returns streams (stdout and stderr) and the application would start getting the response streams as soon as the process starts executing when the program is executed.</p><h4>Example</h4><p>Let us look over an example to understand how this method works,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*QTHc3DRgMKZAxK12bcjxTA.png" /><figcaption>[Image showing a code snippet to explain the spawn() method]</figcaption></figure><p>In the above code, we have first imported the <strong>spawn() </strong>command from the child_process module, then we have declared a constant <strong>mv </strong>that will execute the mv command on our system which is basically used for moving files and directories from one location to the other. The <strong>stdout </strong>will basically capture the output stream which basically carries the output of the command once it is executed on the system and display it after “stdout:”. If our command is executed but errors are thrown in the error stream, <strong>stderr </strong>will capture it and display it after “stderr:”. Once the command is successfully executed, data is transferred through the streams and the process is closed the last function will display the message saying that the child process has exited with the x code.</p><h3>exec() method</h3><p>The exec() method is used to create child processes that can be used for executing commands on the operating system. It creates a shell process on the system which can be used for executing commands. It has the following syntax:</p><p><strong>child_process.exec(command[, options][, callback])</strong></p><p>Here,<br><strong>Command [string]</strong> specifies the command to run, we can provide space-separated arguments here<br><strong>Options [object] </strong>specifies one of the many options available for this method like:<br> <strong>• cwd [string] </strong>which is the current working directory of the child process<strong><br> • env [object] </strong>which is the environment key-value pairs<br> <strong>• encoding[string] </strong>which is for the encoding, default is “utf8”<br> • <strong>shell</strong> <strong>[string] </strong>which sets the shell to execute the command with. &#39;/bin/sh’on Unix, process.env.ComSpec on Windows<br> • <strong>maxBuffer [number] </strong>which sets the largest amount of data in bytes allowed on stdout or stderr<br> • <strong>uid [number] </strong>which sets the user identity of the process<br> • <strong>gid [number]</strong> which sets the group identity of the process<br><strong>Callback [function] </strong>is a function that is called with the output when the process is terminated, it gets three arguments namely <strong>error [error]</strong>, <strong>stdout [string/buffer]</strong>, <strong>stderr [string/buffer]</strong></p><p>The exec() method saves the output of the command when it is executed in a buffer in the memory which can be accepted through a callback function passed into the exec() function.</p><h4>Example</h4><p>Let us look over an example to understand how this method works,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*mHFlCvjBSiaZjofLq8zWVQ.png" /><figcaption>[Image showing a code snippet to explain the exec() method]</figcaption></figure><p>In the above code, we have first imported the <strong>exec() </strong>command from the child_process module, then we have passed the first argument to it which should be in a string format and in our case we used<strong> ls -la </strong>which will list all files and folders with all of their entries using a long listing format. In the second argument, we have passed three parameters namely error, stdout and stderr. The <strong>error</strong> argument will capture any errors which would be a result due to the failure of execution of the command, this could be because the shell used for running the command couldn’t find it. The <strong>stdout</strong> argument will be capturing the standard output stream which will read the output once the command is successfully executed. The <strong>stderr </strong>argument will capture any errors being sent to the standard error stream after the command’s execution.</p><p>In the callback function, the first if condition will look for any errors and if there are any, it will display the error message using<strong> </strong>console.error() and finally exit that conditional statement. The second if condition will look for any error messages printed after the command’s execution and display it using console.error(). Else if the command is successfully executed with no error messages, we finally display its output using <strong>console.log(`stdout:\n${stdout}`);</strong></p><h3>fork() method</h3><p>The fork() method is a special case of the spawn() method in which a child process can directly communicate with the parent process which runs our program with the help of <strong>send()</strong>. It has the following syntax:</p><p><strong>child_process.fork(modulePath[, args][, options])</strong></p><p>Here,<br><strong>modulePath [string]</strong> specifies the module to run in the child<br><strong>args [string[]] </strong>specifies an array list of arguments in string form<br><strong>Options </strong>specifies one of the many options available for this method like:<br> <strong>• cwd [string] </strong>which is the current working directory of the child process<strong><br> • env [object] </strong>which is the environment key-value pairs.<br> <strong>• stdio [array] </strong>which is the child’s stdio configuration<br> • <strong>serialization</strong> <strong>[string] </strong>which specifies the kind of serialization to be used for sending messages between the processes, possible values here are ‘<strong>json</strong>’ and ‘<strong>advanced</strong>’ although it is set to ‘<strong>json</strong>’ by default.<br> • <strong>detached [boolean] </strong>which prepares child to run independently of its parent process<br> • <strong>uid [number] </strong>which sets the user identity of the process<br> • <strong>gid [number]</strong> which sets the group identity of the process</p><p>The main difference between fork() and spawn() is that fork() allows the establishment of a communication channel between the parent and child process when we use the fork() method thus enabling us to share messages back and forth between the two processes.</p><h4>Example</h4><p>Let us look over an example to understand how this method works,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*pkrHc8VmF2Qh5M3uzrsYOQ.png" /><figcaption>[Image showing a code snippet to explain the fork() method]</figcaption></figure><p>Here we basically have two files namely <strong>Index.js</strong> and <strong>Childprocess.js </strong>respectively. <br>In our first file, we have first imported the <strong>fork() </strong>command from the child_process module, then we have forked the <strong>childprocess.js</strong> file which will be executed with the <strong>node</strong> command. Then we have the <strong>message</strong> event which will listen to any messages coming from the child process and then show it in the output using <strong>console.log() </strong>and finally, we are using <strong>send() </strong>for sending the message1 to the child process.<br>In our second file, we have another <strong>message</strong> event which will be listening for any messages coming from the parent process and displaying it using <strong>console.log </strong>and finally, we are using <strong>send() </strong>for sending the message2 to the parent process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wFXLCIuVG4yRdL3-AGU6Q.png" /></figure><p>This is how the output would look once we execute the index.js file using the node command. Since we are exchanging as well as listening to messages in both the files we have the output as we were expecting it to be.</p><h3>Conclusion</h3><p>This brings us to the end of this introductory blog regarding the child process module of Node.js. It was made to give the audience an overview regarding the module and If you’d like to know more about the module you should definitely check out the <a href="https://nodejs.org/api/child_process.html">official documentation</a> page of Nodejs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VqOyugZsyoKlDnYsYD-QtQ.png" /></figure><p>Blog by <a href="https://twitter.com/0x9747">Nerd </a>of <a href="https://ax1al.com/">AX1AL</a>. Join us at the <a href="https://cutt.ly/axial">discord </a>server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=debd984840f1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ax1al/the-child-process-module-a-brief-introduction-debd984840f1">The Child Process Module: A Brief Introduction</a> was originally published in <a href="https://medium.com/ax1al">RIXED_LABS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Session Hijacking: A brief Overview]]></title>
            <link>https://medium.com/ax1al/session-hijacking-a-brief-overview-e65480e887cb?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/e65480e887cb</guid>
            <category><![CDATA[websec]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 13:12:54 GMT</pubDate>
            <atom:updated>2021-02-03T13:12:54.602Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHLJo0zmqbfzF0sKdj1ykA.png" /></figure><h3>Introduction</h3><p>In this blog, we shall be discussing the session hijacking attack and how it can affect the end-users of a web-based platform, but before we begin I would like to give the audience a bit of idea regarding three terms namely <strong>Cookie</strong> and <strong>Session and Session ID</strong>.</p><p>A<strong> cookie</strong> is a file which is stored in a text form by a website that you would have visited on your browser. It helps websites to identify your device as well as storing certain information which could be referenced later on by the website in any of its functionality. It can be used for cases like tracking what you do on the website, making the usability of the website more effective and efficient, setting advertisements depending upon what the user does on the website etc.</p><p>A<strong> session </strong>is basically a group of interactions which has taken place between you (the end-user) and the web platform including all the clicks, changing of values and submitting any data. As we know that HTTP is a stateless connection protocol meaning that each request happening between the client and the host would be treated differently from each other, this would force the end-users to identify themselves on the website during every action or click they perform there. To avoid this issue, developers use sessions which basically saves the state of the user on the website and uses it as a reference in case the user visits the website again or goes to some other page on the same website. They can be reset or destroyed either after a certain duration from the session being created or when the user logs out of the platform hence making the chunks of data being temporarily stored on the device.</p><p>A <strong>session ID or session token </strong>is basically data usually in an encrypted form stored as a string. These tokens are used for the end-users to identify themselves on the website and it is done either through referencing the session token stored as a cookie, directly from the URL as a parameter or a hidden input value on the webpage.</p><h3>What is Session Hijacking?</h3><p>A Session Hijacking attack involves an attacker stealing the victim’s session token giving the attacker full control over the victim’s account since the attacker can use that session ID for authenticating to the website without the need for any credentials. To execute this attack, the attacker would generally send a malicious link to the victim which once opened would try to look out for the cookies storing the session ID of the victim and then send it data back to the attacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*-twYuqOtCLj91xQ8ktsB0A.png" /></figure><p>Let us understand the attack from the image which you can see on the left-hand side. Let us assume that we have a user called John who is a visitor of let’s say site XYZ which stores the session ID’s of registered/signed-in users in their browsers so that they can access it with ease when they visit the website again and John has an account registered there. In case 1, John decides to visit XYZ again, and since John had his session ID stored in the browser, the website would try to look out for the cookie storing the session ID and then log in to the platform using it. In case 2, let’s assume that John was sitting in a cafe where an attacker was able to capture the traffic going from John’s device to the website and hence was able to successfully find the session ID of John which was being used to log in to the website. Now the attacker can basically replace his session ID with that of John and log into the website without the need of any credentials of our user John. Now the attacker would have complete controls and powers that John had when he would normally visit the website.</p><h3>What are the attack vectors of Session Hijacking?</h3><p>In the following points, we will be discussing a few attack vectors which can lead to a successful session hijacking attack.</p><h4>Cross-site Scripting</h4><p>In this attack vector the attacker crafts special payloads for stealing the session token from a victim. It leverages the cross-site scripting vulnerability and can be targeted to selected individuals like in case of a reflective XSS vulnerability or any visitor of the page like in case of a stored XSS vulnerability.</p><p>Let us look at the payload listed below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*3f1rOUkExk_zFGtctMAHGA.png" /></figure><p>This payload would basically fetch all the cookies stored in the victim’s browser for the given website and then load another webpage which in this case is a malicious URL that we provided along with an empty token parameter. The PHP page would take the parameter which in our case are the cookies as an input and then save it on the attacker’s side. Although this payload is pretty basic, attackers would rely on sophisticated payloads depending upon the security level on the website and if there are any XSS filters in place.</p><h4>Packet Sniffing</h4><p>The attacker can rely on capturing the network traffic between the victim’s device and the website. If the requests being made to the website is through an unencrypted protocol (HTTP) it would be easier for an attacker to filter out the traffic and look out for the packets which contained the authentication requests along with the session token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BtK5TrTLTsUuBHrdGyP5SA.png" /></figure><p>In the above example, we can see one such packet which was a part of the HTTP requests made by a victim to the website. The request contains a cookie called <strong>PHPSESSID</strong> which stores the session token of the users on the browser. By performing a successful packet sniffing attack, an attacker can easily fetch the session ID of the victim which was being used for the target website. This token could now be used by the attacker to authenticate to the website as the victim.</p><h4>Guessing / Brute forcing</h4><p>In case the session IDs share some similar pattern, it could be used for guessing the session tokens of other users as well. In case the website uses the same set of session IDs or share some similarities, the attacker can use a list of those session IDs/segments for brute-forcing the authentication mechanism present on the website.</p><h3>Mitigating Session Hijacking Attacks</h3><p>Session Hijacking Attacks can be mitigated from the following but not limited to methods:</p><h4>Use random and unguessable Session IDs</h4><p>In order to prevent users from guessing or brute-forcing the session IDs, the developers can make sure that they use random and unguessable session IDs for the users which do not show any similarities across different users.</p><h4>Use HTTPS for visitors to access your website</h4><p>In order to prevent an attacker from finding the session IDs being passed in clear-text through the unencrypted HTTP protocol during a packet sniffing attack, the developers can make sure that the visitors access the website through HTTPS rather than HTTP which will help in encrypting all the traffic between a user’s device and the website.</p><h4>Use temporary session IDs</h4><p>In order to prevent attackers from using the session IDs of the victim in the long run, the developers can use temporary session IDs which are destroyed after every sign-out action or after a few hours/days forcing the users to authenticate to the website once again.</p><h4>Use the Secure Cookie Flag</h4><p>In order to prevent the cookies from being sent through the unencrypted HTTP protocol making the Session IDs available in clear-text, the developers can set the Secure Cookie Flag which forces the browsers of the users to only send the cookies on the website through the HTTPS protocol causing the traffic to be encrypted while sending it to the website.</p><h3>Let’s conclude</h3><p>Session hijacking is dangerous since it puts all the power of a user on the website at risk. It can be used for targeting anyone ranging from users having the least permissions to the one having the most (site administrators). It is important for an organization/website to implement certain mechanisms which can help mitigate this issue, some of which were listed above. It is also necessary for the developers to look out for other vulnerabilities on the platform and patch them since Session Hijacking can leverage the existing vulnerabilities on the website for executing the attack.</p><p>An equal level of precautions should be taken by the end-users as well. It is necessary that they trust the URLs that they visit and force their traffic to the website through the HTTPS protocol or else use a Virtual Private Network (<strong>VPN</strong>) which can help in preventing an attacker from getting the session ID during a packet sniffing attack.</p><h3>For Further Reference</h3><ul><li><a href="https://owasp.org/www-community/attacks/Session_hijacking_attack">Session hijacking attack</a></li><li><a href="https://www.netsparker.com/blog/web-security/session-hijacking/">What Is Session Hijacking: Your Quick Guide to Session Hijacking Attacks</a></li><li><a href="https://blog.eccouncil.org/what-is-session-hijacking-and-how-to-prevent-it/">What is session hijacking and how to prevent it? | EC-Council Blog</a></li><li><a href="https://www.imperva.com/learn/application-security/session-hijacking/">Session Hijacking | Imperva</a></li></ul><p>Make sure to dive deep into the topic of session hijacking. Till then happy Hacking, if you have any sort of feedback, please reach me out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*7E95fFvfLMkv78_elxa-Rw.png" /></figure><p>Blog by <a href="https://twitter.com/0x9747">Nerd </a>of <a href="https://twitter.com/AXI4L">AX1AL</a>. Join our <a href="https://discord.gg/DSQ4U9AbzN">Discord </a>server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e65480e887cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ax1al/session-hijacking-a-brief-overview-e65480e887cb">Session Hijacking: A brief Overview</a> was originally published in <a href="https://medium.com/ax1al">RIXED_LABS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript Obfuscation: What, Why and How?]]></title>
            <link>https://medium.com/ax1al/javascript-obfuscation-what-why-and-how-5a269e6b6d50?source=rss-c6fa7a905fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a269e6b6d50</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[code-obfuscation]]></category>
            <dc:creator><![CDATA[umair nehri]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 16:09:28 GMT</pubDate>
            <atom:updated>2021-01-26T16:09:28.772Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZFdl6ra5ffeORNpW.png" /></figure><h3>Introduction</h3><p>In this blog, we will be experiencing a beginner level introduction to Obfuscation in Javascript, its use cases and how exactly does it work. But before we begin let me introduce you to the two terms <strong>Javascript</strong> and <strong>Obfuscation</strong> for those who are not familiar with them.</p><h4><strong>What is Javascript?</strong></h4><p>It is an interpreted and lightweight programming language which you will find in most Dynamic websites these days. It’s one of the most recognised languages in the field of web development and has a variety of use cases in there which can vary from animating some element to handling the user input on the platform. If you’d like to learn more about it do check this awesome <a href="https://www.javascript.com/resources">resource section</a> put up by Pluralsight.</p><h4>What is Obfuscation?</h4><p>In software development, the term Obfuscation basically refers to the technique of making the source code of some application/program difficult to read for some other person, letting the functionality be the same as it was earlier.</p><p><strong>Let’s understand this concept from the below example,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*96K_d0HIVPm3Ts2JSHt2sw.png" /></figure><p>In the above image, we can see we have a line saying <strong>console.log(“hello world”) </strong>which will print hello world in the console tab of the browser. In the next part, we obfuscated that one line of code and converted it into 5 lines as well as made it difficult to read by some other person. The functionality remains the same here and it would print hello world in the console tab of the browser as expected.</p><h3>Why Obfuscation?</h3><p>There can be multiple reasons as to why a developer would want to obfuscate their code before using it in some public platform. Some of these reasons are:</p><ol><li><strong>Helps in optimizing the code and provides a faster experience</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*RFL2132CHhfdP5kvyhSHvw.png" /></figure><p>Although this reason varies from case to case, obfuscating your code can help to shrink the file size of your code as well providing a faster experience to the end-user.</p><p>2. <strong>Makes reverse engineering a longer process</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*IihCTr6WfUeHr-amX3793w.png" /></figure><p>Javascript is now being used in the majority of websites which provide a dynamic experience to the end-users. Even a small mistake or bug by the developers can introduce great risks to the platform if the attacker can analyze the code and exploit the flaw. So to make the reverse engineering of the code harder, developers would rely on obfuscating their code before pushing it to their public platforms.</p><p>3. <strong>Prevents people from copying your code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*_NKOLFSe3f7N9uK40tkY0w.png" /></figure><p>Obfuscating your code can help in preventing people from copying the code of your application without prior authorization. This way the end-user would have a difficult time reading and analyzing the code of the platform thereby decreasing the chance of any code being copied by someone.</p><h3>How Obfuscation?</h3><p>Now that you have a basic idea of what exactly is Obfuscation and why would you wanna use it, let us look into three basic techniques of Obfuscating your code.</p><h4><strong>Case 1: Garbage Code Insertion</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*i0hm5lk-uki3eTKMV-JPsA.png" /></figure><p>Garbage Code Insertion is basically adding dead code into your actual code which would never be executed during runtime. Although this technique isn’t that effective, it would help in making the analysis of the code harder for someone because they would have to go through the garbage code as well which would be placed anywhere in the actual code.</p><p>In the image, above you can see that we have a function which converts ASCII characters to hexadecimal format. We have added some portion of garbage code surrounded by comments mentioning where its placed, this code would never be executed but the rest will run like usual. Although what we used here is a very basic type of garbage code, developers would prefer complex functions as part of the garbage code, and the comments wouldn&#39;t be added here which is separating the garbage code from the actual code.</p><h4><strong>Case 2: Encoding (Custom / Pre-defined methods)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*GHf81CUcUUeUzIIMuS7nAg.png" /></figure><p><strong>In case of a custom function,</strong> the developers basically implement their own encoding/decoding functions which would basically take the encoded text as an input and process it during execution. This way these functions would not just serve the purpose of processing simple strings but even dedicated functions in encoded form. In the image on your left-hand side, we can see that we have a function which basically converts Hex bytes to ASCII, we have used it for passing the decoded output like what we can see in the comments part of the code to the eval() function as an argument for execution. In turn, the decoded output would now decode more hex bytes which will be saved as a value for some cookie using the document.cookie property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*BNuvK97QITyOdILTwRQj8g.png" /></figure><p><strong>In case of using pre-defined functions provided by Javascript,</strong> we can basically use functions like atob() “for decoding a base64 encoded string” and btoa() “for encoding a string to base64”. Let’s take an example, in the image on your left-hand side you can see that we have the atob() function decoding a base64 encoded string inside of the eval() function. The eval() function basically executes the argument provided to it as if it was part of the code and in this case, we provided the decoded output of the atob() function which will look like what we have mentioned in the commented part of the code. The function captures the keystrokes by the end-user and prints it in the Console tab.</p><h4>Case 3: Renaming functions and variables</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*GXQ9TIos5M63QAzK4xsSPQ.png" /></figure><p>In this case, the developers rename the functions and variables with gibberish text, hexadecimal patterns etc to make the reading and debugging process harder for someone who’s not familiar with the flow of control of the code. In the image on your left-hand side, we can notice the names of the functions and variables used here, the names are represented in the Hexadecimal format. Changing the names will not affect the flow of control of the code but would just make it harder for someone to analyse it properly because of the similarity in the names. One drawback here is that many debuggers can easily bypass this method and make the analysis comparatively easier.</p><h3>Summing it up</h3><p>Obfuscating your code can be helpful at times if implemented correctly and proper techniques are used for its implementation in the code. Obfuscation of phishing pages have been on a rise and attackers are trying to find new ways to bypass the detection mechanisms and debuggers from analysing their code. What we discussed in this blog was a very small portion of what Obfuscation in Javascript is like. There’s a ton of new and advanced techniques to have a strong obfuscation of code in place, I will be attaching a few resources to learn more about obfuscation which would be helpful for the readers to refer to.</p><h3>Resources</h3><h4>JavaScript Code Obfuscation Techniques For Malware Delivery</h4><p><a href="https://tech-zealots.com/malware-analysis/javascript-code-obfuscation-techniques/">JavaScript Code Obfuscation Techniques For Malware Delivery</a></p><h4><strong>No Beans About It: Why You Need Javascript Obfuscation</strong></h4><p><a href="https://www.preemptive.com/blog/article/1146-no-beans-about-it-why-you-need-javascript-obfuscation/106-risk-management">No Beans About It: Why You Need JavaScript Obfuscation</a></p><h4>A Beginners’ Guide to Obfuscation</h4><p><a href="https://blog.nettitude.com/uk/beginners-guide-obfuscation">A Beginners&#39; Guide to Obfuscation</a></p><h4>Obfuscation: Malware’s best friend</h4><p><a href="https://blog.malwarebytes.com/threat-analysis/2013/03/obfuscation-malwares-best-friend/">Obfuscation: Malware&#39;s best friend - Malwarebytes Labs</a></p><h4>A question of security: What is obfuscation and how does it work?</h4><p><a href="https://www.zdnet.com/article/a-question-of-security-what-is-obfuscation-and-how-does-it-work/">A question of security: What is obfuscation and how does it work? | ZDNet</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*7E95fFvfLMkv78_elxa-Rw.png" /></figure><p>Blog by <a href="https://twitter.com/0x9747">Nerd </a>of AX1AL. Join us at our <a href="https://discord.gg/rNWTeGQR">discord </a>server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a269e6b6d50" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ax1al/javascript-obfuscation-what-why-and-how-5a269e6b6d50">Javascript Obfuscation: What, Why and How?</a> was originally published in <a href="https://medium.com/ax1al">RIXED_LABS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>