<?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 Syed Anas on Medium]]></title>
        <description><![CDATA[Stories by Syed Anas on Medium]]></description>
        <link>https://medium.com/@syedanas?source=rss-4403f0788a80------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*26h7Fe7wOQejAfWULWUQqg.jpeg</url>
            <title>Stories by Syed Anas on Medium</title>
            <link>https://medium.com/@syedanas?source=rss-4403f0788a80------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:11:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@syedanas/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[SQLi in depth]]></title>
            <link>https://medium.com/@syedanas/sqli-in-depth-4e3e464a03ed?source=rss-4403f0788a80------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e3e464a03ed</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[web-penetration-testing]]></category>
            <category><![CDATA[pentest]]></category>
            <category><![CDATA[hacker]]></category>
            <category><![CDATA[information-security]]></category>
            <dc:creator><![CDATA[Syed Anas]]></dc:creator>
            <pubDate>Tue, 10 Sep 2019 17:24:10 GMT</pubDate>
            <atom:updated>2019-09-10T17:31:41.816Z</atom:updated>
            <content:encoded><![CDATA[<p>SQL injection is a type of injection attack that makes it possible to execute malicious SQL statements onto a DB sever from the client side application.</p><p><strong>Why SQLi occur?<br></strong> SQL injection attacks occur when a web application does not validate values received from a web form, cookie, input parameter, etc., before passing them to SQL queries that will be executed on a database server. This will allow an attacker to manipulate the input so that the data is interpreted as code rather than as data.</p><p><strong>Types of SQLi:<br></strong>Following are the general types of SQLi:</p><ol><li>In-band</li><li>Inferential (Blind SQLi)</li><li>Out of band</li></ol><h3><strong>In-band SQLi:</strong></h3><p>In-band SQL Injection occurs when an attacker is able to use the same communication channel to both launch the attack and gather results.</p><ol><li><strong>Error Based SQLi</strong><br> Error-based SQLi is an in-band SQL Injection technique that relies on error messages thrown by the database server to obtain information about the structure of the database. In some cases, error-based SQL injection alone is enough for an attacker to enumerate an entire database. While errors are very useful during the development phase of a web application, they should be disabled on a live site, or logged to a file with restricted access instead.</li><li><strong>Union Based SQLi</strong><br> Union-based SQLi is an in-band SQL injection technique that leverages the UNION SQL operator to combine the results of two or more SELECT statements into a single result which is then returned as part of the HTTP response.</li></ol><h3><strong>Inferential (Blind SQLi):</strong></h3><p>This type of injection attack does not show any error message, hence “blind” in its name. It is more difficult to exploit as it returns information when the application is given SQL payloads that return a <em>true</em> or <em>false</em> response from the server. By observing the response, an attacker can extract sensitive information.</p><ol><li><strong>Boolean Based Blind SQLi<br></strong>Boolean-based SQL Injection is an inferential SQL Injection technique that relies on sending an SQL query to the database which forces the application to return a different result depending on whether the query returns a TRUE or FALSE result. Depending on the result, the content within the HTTP response will change, or remain the same. This allows an attacker to infer if the payload used returned true or false, even though no data from the database is returned.</li><li><strong>Time-based Blind SQLi<br></strong> Time-based SQL Injection is an inferential SQL Injection technique that relies on sending an SQL query to the database which forces the database to wait for a specified amount of time (in seconds) before responding. The response time will indicate to the attacker whether the result of the query is TRUE or FALSE.</li></ol><h3>Out-of-band SQLi</h3><p>Out-of-band SQL Injection is not very common, mostly because it depends on features being enabled on the database server being used by the web application. Out-of-band SQL Injection occurs when an attacker is unable to use the same channel to launch the attack and gather results.</p><p>Out-of-band techniques, offer an attacker an alternative to inferential time-based techniques, especially if the server responses are not very stable (making an inferential time-based attack unreliable).</p><p>Out-of-band SQLi techniques would rely on the database server’s ability to make DNS or HTTP requests to deliver data to an attacker. Such is the case with Microsoft SQL Server’s xp_dirtree command, which can be used to make DNS requests to a server an attacker controls; as well as Oracle Database’s UTL_HTTP package, which can be used to send HTTP requests from SQL and PL/SQL to a server an attacker controls.</p><p><strong>How not to get SQL injected?</strong></p><ol><li><strong>Don’t use dynamic SQL<br></strong>Avoid placing user-provided input directly into SQL statements. Prefer prepared statements and parameterized queries, which are much safer.Stored procedures are also usually safer than dynamic SQL.</li><li><strong>Sanitize user-provided inputs<br></strong>Properly escape those characters which should be escaped. Verify that the type of data submitted matches the type expected.</li><li><strong>Don’t leave sensitive data in plaintext<br></strong>Encrypt private/confidential data being stored in the database. This also provides another level of protection just in case an attacker successfully exfiltrates sensitive data.</li><li><strong>Limit database permissions and privileges<br></strong>Set the capabilities of the database user to the bare minimum required. This will limit what an attacker can do if they manage to gain access.</li><li><strong>Avoid displaying database errors directly to the user<br></strong> Attackers can use these error messages to gain information about the database.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e3e464a03ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSRF PoC and Mitigation]]></title>
            <link>https://medium.com/@syedanas/csrf-poc-and-mitigation-439a7619425f?source=rss-4403f0788a80------2</link>
            <guid isPermaLink="false">https://medium.com/p/439a7619425f</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Syed Anas]]></dc:creator>
            <pubDate>Wed, 09 Jan 2019 07:29:49 GMT</pubDate>
            <atom:updated>2019-09-10T17:38:19.344Z</atom:updated>
            <content:encoded><![CDATA[<p>CSRF is Cross site request forgery in which the attacker sends victim a malicious link which contains a forged request, and once the victim clicks it then a forged request is done by the victim without his/her consent.</p><p>I used bWAPP on my local network to demonstrate this. This is the normal bWAPP change password field, in which you have to enter your new password while you are logged in the bWAPP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*tXVGJR_D_xsHIT61RyLkog.png" /></figure><p>It can be exploited by using a forge request with it’s source code, and keep it hidden. Below is the source code present, in which I kept the fields hidden and hardcoded the value values of new password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*PNi_I9Pho8FgQNHtfj90kw.png" /></figure><p>I made this html and hosted on my local apache server. When loaded it looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*3D3WBYD-xH9PkA9-UuvrAg.png" /></figure><p>Now once the victim clicks on change button the password automatically gets change without his consent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*iF6WHPkZrYMum0vft2YTLg.png" /></figure><h3>Mitigation:</h3><p>1- Random, Unpredictable CSRF token must be used.</p><p>2- Some site only check the length of CSRF token which is a bad practise. Complete CSRF token should be checked on the back end.</p><p>3- User Domain Policy must be restricted, as it can be used to by pass CSRF token. For PoC you can check <a href="https://hackerone.com/reports/44146">https://hackerone.com/reports/44146</a>.</p><p><strong>NOTE: This is for Educational purposes only, without any intent to harm anyone, thanks.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=439a7619425f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>