You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
62 KiB

3 years ago
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="https://jekyllrb.com/" version="4.1.1">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml"/><link href="/" rel="alternate" type="text/html"/><updated>2021-04-04T15:27:34-06:00</updated><id>/feed.xml</id><entry><title type="html">The “Quiz Your Friends” XSS Exploit</title><link href="/2021/04/04/quiz-your-friends-xss/" rel="alternate" type="text/html" title="The “Quiz Your Friends” XSS Exploit"/><published>2021-04-04T00:00:00-06:00</published><updated>2021-04-04T00:00:00-06:00</updated><id>/2021/04/04/quiz-your-friends-xss</id><content type="html" xml:base="/2021/04/04/quiz-your-friends-xss/">&lt;p&gt;Note: I have alerted the administrators of this site multiple times about this vulnerability. One email was sent many years ago, which is more than enough time for &lt;a href=&quot;https://en.wikipedia.org/wiki/Responsible_disclosure&quot;&gt;responsible disclosure&lt;/a&gt;.&lt;/p&gt; &lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt; &lt;p&gt;In early 2014, when my “programming” skills consisted of editing web pages with inspect element, I was sent a link from an old friend in a town about 3 hours away. This was a link to a quiz about them. I had to answer as many questions right as I could about them and I got a score at the end based on my answers. It seemed fun enough, so I went for it. In the following weeks this quiz website became quite a trend amongst my friend group as we all started making quizes to see how well we all knew eachother.&lt;/p&gt; &lt;p&gt;A few weeks into this trend, I was staying at a friends place and told him about this site, so he goes and creates his own quiz and sends it to all his friends, group chats, Google Plus groups, et cetera.&lt;/p&gt; &lt;h2 id=&quot;hackerman&quot;&gt;Hackerman&lt;/h2&gt; &lt;p&gt;While filling in my friends survey I thought it would be funny for them to know it is me without anyone else knowing. We were young and had &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Inspect Element&lt;/code&gt;ed a few things together, so it was a safe bet that an HTML joke would let them know.&lt;/p&gt; &lt;p&gt;I decided to write my name like so: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;b&amp;gt;Steve&amp;lt;/b&amp;gt;&lt;/code&gt;. Steve is in reference to the &lt;a href=&quot;https://minecraft.gamepedia.com/Player&quot;&gt;main character&lt;/a&gt; in the video game Minecraft.&lt;/p&gt; &lt;figure&gt; &lt;img src=&quot;/assets/img/qyf-xss/2-bold.png&quot; /&gt; &lt;figcaption&gt; &lt;p&gt;Me typing in my name as &lt;span class=&quot;mono&quot;&gt;&amp;lt;b&amp;gt;Steve&amp;lt;/b&amp;gt;&lt;/span&gt;.&lt;/p&gt; &lt;/figcaption&gt; &lt;/figure&gt; &lt;p&gt;Now in theory this should have shown in in the leaderboard as: “&amp;lt;b&amp;gt;Steve&amp;lt;/b&amp;gt;” However, to my horror and excitement, I saw this in the leaderboard:&lt;/p&gt; &lt;figure&gt; &lt;img src=&quot;/assets/img/qyf-xss/3-steve-board.png&quot; /&gt; &lt;figcaption&gt; &lt;p&gt;&lt;span class=&quot;mono&quot;&gt;&amp;lt;b&amp;gt;Steve&amp;lt;/b&amp;gt;&lt;/span&gt; displaying in the leaderboard as bold text: &lt;b&gt;Steve&lt;/b&gt;&lt;/p&gt; &lt;/figcaption&gt; &lt;/figure&gt; &lt;p&gt;The text “Steve” showed up &lt;strong&gt;in bold&lt;/strong&gt; on the leaderboard. This told me all I needed to know. How did this happen? You might wonder.&lt;/p&gt; &lt;h3 id=&quot;server-side-validation&quot;&gt;Server-Side Validation&lt;/h3&gt; &lt;p&gt;Here is a great demonstration why you should do most of your validation on the server side. As a user, I can edit any of the HTML, CSS, or Javascript your server serves to me.&lt;/p&gt; &lt;p&gt;Quiz your friends uses the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;maxlength=20&lt;/code&gt; HTML attribute on the name input field. Imagine trying to fit in a script tag doing anything useful with 20 characters! Dont forget that includes the &lt;code