<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: benji</title>
    <description>The latest articles on DEV Community by benji (@benji).</description>
    <link>https://dev.to/benji</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F55957%2Ff8b71978-8b3a-4b96-84cc-090868138730.jpg</url>
      <title>DEV Community: benji</title>
      <link>https://dev.to/benji</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benji"/>
    <language>en</language>
    <item>
      <title>Hack the Vote (not really though)</title>
      <dc:creator>benji</dc:creator>
      <pubDate>Tue, 24 Sep 2019 17:25:47 +0000</pubDate>
      <link>https://dev.to/benji/hack-the-vote-not-really-though-1hbk</link>
      <guid>https://dev.to/benji/hack-the-vote-not-really-though-1hbk</guid>
      <description>&lt;p&gt;&lt;strong&gt;IMPORTANT INFORMATION:&lt;/strong&gt; I contacted the people involved with the show and they verified the issue and confirmed that they had other methods set in place to address this issue. The following is their response after describing the issue I had found:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thank you for the information. It is not our policy to provide details on security practices, but there are multiple layers of post-processing that address the issues you raised. We appreciate your willingness to share your findings and the opportunity to validate that controls were in place.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I asked about posting my findings and I received the following response back:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;While we appreciate your reaching out, we are unable to provide consent to the naming of a show or the companies involved. Voting processes are active and reserved for legitimate voters.  Thank you for your understanding.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have removed the references to the company and the show from the post and the code.&lt;/p&gt;




&lt;p&gt;I came across this while voting for an unnamed companys recent TV comedy talent show. I am not an active viewer of these type of shows, but given that a comedy group I follow was competing, I wanted to watch their performances to support them.&lt;/p&gt;

&lt;p&gt;During the semifinals, they opened up the voting for the audience. The voting process required that I signup with an email and password. One dropdown and two checkboxes later I could finally vote. Their voting system is built in such a way that an individual email account can vote up to 10 times. This is performed with a simple enough slider and once you've set your vote, you submit and you're done.&lt;/p&gt;

&lt;p&gt;That's where I thought it ended. I had completed my duties as a fan by casting a vote and there was nothing left to do. That is, nothing left to do but open up the developer console and see how the voting system worked.&lt;/p&gt;

&lt;p&gt;I cast my vote a few more times to see how the requests were handled and on the surface it looked pretty normal. &lt;code&gt;POST&lt;/code&gt; request with an encoded &lt;code&gt;Authorization&lt;/code&gt; value and the URL encoded data as part of the query string. My first thought was that the &lt;code&gt;Authorization&lt;/code&gt; value was based on the original "login" I did when I first got to the website so of course it would be tied to the email:password combination I used. But after two or three requests I noticed that the &lt;code&gt;Authorization&lt;/code&gt; value kept changing.&lt;/p&gt;

&lt;p&gt;Since the network requests weren't telling me much more, I went ahead and opened up the source code. After prettifying the code and finding the spot were the vote was being cast I was surprised to find out that the &lt;code&gt;Authorization&lt;/code&gt; token was actually just an encoded version of the exact query parameters. I thought it was weird that they would ask you for a login but not tie that in any way to this voting &lt;code&gt;POST&lt;/code&gt; request. I also thought there was no way I could modify the data and get a successful response. &lt;strong&gt;I was wrong&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I first tried changing the number of votes from 10 to 100. Failed. 10 to 5? That worked. The email address was also a parameter so I tried changing it to a fake email address I knew would not exist in the system expecting it to fail. It didn't. &lt;/p&gt;

&lt;p&gt;There is no way that vote counted. I created a new account with that fake email I just used and I was very surprised to see that my new account already had 10 votes for the contestant I had voted for. That means that even if an email address is not registered, it could still cast votes and have those counted.&lt;/p&gt;

&lt;p&gt;The obvious next step now was to write a script that I could use to send votes from random emails. This would guarantee that the contestant I wanted to would win the competition.&lt;/p&gt;

&lt;p&gt;The code is fairly straightforward as all that is really happening is that the data is passed through the &lt;a href="https://en.wikipedia.org/wiki/HMAC" rel="noopener noreferrer"&gt;HMAC-SHA256&lt;/a&gt; hash function from &lt;a href="https://github.com/brix/crypto-js" rel="noopener noreferrer"&gt;CryptoJS&lt;/a&gt; and the &lt;code&gt;POST&lt;/code&gt; request is sent. I also added a helper function to iterate through a list of &lt;code&gt;n&lt;/code&gt; emails to send the vote for each email.&lt;/p&gt;

