<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brian levu on Medium]]></title>
        <description><![CDATA[Stories by Brian levu on Medium]]></description>
        <link>https://medium.com/@brianislevu?source=rss-bf0e1f4dfd73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oT1Uadw9D4wLJU5JJKPe5A.jpeg</url>
            <title>Stories by Brian levu on Medium</title>
            <link>https://medium.com/@brianislevu?source=rss-bf0e1f4dfd73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 27 May 2026 04:50:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brianislevu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Redis sounds like reh·duhs]]></title>
            <link>https://medium.com/@brianislevu/redis-sounds-like-reh-duhs-696032436d37?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/696032436d37</guid>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Wed, 24 Jan 2024 13:32:26 GMT</pubDate>
            <atom:updated>2024-01-24T13:32:26.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/262/0*STNzBWr2-G57lqYk" /><figcaption><a href="https://images.app.goo.gl/fLd3QzjG8Eo89mBt8">https://images.app.goo.gl/fLd3QzjG8Eo89mBt8</a></figcaption></figure><p><strong>Introduction</strong></p><p>Redis is a data structure store that stores data in memory and can be used as a database, cache, or message broker. It is known for its speed and simplicity. To understand it better, imagine a grocery store where you can easily access items without having to go to the warehouse (disk storage). The store keeps the most popular and frequently used items on the shelves for quick and easy retrieval.</p><p><strong>Basic Operations in Redis:<br>Installation</strong>:</p><p>You can download and install Redis from the <a href="https://redis.io/download/">official website</a>. In a linux environment, run:</p><pre>sudo apt-get -y install redis-server</pre><p><strong>Starting Redis Server:</strong></p><p>After installation, start the Redis server by running the following command in the terminal:</p><pre>redis-server</pre><p><strong>Connecting to Redis:</strong></p><p>You can connect to Redis using the Redis command-line client:</p><pre>redis-cli</pre><p><strong>Basic Redis Commands:<br>SET and GET:</strong></p><pre>SET key_name value # Sets the value of a key.<br>GET key_name # Retrieves the value associated with a key.<br>Example:<br>SET username john_doe<br>GET username</pre><p><strong>Lists:</strong></p><pre>LPUSH list_name value # Adds a value to the left end of a list<br>RPUSH list_name value # Adds a value to the right end of a list<br>LRANGE list_name start stop # Retrieves a range of values from a list.<br>Example:<br>LPUSH mylist 10<br>LPUSH mylist 20<br>LRANGE mylist 0 -1</pre><p><strong>Hashes:</strong></p><pre>HSET hash_name field value # Sets the value of a field within a hash<br>HGET hash_name field # Retrieves the value of a field within a hash.<br>Example:<br>HSET user:1 username john_doe<br>HSET user:1 email john_doe@example.com<br>HGET user:1 username</pre><p><strong>Using Redis as a Simple Cache:<br></strong>Redis is often used as a cache due to its speed. Here’s a basic example using Python and the redis-py library:</p><pre>pip install redis</pre><pre># main.py<br>#!/usr/bin/env python3<br><br>import redis<br>import time<br><br># Create a Redis client<br>redis_client = redis.StrictRedis(host=&#39;localhost&#39;, port=6379, db=0)<br><br># Define the cache key<br>cache_key = &#39;user:1&#39;<br><br># Start measuring the time<br>start_time = time.time()<br><br># Check if the data is already cached<br>cached_data = redis_client.get(cache_key)<br><br>if cached_data:<br>    # Data is retrieved from cache<br>    end_time = time.time()<br>    print(&#39;Data retrieved from cache:&#39;, cached_data.decode(&#39;utf-8&#39;))<br>    print(&#39;Time taken to retrieve from cache:&#39;, end_time - start_time, &#39;seconds&#39;)<br>else:<br>    # Data is not cached, retrieve from the database<br>    start_time = time.time()<br>    print(&#39;Cache miss&#39;)<br>    user_data = {<br>        &#39;id&#39;: 1,<br>        &#39;name&#39;: &#39;jane Doe&#39;,<br>        &#39;email&#39;: &#39;janed@mail.com&#39;<br>    }<br>    # Store the data in the cache<br>    redis_client.set(cache_key, str(user_data))<br><br>    end_time = time.time()<br>    print(&quot;Data retrieved from database: &quot;, user_data)<br>    print(&#39;Time taken to retrieve from database:&#39;, end_time - start_time, &#39;seconds&#39;)<br># run python3 main.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oxa_LcuWCViOA503qD1YCQ.png" /></figure><p>This Python script uses Redis as a cache. It checks if user data with ID 1 is in the cache. If found, it prints the data and the time taken to retrieve it. If not, it simulates a cache miss, fetches the user data from a database, stores it in the cache, and prints the data along with the time taken.</p><p>This illustrates the importance of using Redis to quickly access frequently used data, reducing the need to retrieve it from slower databases every time, resulting in faster response times for applications.</p><p><strong>Conclusion:</strong></p><p>To put it simply, Redis can be thought of as a high-speed, in-memory grocery store where you can quickly retrieve items based on unique identifiers. It is excellent at storing and retrieving data in a fast and efficient manner, making it an ideal choice for situations where speed is crucial - just like quickly getting your groceries from a well-organized store.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=696032436d37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happens when you type https://www.google.com in your browser and press Enter?]]></title>
            <link>https://medium.com/@brianislevu/what-happens-when-you-type-https-www-google-com-in-your-browser-and-press-enter-e27331586d1f?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/e27331586d1f</guid>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Sun, 15 Oct 2023 21:23:18 GMT</pubDate>
            <atom:updated>2023-10-15T21:23:18.110Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsSaZpQYMcIRqMhJLp2-PA.png" /></figure><p><strong>Introduction:</strong></p><p><strong>The Web’s Building Blocks</strong><br>At its core, the web is built upon a few fundamental components that work together to deliver the content you see on your screen. These components include DNS, TCP/IP, firewalls, HTTPS/SSL, load balancers, web servers, application servers, and databases. Let’s dive into the step-by-step journey of your web request and understand the importance of each stage.</p><blockquote>Main technologies that are utilized</blockquote><p><strong>DNS Resolution:</strong> Translates domain names into IP addresses, so your browser knows where to find the website.</p><p><strong>TCP/IP</strong>: Establishes a secure and reliable connection for data transmission.</p><p><strong>Firewall:</strong> Acts as a security guard, filtering network traffic to protect against threats.</p><p><strong>HTTPS/SSL:</strong> Encrypts data during transmission, ensuring privacy and security.</p><p><strong>Load Balancer:</strong> Distributes incoming requests among multiple servers for enhanced performance and reliability.</p><p><strong>Web Server:</strong> Fetches and processes web page resources, making the page visible.</p><p><strong>Application Server:</strong> Handles complex tasks like user authentication and personalized content.</p><p><strong>Database:</strong> Stores and manages data, serving as the backbone for dynamic web applications.</p><p><strong>The process</strong></p><p><strong>1. DNS Request (The Internet’s phone book):<br></strong>When you type a web address like “<a href="http://www.google.com">www.google.com</a>,&quot; your browser doesn’t know where that site is located. It sends a request to a special directory service called DNS (Domain Name System).</p><p>DNS takes the web address and returns a numerical IP address (8.8.8.8), which is like a unique phone number for the website. This IP address tells your computer where to find “<a href="http://www.google.com">www.google.com</a>.&quot;</p><p><strong>2. TCP/IP (The Internet’s postal system):<br></strong>Once your browser knows the IP address, it’s like knowing the exact postal address of a friend. It establishes a connection using TCP/IP, which is like the internet’s postal system.</p><p>This triggers the initiation of the Transport Layer Security (TLS) protocol, previously known as Secure Sockets Layer (SSL). During this step, your browser and Google’s server exchange encryption keys and create a secure channel to protect the data transmission.</p><p>This ensures your computer can send and receive data reliably, making sure no messages get lost on the way.</p><p><strong>3. Firewall (Your digital gatekeeper):<br></strong>If your computer has a firewall, think of it as a security guard. It checks if the data coming in and going out is safe. But, in most cases, it doesn’t interfere with trusted websites like Google.</p><p><strong>4. HTTPS/SSL (The digital lock):<br></strong>You might have noticed the “https://” in the web address. That “s” stands for secure. It means your connection is encrypted, just like a letter in a locked envelope.</p><p>SSL (Secure Sockets Layer), or its modern version, TLS (Transport Layer Security), ensures that the data between your computer and the website is private and secure.</p><p><strong>5. Load Balancer (The Traffic Cop):<br></strong>Big websites like Google have lots of computers working together. A load balancer is like a traffic cop that directs your request to one of these computers, ensuring that no single server gets overwhelmed.</p><p><strong>6. Web Server (The content provider):<br></strong>The web server is like a chef. It prepares and serves the webpage you requested. In this case, it’s Google’s server that sends you the Google homepage.</p><p>Once the server processes your request, it sends back a response containing the HTML, CSS, JavaScript, and other resources that constitute the Google homepage. Your browser receives this data and begins rendering the webpage, formatting it for display on your screen.</p><p><strong>7. Application Server (Making things happen):<br></strong>In the background, there might be an application server working alongside the web server. Think of it as the chef’s assistant, responsible for more complex tasks like processing search queries.</p><p><strong>8. Database (Where the information is stored):<br></strong>The database is like a library that stores all the information Google needs. It holds search results, user profiles, and more.</p><p>When you search on Google, the application server consults the database to fetch the results for you.</p><p><strong>Conclusion:<br></strong>And there you have it — from typing “<a href="https://www.google.com">https://www.google.com</a>&quot; in your browser to seeing the Google homepage. It’s a journey that involves translating web addresses, establishing secure connections, distributing the load, and ultimately, serving you the web content you want to see. Understanding the various components involved, such as DNS resolution, secure connections, server processing, rendering, and caching, sheds light on the magic that makes web browsing possible. Each step, carried out by a combination of hardware, software, and network technologies, contributes to the efficient and reliable delivery of web content. Next time you enter a URL and hit Enter, you’ll have a deeper appreciation for the intricate dance of technology that occurs behind the scenes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e27331586d1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Ways to Speed Up Your SSH Game]]></title>
            <link>https://medium.com/@brianislevu/3-ways-to-speed-up-your-ssh-game-7155bcb2862a?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/7155bcb2862a</guid>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Mon, 09 Oct 2023 22:55:51 GMT</pubDate>
            <atom:updated>2023-10-09T22:55:51.801Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/276/0*NxOmH9ur74FmMrZo" /><figcaption><a href="https://images.app.goo.gl/ij6pshrYqLw829nY9">https://images.app.goo.gl/ij6pshrYqLw829nY9</a></figcaption></figure><p>Unlock the potential of SSH with these three powerful techniques. Multiplex your connections for lightning-fast access, streamline your commands with SSH config files, and bolster security while eliminating password hassles with SSH keys. Say goodbye to sluggish SSH sessions and embrace efficiency with these game-changing tips.</p><blockquote><strong>note</strong>: IPs used are randomly generated from <a href="https://www.ipvoid.com/random-ip/">randomipgenerator</a></blockquote><p><strong>1. Multiplex your connections:</strong></p><p>Reusing existing SSH connections can significantly reduce latency and speed up your workflow. You can achieve this using SSH’s built-in connection-sharing feature.</p><blockquote>Example: # Enable SSH connection sharing in your SSH config file (~/.ssh/config)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*8fJyoxXCw1Xz6focmoCYIQ.png" /></figure><p>Now, connect to your servers as usual.</p><pre>ssh ubuntu@188.151.156.127</pre><p><strong>(Host *): </strong>This part of the SSH config file specifies a configuration block that applies to all SSH connections.<br><strong>ControlMaster auto:</strong> This line tells SSH to enable connection sharing. When set to auto, SSH will automatically establish a master connection that can be reused for subsequent connections.<br><strong>ControlPath ~/.ssh/control:%h:%p:%r:</strong> This line defines the location and naming pattern for the control socket file that SSH will use to manage the shared connection. %h, %p, and %r are placeholders that get replaced with the hostname, port, and remote username.<br><br><strong>How It Works:</strong></p><ol><li>When you have the ControlMaster auto and ControlPath settings in your SSH config, SSH, upon the first connection to any server, will establish a “master” connection to that server and create a control socket file (~/.ssh/control:%h:%p:%r).</li><li>For subsequent SSH connections to any server, SSH will reuse this master connection if possible, saving time and reducing latency. It eliminates the need to establish a new connection for every SSH command, making your SSH sessions faster and more efficient.</li><li>SSH will automatically utilize the shared connection if available, offering a significant performance improvement, especially when connecting to multiple servers repeatedly.</li></ol><p>With connection sharing enabled, subsequent SSH connections to the same server will reuse the existing connection, saving time and reducing latency. You should notice that the second connection to the same server is much faster because it reuses the existing master connection</p><p><strong>2. Employ SSH Config Files:</strong></p><p>SSH config files allow you to simplify SSH commands and organize your connections efficiently.</p><blockquote>Example:Create or edit your SSH config file (~/.ssh/config) and add entries like this:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*XEb3kgmb7wY7CgZ7yjQNCw.png" /></figure><p>Now, you can connect to your servers using shorter commands:</p><pre>ssh server1</pre><p><strong>3. Use SSH keys:</strong></p><p>SSH keys provide a secure and efficient way to authenticate without passwords.</p><blockquote>Example:Generate an SSH key pair if you haven’t already:</blockquote><pre>ssh-keygen -t rsa -b 4096</pre><p>Copy your public key to the remote servers:</p><pre>ssh-copy-id ubuntu@188.151.156.127</pre><p>Now, you can SSH into your servers without entering a password</p><p>By using these techniques, you’ll experience faster and more efficient SSH connections, making your server management tasks a breeze.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7155bcb2862a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Injection: A Practical Guide]]></title>
            <link>https://medium.com/@brianislevu/sql-injection-a-practical-guide-7e76e4fd6b17?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e76e4fd6b17</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Tue, 19 Sep 2023 22:01:40 GMT</pubDate>
            <atom:updated>2023-09-19T22:09:02.553Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LrqdD7LOHVd3TwUN" /><figcaption>Photo by <a href="https://unsplash.com/@diana_pole?utm_source=medium&amp;utm_medium=referral">Diana Polekhina</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>An attacker can modify application input so that it can be read by the program’s database as SQL code, which is known as SQL injection (SQLi), a sort of cyberattack. The database can then execute this malicious input, which may result in unauthorized access, data alteration, or even data theft.</p><p><strong>How SQL Injection Works</strong></p><p>SQL injection works by taking advantage of flaws in an application’s code that let user inputs that haven’t been vetted or sanitized be added to SQL queries. Here’s a step-by-step breakdown:</p><ol><li><strong>User Input: </strong>An application typically takes user input through forms, URL parameters, or other means.</li><li><strong>Lack of Sanitization:</strong> Insecure applications fail to properly validate or sanitize this input. Instead of treating user input as harmless data, they directly include it in SQL queries without verifying its content.</li><li><strong>Malicious Input:</strong> An attacker submits malicious input, which may include SQL statements, into the application’s input fields. For example, they might input ‘ OR ‘1’=’1 in a login form’s username field.</li><li><strong>SQL Query Manipulation:</strong> Because the input is not properly validated, the attacker’s input is concatenated with the application’s SQL query. The resulting query can be something like: SELECT * FROM users WHERE username = ‘’ OR ‘1’=’1&#39; AND password = ‘…’.</li><li><strong>Unauthorized Access:</strong> In this manipulated query, ‘1’=’1&#39; is always true, so the query returns all records in the “users” table, effectively bypassing authentication. The attacker gains unauthorized access to the application.</li></ol><blockquote>Here are five types of SQL injection techniques. Be sure to use these responsibly and only in controlled environments:</blockquote><p><strong>Classic SQL Injection:</strong></p><p><strong>Purpose</strong>: This is the most basic SQL injection. It typically tricks the application into accepting ‘always true’ conditions, allowing unauthorized access.</p><p><strong>Union-based SQL Injection:</strong></p><p><strong>Purpose</strong>: Union-based injections exploit the UNION SQL clause to combine the result of the original query with a crafted query.</p><p><strong>Blind SQL Injection (Boolean-Based):</strong></p><p><strong>Purpose</strong>: Blind SQL injection doesn’t reveal data directly. Instead, it relies on the application’s response to infer whether the injected condition is true or false.</p><p><strong>Time-Based Blind SQL Injection:</strong></p><p><strong>Purpose</strong>: Similar to boolean-based injection, this one uses a time delay to infer true or false conditions. If the application sleeps for a specified time, the attacker can conclude the condition is true.</p><p><strong>Out-of-Band SQL Injection:</strong></p><p><strong>Purpose</strong>: This type of injection attempts to initiate a DNS or HTTP request from the database server to an external server controlled by the attacker. It can be used to exfiltrate data or control other systems.</p><p><strong>Examples:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVun3kMlcnqmQOnlNK4_1A.png" /><figcaption>In this example first, an authorized user can log in successfully,</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l64rUCPtRZekCGYegYa9Yg.png" /><figcaption>we then try out the wrong credentials and we get denied as expected.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81Pw4Hw4nQM-gX9aK_dqtw.png" /><figcaption>In this case, we can bypass the login form</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3DrJePZjHzezXYW0k4i6EQ.png" /><figcaption>the ability to get user details by providing account name can be exploited</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iavu3anvlwfTyzNggcmOaw.png" /><figcaption>we are able to see all users&#39; confidential information</figcaption></figure><p>An attacker can modify the information by deleting all entries, adding $1000 to their balance, and many more.</p><p><strong>Risks of SQL Injection</strong></p><p>SQL injection attacks pose significant risks to both the application owner and its users:</p><ol><li>Data Breaches: Attackers can extract sensitive data from the database, including usernames, passwords, credit card numbers, and personal information.</li><li>Data Manipulation: Attackers can modify, delete, or insert data into the database, causing data corruption or loss.</li><li>Unauthorized Access: Attackers can gain unauthorized access to restricted areas of an application, including administrative panels or user accounts.</li><li>Account Takeovers: By extracting hashed passwords, attackers can launch offline attacks to crack them and take over user accounts.</li></ol><p><strong>Common Targets of SQL Injection</strong></p><p>SQL injection attacks can target various parts of a web application, including:</p><ol><li>Login Forms: Attackers attempt to bypass authentication by injecting SQL code into username and password fields.</li><li>Search Boxes: If a search box allows user input to be included in SQL queries, it can be exploited to perform SQL injection attacks.</li><li>URL Parameters: Applications that construct SQL queries based on URL parameters are susceptible to attacks if those parameters are not properly validated.</li><li>Forms and Data Entry Fields: Any form that accepts user input and uses it to construct SQL queries is a potential target.</li><li>API Endpoints: APIs that accept user input and use it in database queries must ensure the input is properly sanitized to prevent SQL injection.</li></ol><p><strong>Best Practices for Preventing SQL Injection Attacks</strong></p><ol><li>Input Validation: Always validate and sanitize user input. Ensure that data entered by users matches the expected format and constraints.</li><li>Stored Procedures: Implement stored procedures within your database. These predefined routines can be called with user input, significantly reducing the risk of SQL injection.</li><li>Least Privilege Principle: Limit the permissions of database accounts used by your application. They should have the minimum necessary privileges to access only the required tables and data.</li><li>Input Sanitization Libraries: Leverage libraries and frameworks that offer built-in input sanitization and validation. For instance, Django provides robust security features.</li><li>Security Audits: Conduct periodic security audits to identify vulnerabilities, including SQL injection risks. Use automated security scanning tools and manual testing to find and fix weaknesses.</li><li>Code Reviews: Integrate security reviews into your code review process. Encourage team members to spot potential vulnerabilities and apply secure coding practices.</li><li>Prepared Statements: They are templates for SQL queries with placeholders for user input. These statements are precompiled by the database and provide a robust defense against SQL injection.</li><li>ORM (Object-Relational Mapping) Frameworks: ORM frameworks, like SQLAlchemy in Python or Hibernate in Java, abstract database interactions. They generate safe SQL queries based on high-level object manipulation, reducing the risk of manual SQL injection.</li><li>Parameterized Queries: Use prepared statements or parameterized queries provided by your database framework or programming language. These mechanisms automatically escape user input, preventing SQL injection.</li></ol><p><strong>Conclusion</strong></p><p>In conclusion, blocking SQL injection attacks is crucial for the security of web applications. Developers may greatly lower the danger of SQL injection by adhering to best practices including input validation, parameterized queries, and the principle of least privilege.</p><p>The use of prepared statements and ORM frameworks adds another layer of security. Code reviews and security audits on a regular basis aid in maintaining a proactive security posture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e76e4fd6b17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Definitive Guide to Application Security]]></title>
            <link>https://medium.com/@brianislevu/definitive-guide-to-application-security-7993b66a51b1?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/7993b66a51b1</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[mfa]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Mon, 11 Sep 2023 20:58:39 GMT</pubDate>
            <atom:updated>2023-09-11T20:58:39.953Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PVs3q_gspYoZ75Jx.png" /><figcaption><a href="https://images.app.goo.gl/C3t2NhMPGwihFqi1A">https://images.app.goo.gl/C3t2NhMPGwihFqi1A</a></figcaption></figure><p><strong>Common Authentication Methods</strong></p><p>Authentication methods have evolved over time, driven by technological advances and the growing sophistication of cyber threats.</p><blockquote>Let’s explore some of the most common methods used today:</blockquote><p><strong>Password-Based Authentication<br></strong>The most popular method of authentication requires users to submit a username and password. While straightforward, if not used securely, it is vulnerable to attacks. Implement strict password rules that oblige users to choose secure passwords. These passwords ought to be made up of a combination of uppercase, lowercase, numerals, and special characters. Users should be encouraged to regularly change their passwords. Passwords are <a href="https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html">hashed</a> and <a href="https://www.globalsign.com/en/blog/what-is-password-salting">salted</a> for security purposes.</p><p><strong>Multi-Factor Authentication (MFA)<br></strong>By forcing users to provide two or more factors to verify their identity, MFA adds an extra degree of protection. Usually, this entails something they are, something they own, or something they know (password) (biometrics). A further degree of security is added via MFA. It also needs something users are (like a smartphone) or something they know (like a password) (biometric data). Use MFA while performing sensitive operations like account recovery or transactions.</p><p><strong>Token-Based Authentication<br></strong>After a successful login, token-based authentication issues a time-limited token. Subsequent requests use the token, eliminating the need to send sensitive credentials with each communication.</p><p><strong>OAuth 2.0 and OpenID Connect<br></strong>Delegated access is enabled by the authorization framework OAuth 2.0. OpenID Connect is a well-liked option for single sign-on (SSO) solutions because it expands OAuth 2.0 to include authentication. OAuth 2.0 is a great option if your application communicates with external APIs. Without disclosing user credentials, it enables secure token-based authentication. Make sure to securely store critical OAuth data, such as client secrets.</p><p><strong>Biometric Authentication<br></strong>Biometric authentication verifies authenticity using behavioral or physical traits, such as fingerprints or facial recognition. It is increasingly prevalent in secure institutions and on mobile devices.</p><blockquote>Here are some other best practices that will enhance the safety of your applications:</blockquote><p><strong>Protect Against Brute Force Attacks<br></strong>To counter brute-force assaults, implement rate limitation and account lockout features. Lock the user account momentarily when a predetermined number of login attempts fail. Inform users of any ominous activity.</p><p><strong>Encrypt Data in Transit and at Rest<br></strong>To encrypt data sent between the client and server, use HTTPS (SSL or TLS). Moreover, secure any sensitive data kept on disk or in databases. Keys for encryption should be kept safely.</p><p><strong>Implement Session Management<br></strong>Maintain secure user sessions. Use unique session tokens and regularly refresh them. Implement session timeouts for inactivity and allow users to log out manually.</p><p><strong>Keep Software and Libraries Updated<br></strong>Regularly update your application’s software, libraries, and dependencies. Security vulnerabilities can emerge over time, and updates often contain patches to address these issues.</p><p><strong>Educate Users on Security<br></strong>Inform your users of sound security procedures. Encourage them to create unique passwords just once, to use password managers, and to be wary of phishing scams. With your app’s documentation or through in-app messages, raise security awareness.</p><p><strong>Monitor for Suspicious Activity<br></strong>Implement logging and monitoring to detect and respond to suspicious activities. Anomaly detection can help identify unusual login patterns or other security threats.</p><p><strong>Plan for Account Recovery<br></strong>Have a secure account recovery process in place. Ensure it’s not easily exploitable by attackers attempting to gain unauthorized access.</p><p><strong>Regular Security Audits<br></strong>Conduct regular security audits and penetration testing to identify vulnerabilities in your authentication system. Address any issues promptly.</p><p>You could build a robust and secure authentication system that safeguards your application and user data from numerous attacks by adhering to these best practices. Keep in mind that maintaining security involves regular observation and development.</p><p>In summary, authentication is essential for protecting your application and user data. In today’s digital environment, implementing strong authentication systems is not only a great practice but also a basic requirement.</p><p>Keep an eye out for more articles on application security, where we’ll investigate different facets of protecting your applications against changing threats.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7993b66a51b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application security]]></title>
            <link>https://medium.com/@brianislevu/application-security-8bbed87dd2be?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bbed87dd2be</guid>
            <category><![CDATA[application-security]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[env]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Mon, 04 Sep 2023 04:57:52 GMT</pubDate>
            <atom:updated>2023-09-04T04:57:52.487Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Protecting Sensitive Data with .env files</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*LuixaFgxWWdc-3Om.jpg" /><figcaption><a href="https://images.app.goo.gl/b4eLosbTEBAVPVkQ7">https://images.app.goo.gl/b4eLosbTEBAVPVkQ7</a></figcaption></figure><p><strong>Introduction:</strong></p><p>Protecting sensitive data is crucial for both personal projects and enterprise-level systems. Managing sensitive information like API keys and database credentials is essential for fortifying application defenses. Using.env files, which protect secrets and ensure smooth application operation, is essential for building resilient, secure applications. Understanding and implementing these security best practices is crucial for ensuring data protection and preventing unauthorized access.</p><p><strong>The Role of Environment Variables:</strong></p><p>Environment variables serve as placeholders for configuration values required by your applications to function properly. Database connection strings, API keys, and other sensitive information are examples of these values.</p><p>The problem arises when developers hard-code sensitive data into their codebase. While this may appear to be convenient during development, it poses a serious security risk. Your sensitive data becomes vulnerable if an attacker gains access to your source code or if you accidentally expose it publicly.</p><p><strong>What is a .env File?</strong></p><p>A.env file is a text file that is used to structurally store configuration values, including sensitive data. It is a widely accepted industry practice for managing environment variables securely. A.env file’s primary purpose is to separate configuration from code, making it easier to manage sensitive information while lowering the risk of exposure.</p><p>It is simple to create a.env file. It’s usually a plain text file called.env that’s placed in your application’s root directory. Within this file, you define your environment variables and their values using the following syntax:</p><pre>SECRET_KEY=mysecretkey<br>DATABASE_URL=postgres://user:password@localhost/mydatabase<br>API_KEY=yourapikeyhere</pre><p><strong>Creating and Managing .env Files:</strong></p><p>Begin by determining which environment variables your application requires before creating a.env file. These variables should include any sensitive data on which your application is dependent. To make the purpose of your variables clear, give them descriptive names.</p><p>Once your.env file is complete, keep it safe. Avoid committing it to version control systems such as Git, which may expose your sensitive data to unauthorized users. Use.gitignore to exclude the.env file from your repository instead.</p><p><strong>Loading and Using .env Variables:</strong></p><p>To utilize environment variables from your .env file in your application, you need to load them into your environment. Python developers often use libraries like python-decouple or python-dotenv for this purpose. Here’s a simplified example using python-dotenv:</p><pre>from dotenv import load_dotenv<br><br># Load variables from .env file<br>load_dotenv()<br><br># Access environment variables<br>SECRET_KEY = os.getenv(&quot;SECRET_KEY&quot;)<br>DATABASE_URL = os.getenv(&quot;DATABASE_URL&quot;)<br>API_KEY = os.getenv(&quot;API_KEY&quot;)</pre><p>Once loaded, you can use these variables throughout your application, such as connecting to databases, authenticating with APIs, or configuring application settings.</p><p><strong>Security Best Practices:</strong></p><p>It is critical to protect your.env files. Set strict file permissions to limit who can access them first. Consider encrypting or hashing sensitive data within your.env file to make it more difficult for attackers to decipher even if they gain access.</p><p>Keep in mind that protecting sensitive data is an ongoing process. Review and update your environment variables on a regular basis, especially when roles or access requirements change within your application.</p><p><strong>Benefits of Using .env Files:</strong></p><blockquote>Why should you bother with .env files? Here are some compelling reasons:</blockquote><ol><li><strong>Enhanced Security:</strong> Separating sensitive data from your codebase reduces the risk of data breaches and unauthorized access.</li><li><strong>Maintainability: </strong>Keeping configuration settings in one place simplifies maintenance and makes it easier for collaborators to understand and modify application settings.</li><li><strong>Collaboration:</strong> .env files facilitate collaboration among developers by standardizing how configuration is managed.</li></ol><p><strong>Common Security Risks and Mitigations:</strong></p><p>Understanding the common security risks associated with sensitive data exposure is essential. By knowing these risks, you can implement effective mitigations.</p><blockquote>Some risks to be aware of include:</blockquote><ol><li><strong>Code Exposure:</strong> When code is exposed, sensitive data within it can be discovered by malicious actors. To mitigate this risk, avoid committing .env files to version control and use encryption or hashing for sensitive data.</li><li><strong>Inadequate Permissions:</strong> Incorrect file permissions can lead to unauthorized access. Set strict permissions on .env files to limit access to authorized users and groups only.</li></ol><p><strong>Conclusion:<br></strong>Protecting sensitive data is a critical component of application security. Using.env files to manage your environment variables is a positive step. By following the security guidelines outlined in this article and implementing this best practice, you will significantly reduce the risk of data breaches and unauthorized access to your applications.</p><p>Keep in mind that security is an ongoing commitment. Review and update your security practices on a regular basis to stay ahead of potential threats and ensure the safety of your applications and their users.</p><p><strong>Additional Resources:<br></strong><a href="https://pypi.org/project/python-decouple/">python-decouple<br></a><a href="https://pypi.org/project/python-dotenv/">python-dotenv<br></a><a href="https://owasp.org/www-project-top-ten/">OWASP Application Security<br></a><a href="https://www.honeybadger.io/blog/securing-environment-variables/">Securing Environment Variables in Linux</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*438RVSBa7bFFNdnz" /><figcaption><a href="https://images.app.goo.gl/8JBhz5Vcr1bgToKm6">https://images.app.goo.gl/8JBhz5Vcr1bgToKm6</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bbed87dd2be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Penetration Testing Journey]]></title>
            <link>https://medium.com/@brianislevu/a-penetration-testing-journey-b16275bc0b74?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/b16275bc0b74</guid>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[malloc]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 13:42:21 GMT</pubDate>
            <atom:updated>2023-08-30T21:14:49.386Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Memory Vulnerabilities</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*BHZu1fcC1cZOeamu.jpg" /></figure><p><strong>Introduction:</strong></p><p>Memory management is an integral part of software development that directly impacts performance, stability, and security. In this post, we’ll go on a journey to investigate the flaws that can afflict a bespoke memory manager solution. We’ll investigate numerous types of vulnerabilities, do penetration testing, and analyze the results to draw conclusions regarding the memory manager’s resilience and security.</p><p><strong>Types of Vulnerabilities:</strong></p><ol><li>Memory leaks: Assume you have a cookie jar. You take cookies out to eat, but you sometimes forget to return the empty wrappers to the jar. Your room becomes packed with cookie wrappers over time, and you can’t find anything. Memory leaks occur in programming when your program consumes memory to store data but fails to free the memory when it is finished. This might result in a “clutter” of unused memory, which slows down your software and eventually causes it to run out of memory.</li><li>Uninitialized variables: Consider uninitialized values to be blank pages in a notepad. You’ll become confused and make mistakes if you try to do math using blank notes. In programming, uninitialized values are analogous to variables that have not been assigned an initial value. When you use these variables, your application may perform erratically, resulting in errors or crashes.</li><li>Buffer overflows: Assume you have a row of cups and are pouring juice into each one. If you pour too much juice, it will spill and make a sloppy mess. Buffer overflows occur in programming when you attempt to put more data into a container (such as an array) than it can handle. This can cause the additional data to overflow into other areas of the computer’s memory, potentially overwriting crucial data or crashing the program.</li><li>Invalid memory access: Consider computer memory to be a bookshelf with clearly labeled parts. Each part contains unique information. If you reach for a book on a shelf without a label, you can get the wrong book or nothing at all. In programming, an invalid memory access occurs when your software attempts to read or write data in a section of memory where it is not permitted. This can result in crashes or security flaws.</li><li>Double frees: Consider it like returning a library book twice. When you borrow a book from the library, you only need to return it once. If you return the same book twice, the librarian may become confused and fine you. When allocating memory (like borrowing a book) and then freeing it (like returning the book), you should only do it once. Duplicate frees occur when the same memory is mistakenly freed twice. This can create memory issues, crashes, and unpredictable behavior in your software, similar to how returning a library book twice might cause confusion.</li></ol><p><strong>Penetration Testing Techniques:</strong></p><blockquote>Memory Leaks: Technique: Allocate Memory Without Deallocating</blockquote><p>To test for memory leaks, intentionally allocate memory for data structures or objects and then avoid deallocating (freeing) that memory. This creates a scenario where memory is allocated but not properly released. By monitoring the memory usage of your program, you can detect any increases in memory consumption that indicate a memory leak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*H61RVQZJ13KkbcNpzNg61A.png" /></figure><pre>void test_memory_leak() {<br> // Allocate memory without deallocating<br> int *data = malloc(sizeof(int));<br>}</pre><blockquote>Uninitialized Values: Technique: Use Uninitialized Variables</blockquote><p>In this test, you intentionally use variables without initializing them first. Running your program in this state can result in unpredictable behavior, crashes, or incorrect results. This technique helps uncover scenarios where uninitialized values are accessed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*XXbNYpXEbuxBf2BDz27CQw.png" /></figure><pre>void test_uninitialized_values() {<br> int uninitialized_value;<br> printf(&quot;Uninitialized value: %dn&quot;, uninitialized_value);<br>}</pre><blockquote>Buffer Overflows: Technique: Input Data Larger Than Buffer</blockquote><p>Simulate buffer overflows by providing input data that exceeds the bounds of an allocated buffer. This helps identify if your program is properly checking the length of input and avoiding overflows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*xfa3wfhUA1Yl1rJYpfE5_g.png" /></figure><pre>void test_buffer_overflow() {<br> char buffer[10];<br> strcpy(buffer, &quot;This is a very long string that overflows the buffer&quot;);<br>}</pre><blockquote>Invalid Memory Access: Technique: Access Memory Out of Bounds</blockquote><p>Attempt to access memory beyond the boundaries of an allocated buffer or an invalid memory location. This helps reveal if your program is properly validating memory access and avoiding invalid memory access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*fRR376qsuRktkmxDjH2nOw.png" /></figure><pre>void test_invalid_memory_access() {<br> int arr[5];<br> int value = arr[10]; // Accessing memory out of bounds<br>}</pre><blockquote>Double Frees: Technique: Free Memory Twice</blockquote><p>Allocate memory, free it, and then try to free it again. This will reveal if your program is able to detect and handle double freeing of memory.</p><pre>void test_double_free() {<br> int *data = malloc(sizeof(int));<br> free(data);<br> free(data); // Attempting to free memory twice<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*pnh3pXxw-tzUDNTSx-rZjg.png" /></figure><p>These techniques simulate scenarios in which vulnerabilities are deliberately introduced. By running these tests, you can assess how your memory manager responds to potential vulnerabilities and identify flaws that need to be addressed. It should be noted that these techniques should only be used in a controlled testing environment.</p><p><strong>Conclusion:</strong></p><p>Continuous testing and improvement are crucial for navigating memory management complexities and creating software that withstands security threats. By adopting best practices and using tools like Valgrind and GDB, developers can confidently navigate memory management flaws and ensure software performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*f_C20KTQbjP_VElH.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b16275bc0b74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker vs Vagrant]]></title>
            <link>https://medium.com/@brianislevu/docker-vs-vagrant-556e4aad55bb?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/556e4aad55bb</guid>
            <category><![CDATA[vagrant]]></category>
            <category><![CDATA[virtualization]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Tue, 22 Aug 2023 21:59:25 GMT</pubDate>
            <atom:updated>2023-08-22T23:54:09.005Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Choosing the right virtualization tool</strong></p><p><strong>Introduction</strong></p><p>Virtualization plays a crucial role in modern software development by providing isolated environments for testing, development, and deployment. Two popular tools, Docker and Vagrant, offer unique approaches to creating and managing virtualized environments. In this article, we’ll explore the key <a href="https://www.linkedin.com/posts/mblevu_docker-vs-vagrant-activity-7099872901377511424-_VKX?utm_source=share&amp;utm_medium=member_desktop">differences</a> between Docker and Vagrant, helping you make an informed choice for your projects</p><blockquote><a href="https://medium.com/@kevinkoech265/dockerizing-fastapi-and-postgresql-effortless-containerization-a-step-by-step-guide-68b962c3e7eb">Here</a> is a link to a comprehensive step-by-step guide to dockerizing an application.</blockquote><p><strong>1. Purpose and Use Case<br></strong> Docker is designed for containerization, encapsulating applications and their dependencies into portable containers. It’s well-suited for microservices and containerized application development.</p><p>Vagrant is focused on creating and managing virtualized development environments. It provides virtual machines or containers to provide consistent and isolated environments for developers.</p><p><strong>2. Level of Abstraction<br></strong>Docker operates at the application level, with containers sharing the host OS kernel. This approach makes containers lightweight and efficient.</p><p>Vagrant operates at the infrastructure level, creating virtual machines with full OS environments. VMs offer better isolation but come with a higher resource overhead.</p><p><strong>3. Isolation<br></strong>Docker containers share the host OS kernel, which increases efficiency but introduces potential security risks if not properly managed.</p><p>Vagrant virtual machines offer higher isolation, simulating complete OS environments. This increased isolation enhances security but requires more resources.</p><p><strong>4. Portability<br></strong> Docker containers are highly portable across various systems and environments. Containers package applications and dependencies into a single unit, simplifying migration.</p><p>Vagrant provides portability through virtual machine images known as Vagrant boxes. While portable, these boxes are larger and require more time for setup.</p><p><strong>5. Resource Overhead<br></strong>Docker containers have lower resource overhead due to sharing the host OS kernel, enabling more containers to run concurrently.</p><p>Vagrant virtual machines have a higher resource overhead when running complete OS instances. This can limit the number of VMs that can run simultaneously.</p><p><strong>6. Configuration<br></strong>Dockerfiles define container configurations and dependencies. The process is concise and focuses on the application.</p><p>Vagrantfiles define the entire VM environment, including OS configuration, provisioning, and more.</p><p><strong>7. Development Workflow<br></strong>Docker is suited for microservices and containerized application development, offering reproducible environments for applications composed of multiple services.</p><p>Vagrant is ideal for creating consistent development environments, especially for projects requiring full OS isolation or different OS testing.</p><p><strong>8. Ecosystem<br></strong>Docker offers a vast ecosystem of pre-built images on Docker Hub, facilitating the sharing of containerized applications.</p><p>Vagrant focuses on virtualization providers like VirtualBox, VMware, and cloud platforms for VM provisioning.</p><p>In conclusion, both Docker and Vagrant have their strengths and are suited for different scenarios. Docker excels in containerization and microservices, while Vagrant shines in providing complete and isolated development environments. The choice between Docker and Vagrant depends on your project’s requirements and goals. By understanding the differences between these tools, you can make an informed decision to enhance your development workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=556e4aad55bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Virtualization with vagrant]]></title>
            <link>https://medium.com/@brianislevu/virtualization-with-vagrant-4d04a643679?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d04a643679</guid>
            <category><![CDATA[virtualization]]></category>
            <category><![CDATA[vagrant]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 13:26:24 GMT</pubDate>
            <atom:updated>2023-08-07T13:30:15.556Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kJobliZx0GnYdWzMh1Daw.jpeg" /><figcaption><a href="https://www.hashicorp.com/blog/vagrant-2-3-introduces-go-runtime">https://www.hashicorp.com/blog/vagrant-2-3-introduces-go-runtime</a></figcaption></figure><p>Vagrant is a powerful tool that simplifies the process of managing virtual machines and development environments. In this setup guide, we’ll walk you through the steps to install and use Vagrant to set up a virtualized instance of Kali Linux on your Linux host machine. By following this guide, you can create an isolated and safe environment for security testing, penetration testing, or general exploration using Kali Linux.</p><p><strong>The Benefits of Vagrant:</strong></p><p>Vagrant offers several advantages for developers, including:</p><ol><li><strong>Portability</strong>: Vagrant allows you to share your development environment configurations with team members, ensuring consistency across all platforms.</li><li><strong>Scalability</strong>: Quickly scale your development environments up or down, enabling you to test applications in various scenarios effortlessly.</li><li><strong>Reproducibility</strong>: Vagrant ensures that every team member works in the same virtual environment, reducing the “it works on my machine” problem.</li><li><strong>Cost-Effective</strong>: By using Vagrant, you can optimize hardware resources and reduce infrastructure costs.</li><li><strong>Version Control</strong>: Vagrant environments can be version-controlled, enabling you to easily track changes and revert to previous configurations.</li></ol><p><strong>Section 1: Installing Vagrant and VirtualBox</strong></p><ol><li>Ensure your Linux host machine meets the system requirements for Vagrant and VirtualBox. Most do.</li><li>Install VirtualBox: Head to the <a href="https://www.virtualbox.org/wiki/Linux_Downloads">VirtualBox website</a> and download the appropriate package for your Linux distribution. Follow the installation instructions provided for your specific OS.</li><li>Install Vagrant: Visit the <a href="https://developer.hashicorp.com/vagrant/downloads?product_intent=vagrant">Vagrant website</a>, download the latest version for Linux, and install it using the package manager specific to your Linux distribution (e.g., apt, yum, dnf).</li></ol><pre>wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot; | sudo tee /etc/apt/sources.list.d/hashicorp.list<br>sudo apt update &amp;&amp; sudo apt install vagrant</pre><p><strong>Section 2: Setting Up Kali Linux VM with Vagrant</strong></p><ol><li>Create a Project Directory: Create a folder where your Vagrant project will reside. For example, create a directory named “KaliVM.”</li><li>Initialize the Vagrant Project: Open the terminal, navigate to the “KaliVM” directory, and execute the following command to initialize a new Vagrant project:</li></ol><pre>vagrant init kali-linux/rolling</pre><p>Below is an example of how you can customize the Vagrantfile to adjust memory allocation, CPU cores, and networking settings for your Kali Linux VM:</p><pre># -*- mode: ruby -*-<br># vi: set ft=ruby :<br><br>Vagrant.configure(&quot;2&quot;) do |config|<br>  # Specify the base box for Kali Linux (in this example, we&#39;re using the official box for Kali Linux rolling release)<br>  config.vm.box = &quot;kali-linux/rolling&quot;<br><br>  # VM Settings<br>  config.vm.provider &quot;virtualbox&quot; do |vb|<br>    # Customize the amount of RAM for the VM (in MB)<br>    vb.memory = 2048<br><br>    # Customize the number of CPU cores for the VM<br>    vb.cpus = 2<br>  end<br><br>  # Port Forwarding<br>  # You can specify port forwarding to access services running inside the VM from the host machine<br>  # Example: Forwarding port 80 on the VM to port 8080 on the host<br>  config.vm.network &quot;forwarded_port&quot;, guest: 80, host: 8080<br><br>  # Provisioning with Shell Script<br>  config.vm.provision &quot;shell&quot;, path: &quot;provision.sh&quot;<br><br>  # Synced Folders<br>  # You can specify shared folders between the host and guest for easy file transfer<br>  # Example: Syncing the host&#39;s &quot;shared-folder&quot; to &quot;/home/user/shared-folder&quot; in the VM<br>  # config.vm.synced_folder &quot;shared-folder&quot;, &quot;/home/user/shared-folder&quot;<br>end</pre><p><strong>Section 3: Provisioning Kali Linux</strong></p><ol><li>Provisioning with Shell Script: Create a shell script (e.g., provision.sh) in the project directory to automate the installation of packages, tools, and configurations. Add the necessary provisioning commands to the Vagrantfile to execute the script during VM setup.</li></ol><blockquote>Here’s an example of a simple provision.sh script that installs some essential tools:</blockquote><pre>#!/usr/bin/env bash<br><br># Update package lists<br>sudo apt-get update<br><br># Install some useful tools<br>sudo apt-get install -y git python3-pip</pre><p><strong>Section 4: Bringing Up Kali Linux VM</strong></p><ol><li>Save the changes to the Vagrantfile and make sure the provision.sh script is in the same directory. In your terminal, navigate to your project directory and run the following command:</li></ol><pre>vagrant up</pre><p>Vagrant will create the Kali Linux VM, and during the setup process, it will automatically execute the<em> </em><strong><em>provision.sh</em></strong> script, installing the specified packages and tools.</p><p><strong>Section 5: Accessing the Kali Linux VM</strong></p><ol><li>SSH into the VM: Use the following command to SSH into the Kali Linux VM:</li></ol><pre>vagrant ssh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8Fl7z_d8XI7yfsPfdNw5w.png" /><figcaption>successful vagrant setup running on Virtualbox</figcaption></figure><p><strong>Section 6: Managing Kali Linux VM</strong></p><p>Pausing and Resuming: Pause the VM’s execution using vagrant suspend and resume it with <strong>vagrant resume</strong>.</p><ol><li>Halting and Restarting: Gracefully shut down the VM using <strong>vagrant halt</strong> and restart it with <strong>vagrant reload</strong>.</li><li>Destroying the VM: To completely remove the VM from your system, run <strong>vagrant destroy</strong>.</li></ol><p><strong>Conclusion:<br></strong>By following this step-by-step setup guide, you can now run a virtualized Kali Linux instance on your Linux host machine. With Vagrant, you can easily manage and customize your VMs, enabling you to focus on security testing and exploration without impacting your host system. Remember to use Kali Linux responsibly and only for legal and ethical purposes. Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d04a643679" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Hackers Can Steal Your Credentials]]></title>
            <link>https://medium.com/@brianislevu/how-hackers-can-steal-your-credentials-c5e31e4a5c17?source=rss-bf0e1f4dfd73------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5e31e4a5c17</guid>
            <category><![CDATA[burpsuite]]></category>
            <category><![CDATA[mitm-attacks]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[cyber-security-awareness]]></category>
            <dc:creator><![CDATA[Brian levu]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 02:36:11 GMT</pubDate>
            <atom:updated>2023-07-31T03:57:54.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SfxBf8ujyPFvATBD" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=medium&amp;utm_medium=referral">Growtika</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction:<br></strong>Our online presence has become an integral part of our daily lives. From social media accounts to online banking, we entrust various websites with our sensitive information, including usernames and passwords. However, this convenience also makes us susceptible to malicious cyber activities, including credential theft.</p><h3><strong>Understanding Hacker Techniques:</strong></h3><p><strong><em>Intercepting Login Attempts:<br></em></strong>Hackers can intercept and analyze login attempts made to websites. By capturing the login data, attackers can gain access to sensitive information, including usernames and passwords.</p><p><strong><em>Brute-Force Attacks:<br></em></strong>Hackers automate the process of trying multiple username and password combinations until they find a match, gaining unauthorized access to accounts.</p><p><strong><em>Man-in-the-Middle Attacks:</em></strong><br>Public Wi-Fi networks can be exploited by hackers through man-in-the-middle attacks. Attackers intercept data exchanged between users and websites, potentially obtaining login credentials.</p><p><strong>Educational Example:</strong></p><p><strong><em>Burp Suite Usage<br></em></strong>As a responsible cybersecurity professional, I conducted a simulated example of how hackers could potentially exploit login credentials using Burp Suite. This example emphasizes the importance of securing websites and adopting secure practices for users to follow.</p><p><strong>Prerequisites:</strong></p><ul><li>Burp Suite Community Edition installed on your machine.</li><li>Access to a target website with HTTP traffic (preferably a local development server or a controlled environment).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*PcGZNEwYyQVGRx0yXKv0cQ.png" /><figcaption>uvicorn server running target application</figcaption></figure><p><strong>Step 1: Launch Burp Suite</strong></p><ol><li>Open Burp Suite from your application menu or desktop shortcut.</li></ol><p><strong>Step 2: Configure Proxy Settings</strong></p><ol><li>In Burp Suite, navigate to the “Proxy” tab.</li><li>Under “Intercept,” make sure the “Intercept is on” button is disabled (greyed out). This will prevent Burp Suite from intercepting requests initially.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*l-M0dXcCzMWI8evGqAoDJQ.png" /><figcaption>burp suite intercept off</figcaption></figure><p><strong>Step 3: Configure Browser Proxy Settings</strong></p><ol><li>Open your web browser (e.g., Chrome, Firefox) and set the proxy configuration to “Manual” or “Custom” and input the proxy IP address as “localhost” or “127.0.0.1” and the port as “8080” (the default Burp Suite proxy port). or;</li><li>Just click “Open in browser” to open the inbuilt burp suite browser.</li></ol><p><strong>Step 4: Start Intercepting Requests</strong></p><ol><li>Go back to Burp Suite and enable the intercept feature by clicking the “Intercept is on” button.</li><li>Burp Suite is now ready to intercept HTTP requests.</li></ol><p><strong>Step 5: Access Target Website</strong></p><ol><li>In your web browser, access the target website (e.g., <a href="http://localhost:8000/">http://localhost:8000</a>/login).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*J-OSAADGVuMOUqZrfYcrXw.png" /><figcaption>login form</figcaption></figure><p><strong>Step 6: Observe Intercepted Requests</strong></p><ol><li>As you navigate through the target website, Burp Suite will start intercepting HTTP requests in real time.</li><li>These intercepted requests will be displayed under the “Proxy” &gt; “HTTP History” tab.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*FvJAbubiFj1BeyrZiJbQAA.png" /><figcaption>intercepted user credentials on login</figcaption></figure><p><strong>Step 7: Forwarding Requests</strong></p><ol><li>Select the intercepted request you wish to forward from the “HTTP History” tab.</li><li>Right-click on the selected request and choose “Send to Repeater” or “Forward to Intruder,” depending on your intended action.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*m1lwSshNcag9crhQcnC3fg.png" /><figcaption>successful attack response is users access token</figcaption></figure><p><strong>Step 8: Analyze and Modify Requests (Optional)</strong></p><ol><li>Once you forward the request to the repeater or Intruder, you can analyze the request details, parameters, and headers.</li><li>In Repeater, you can manually modify the request’s parameters and headers for testing purposes.</li></ol><p><strong>Step 9: Forward Request to the target server.</strong></p><ol><li>After analyzing or modifying the request (if required), use Repeater’s “Go” button to send the modified request to the target server.</li><li>Observe the server’s response in Repeater.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*6JpOnlxe-uiL9KeGZQICwQ.png" /><figcaption>server response: successful login</figcaption></figure><p><strong>Step 10: Disable Intercepting (Optional)</strong></p><ol><li>When you finish intercepting and analyzing requests, you can disable the intercept feature by clicking the “Intercept is on” button again (to turn it gray).</li></ol><h3><strong>Protecting Your Credentials:</strong></h3><p><strong><em>Use Strong and Unique passwords.<br></em></strong>Avoid using common passwords or repeating passwords across multiple sites. Use a mix of upper and lowercase letters, numbers, and symbols to create strong passwords. Consider using a password manager to keep track of unique passwords.</p><p><strong><em>Enable Multi-Factor Authentication (MFA):<br></em></strong>Many websites now offer MFA, an extra layer of security that requires users to provide additional verification, such as a one-time code sent to their phone, along with their password. Enabling MFA adds a significant layer of protection.</p><p><strong><em>Regularly Update Passwords:<br></em></strong>Periodically change passwords for critical accounts. Regularly updating your credentials makes it harder for hackers to access your accounts, even if they manage to steal outdated login data.</p><p><strong><em>Avoid Public Wi-Fi for Sensitive Activities:<br></em></strong>When handling sensitive information, avoid using public Wi-Fi networks, as they can be susceptible to man-in-the-middle attacks. Opt for secure and private networks, such as your home network or a trusted mobile hotspot.</p><p><strong>Conclusion:<br></strong>Understanding hacker techniques, as demonstrated in this example using Burp Suite, empowers users to take proactive steps to safeguard their credentials and personal information. By adopting secure practices like using strong passwords, enabling MFA, and being cautious on public Wi-Fi, users can stay one step ahead of potential threats and protect their online identities.</p><p>Remember, this article aims to raise awareness about cybersecurity risks by emphasizing the importance of secure websites and responsible user practices. Together, we can build a safer online environment and protect our credentials from falling into the wrong hands. Stay vigilant and secure!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5e31e4a5c17" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>