&lt;p&gt;A successfull response will look like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    response_code: '20',
    votestring: '{"total":10,"L1":10}'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;After a few back and forth emails with the InfoSec people at the show, they assured me that this is not exploitable as &lt;code&gt;there are multiple layers of post-processing that address the issues&lt;/code&gt;. Without access to their database it is difficult to see how they're addressing it. A few things come to mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assuming they have a table for registered users and users votes, they should be able to crossreference votes that are not made by "real" users.&lt;/li&gt;
&lt;li&gt;They could be logging IPs as well and count votes only for unique IPs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regardless of how they are getting around this issue to count votes, I do think that the real fix would be to actually issue an authentication token that is used to verify the voting requests in the future. This seems like an oversight from the group that designed the API but I can't think of any good reason why you would pass the email address as part of the vote instead of tying that to an authentication token.&lt;/p&gt;

&lt;p&gt;There were two shows that had opened up the voting schedule at the same time and I was able to get success responses while voting for both of them so I assume this issue would be present on all other shows that require audience voting participation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source
&lt;/h2&gt;

&lt;p&gt;You can find the source code along with instruction on how to run it here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/benjifs/votenow" rel="noopener noreferrer"&gt;https://github.com/benjifs/votenow&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vote</category>
      <category>security</category>
    </item>
    <item>
      <title>Arduboy Rubber Ducky</title>
      <dc:creator>benji</dc:creator>
      <pubDate>Sat, 02 Dec 2017 06:31:18 +0000</pubDate>
      <link>https://dev.to/benji/arduboy-rubber-ducky-2o5a</link>
      <guid>https://dev.to/benji/arduboy-rubber-ducky-2o5a</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmm4e0vchsft3cvok0zoq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmm4e0vchsft3cvok0zoq.gif" width="760" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’ve had the &lt;a href="https://www.arduboy.com/" rel="noopener noreferrer"&gt;&lt;em&gt;Arduboy&lt;/em&gt;&lt;/a&gt; since backing it back in May of 2015. I played with it a little bit when I first got it but for the most part it’s been sitting in my drawer.&lt;/p&gt;

&lt;p&gt;I’ve also been following &lt;a href="https://www.hak5.org/" rel="noopener noreferrer"&gt;&lt;em&gt;Hak5&lt;/em&gt;&lt;/a&gt; for a while and one of their projects I’ve always really liked is the &lt;a href="https://hakshop.com/products/usb-rubber-ducky-deluxe" rel="noopener noreferrer"&gt;&lt;em&gt;USB Rubber Ducky&lt;/em&gt;&lt;/a&gt;. I dont own one myself but I have always liked the idea of the automated HID attacks, especially with the DuckyScript language and all the available &lt;a href="https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads" rel="noopener noreferrer"&gt;&lt;em&gt;community payloads&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;About a week ago I decided it would be a good idea to take my Arduboy out of storage and try developing something small for it. After I realized it has an ATmega32u4 I thought I could use &lt;a href="https://github.com/Thecakeisgit/Dckuino.js" rel="noopener noreferrer"&gt;&lt;em&gt;Dckuino.js&lt;/em&gt;&lt;/a&gt;, a DuckyScript to Arduino converter, and have it run on the Arduboy.&lt;/p&gt;

&lt;p&gt;Once I got a basic DuckyScript to work, I thought I could add more than one DuckyScript and write a selection menu in order to take advantage of the buttons on the Arduboy.&lt;/p&gt;

&lt;p&gt;Lastly, I added a splash screen after the initial boot process that shows a rubber ducky icon. In order to get into the actual selection menu for the DuckyScripts you have to press the &lt;a href="https://en.wikipedia.org/wiki/Konami_Code" rel="noopener noreferrer"&gt;&lt;em&gt;Konami Code&lt;/em&gt;&lt;/a&gt; sequence. After that you should see a menu with all the payloads on the Arduboy.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setup
&lt;/h4&gt;

&lt;p&gt;The first thing you’re going to need to get this up and running on your own Arduboy is a copy of the &lt;a href="https://github.com/benjifs/arduboy-rubber-ducky" rel="noopener noreferrer"&gt;&lt;em&gt;Arduboy Rubber Ducky code&lt;/em&gt;&lt;/a&gt; and the &lt;a href="https://www.arduino.cc/en/Main/Software" rel="noopener noreferrer"&gt;&lt;em&gt;Arduino IDE&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Its also a good idea to install Arduboy from the Boards Manager in the Arduino IDE. To do this just go to preferences and add the following to "Additional Boards Manager URLs":&lt;/p&gt;

&lt;p&gt;&lt;a href="https://arduboy.github.io/board-support/package_arduboy_index.json" rel="noopener noreferrer"&gt;https://arduboy.github.io/board-support/package_arduboy_index.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that you can just go to Tools &amp;gt; Boards &amp;gt; Boards Manager, search for Arduboy and install it.&lt;/p&gt;

&lt;p&gt;I also recommend installing the &lt;a href="https://github.com/MLXXXp/Arduboy2" rel="noopener noreferrer"&gt;&lt;em&gt;Arduboy2&lt;/em&gt;&lt;/a&gt; library as the main branch of the Arduboy library is not currently being maintained.&lt;/p&gt;

&lt;p&gt;Once everything is up and running it would be a good idea to try out some examples and even some games from the &lt;a href="http://team-arg.com/games.html" rel="noopener noreferrer"&gt;&lt;em&gt;Arduboy team&lt;/em&gt;&lt;/a&gt; just to get used to the uploading to board process.&lt;/p&gt;

&lt;p&gt;Whenever you’re ready to upload the Arduboy Rubber Ducky code to your Arduboy you only need to press the upload button and you’re done.&lt;/p&gt;

&lt;p&gt;I’ve included the basic “Hello World” payloads with my code but you can either write your own DuckyScript payloads or get some from the &lt;a href="https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads" rel="noopener noreferrer"&gt;&lt;em&gt;community payloads&lt;/em&gt;&lt;/a&gt;. You can convert from DuckyScript to Arduino by using the &lt;a href="http://benji.dog/ducky" rel="noopener noreferrer"&gt;&lt;em&gt;Dckuino.js&lt;/em&gt;&lt;/a&gt; converter which I’m hosting myself to have everything in one place. After converting your DuckyScript payload, you can just copy the contents of the setup function and add it the the ducky.h file.&lt;/p&gt;

&lt;p&gt;After that just scroll down to the end of the ducky.h file and add the function you just created to the list as well as a label for the menu.&lt;/p&gt;

&lt;h4&gt;
  
  
  Issues
&lt;/h4&gt;

&lt;p&gt;I noticed in my testing that the payloads run a little slower coming from the Arduboy. You may find that you have to increase the delays in the scripts so that the commands run at the appropriate time.&lt;/p&gt;

&lt;p&gt;Depending on which payloads I’m using I also sometimes run into size issues so this is something to keep in mind as you choose your payloads.&lt;/p&gt;

&lt;h4&gt;
  
  
  Future Work
&lt;/h4&gt;

&lt;p&gt;I’m going to try to get my hands on an actual USB Rubber Ducky at some point so that I can compare execution times. With that comparison I should be able to figure out what sort of delays will make more sense for the Arduboy and I can modify Dckuino.js to convert specifically for it.&lt;/p&gt;

&lt;h4&gt;
  
  
  Questions
&lt;/h4&gt;

&lt;p&gt;Feel free to contact me with any questions you may have.&lt;/p&gt;

&lt;p&gt;You can also follow &lt;a href="https://twitter.com/benjifs" rel="noopener noreferrer"&gt;&lt;em&gt;@benjifs&lt;/em&gt;&lt;/a&gt; on Twitter.&lt;/p&gt;

&lt;h4&gt;
  
  
  Links
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/benjifs/arduboy-rubber-ducky" rel="noopener noreferrer"&gt;&lt;em&gt;GitHub Repo&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://benji.dog/ducky" rel="noopener noreferrer"&gt;&lt;em&gt;Duckyscript to Arduino converter&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.arduboy.com/" rel="noopener noreferrer"&gt;&lt;em&gt;Arduboy&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.arduino.cc/en/Main/Software" rel="noopener noreferrer"&gt;&lt;em&gt;Arduino IDE&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hakshop.com/products/usb-rubber-ducky-deluxe" rel="noopener noreferrer"&gt;&lt;em&gt;USB Rubber Ducky&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>hacking</category>
      <category>security</category>
      <category>tech</category>
      <category>arduboy</category>
    </item>
  </channel>
</rss>
