<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>flupzor.nl</title>
    <description>Alexander Schrijver&#39;s website. Cats, cats, and more cats.
</description>
    <link>http://www.flupzor.nl/</link>
    <atom:link href="http://www.flupzor.nl/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 07 May 2015 11:46:40 +0000</pubDate>
    <lastBuildDate>Thu, 07 May 2015 11:46:40 +0000</lastBuildDate>
    <generator>Jekyll v2.4.0</generator>
    
      <item>
        <title>TP-LINK AC750 UART pins</title>
        <description>&lt;p&gt;Having root is fun, talking to the UART is better.&lt;/p&gt;

&lt;p&gt;Opening up the device was quite a hassle, there are two screws and the rest is
fastened using plastic clips. I had to break a couple of clips when I opened
the device.  I honestly don’t see how you can open the device without breaking
these clips.&lt;/p&gt;

&lt;p&gt;There are 4 solder pointers on the board with a label “J2”, I guessed this was
where you can connect the UART. And it turns out I was right. I soldered a 4-pin
header on the board to make it easier to connect a serial cable.&lt;/p&gt;

&lt;p&gt;I first tried this with an Adafruit 4 Pin Cable (PL2303). But sadly, I blew it
up connecting it to the 3.3v pin (or, at least, I think that is wat caused it.)&lt;/p&gt;

&lt;p&gt;After which I tried, what I believe originally was a Nokia phone connector
cable which can be (ab)used as a 3.3v serial cable. And yay! It worked.&lt;/p&gt;

&lt;p&gt;This is the pin-out on the board. Pin 1 is the pin with the white dash above
it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/tplink_uart_location.jpg&quot; alt=&quot;TP-LINK AC750 UART overview&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/tplink_header.jpg&quot; alt=&quot;TP-LINK AC750 UART pin-out&quot; /&gt;&lt;/p&gt;

&lt;p&gt;J2&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Pin&lt;/th&gt;
      &lt;th&gt;Function&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;Probably 3.3v.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Ground (Connected to ground)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;TX (Connected to RX)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;RX (Connected to TX)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The Nokia phone connector&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Cable&lt;/th&gt;
      &lt;th&gt;Function&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Black&lt;/td&gt;
      &lt;td&gt;Ground&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;White&lt;/td&gt;
      &lt;td&gt;RX&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Blue&lt;/td&gt;
      &lt;td&gt;TX&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The baudrate is: 115200&lt;/p&gt;

&lt;p&gt;You can find a dump of the successful UART connection &lt;a href=&quot;/downloads/tplink_uart_output.txt&quot;&gt;here&lt;/a&gt;. Note
that I entered the password wrong twice.&lt;/p&gt;

</description>
        <pubDate>Thu, 07 May 2015 19:54:00 +0000</pubDate>
        <link>http://www.flupzor.nl/2015/05/07/uart_on_ac750.html</link>
        <guid isPermaLink="true">http://www.flupzor.nl/2015/05/07/uart_on_ac750.html</guid>
        
        <category>uart</category>
        
        <category>router</category>
        
        
      </item>
    
      <item>
        <title>Getting root on TP-LINK AC750</title>
        <description>&lt;p&gt;I was playing around with the new wireless router I bought and wondered if
the input to the ping command was escaped properly. It wasn’t.&lt;/p&gt;

&lt;p&gt;On Unix systems, in order to send a ICMP echo request you’ll need root
permissions, or at least special permissions. Ping is usually implemented by
setting the setuid bit on the ping(8) executable.&lt;/p&gt;

&lt;p&gt;Because root permissions are required to send a ICMP echo request, the easiest
way to implement ping in a web interface is to call ping(8) with the proper
arguments, and parsing the result.&lt;/p&gt;

&lt;p&gt;The way the fols at TP-LINK implemented this is by using system(3) or similar,
and just directly pass “ping $userdata” to a shell. Without ever validating, or
escaping $userdata.&lt;/p&gt;

&lt;h2 id=&quot;how-to-exploit-this&quot;&gt;How to exploit this?&lt;/h2&gt;

&lt;p&gt;Using the TP-LINK AC750 web interface the output data of the ping functionality
isn’t (directly) sent back to the web interface. What you get as a result is
either, unknown host, no response, or ICMP echo replies.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/tplink_ping.png&quot; alt=&quot;Abusing the ping functionality&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The first experiment is this input:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&quot;$(echo 127.0.0.1)&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This probably invokes something like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ping &quot;$(echo 127.0.0.1)&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which is translated by the shell to.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ping 127.0.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Using this input we can verify the input data isn’t escaped. If it returns ICMP
echo responses, it worked. If it didn’t, they probably fixed the bug.&lt;/p&gt;

&lt;p&gt;Obviously, we want a shell. I played around a bit with various commands to find
out which commands we have at our disposal. (What I did is, I dumped a
directory listing, and the output of various commands to the USB drive which I
attached to the router. )&lt;/p&gt;

&lt;p&gt;I found out there is a telnetd(8) daemon available. Also, by default this
telnetd(8) server already runs with Cisco IOS-like shell, which allows you to
change the same settings as the web interface, but with horror of the IOS
shell.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/tplink_console.png&quot; alt=&quot;TP-LINK shell&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So, first, we should kill that shell. We can do that with the following input.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&quot;$(killall telnetd &amp;gt; /dev/null &amp;amp;&amp;amp; echo 127.0.0.1)&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then we start telnetd again, now with the bourne shell.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&quot;$(/usr/sbin/telnetd -l /bin/sh &amp;gt; /dev/null &amp;amp;&amp;amp; echo 127.0.0.1)&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now if you open a telnet session with the router, you’ve got a root shell :)&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/tplink_sh.png&quot; alt=&quot;TP-LINK bourne shell&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;how-bad-is-this&quot;&gt;How bad is this?&lt;/h2&gt;

&lt;p&gt;I think it’s a good idea that customers get full access to the appliances they
purchase. So, from that perspective I think this is more a feature than a bug.&lt;/p&gt;

&lt;p&gt;If you want to give users web access to the router, but not root access, this
is a bug. But I doubt there are many users who want this.&lt;/p&gt;

&lt;p&gt;What is bad about this, is the fact that the webserver is run as a superuser.
Worse, all processes are run as superuser.&lt;/p&gt;
</description>
        <pubDate>Thu, 30 Apr 2015 19:54:00 +0000</pubDate>
        <link>http://www.flupzor.nl/2015/04/30/root_on_ac750.html</link>
        <guid isPermaLink="true">http://www.flupzor.nl/2015/04/30/root_on_ac750.html</guid>
        
        <category>bug</category>
        
        <category>root</category>
        
        <category>router</category>
        
        
      </item>
    
      <item>
        <title>Abbott stuff</title>
        <description>&lt;p&gt;I’ve been trying to figure out the protocol for the Abbott Freestyle product
line. I made a protocol description which can be found &lt;a href=&quot;protocol.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you’re looking for the description for the Abbott Xceed product line, Chris
Ridd made an awesome description which can be found &lt;a href=&quot;http://www.lnv.pwp.blueyonder.co.uk/xceed/&quot;&gt;here&lt;/a&gt;. He
also made an implementation in Objective C, but I haven’t found time to test
that.&lt;/p&gt;

&lt;p&gt;Abbott sells an adapter cable which uses the TI 3410 chipset. This chipset is
supported by most modern operating systems, however not all include the Abbott
vendor id/product id (0x1a61, 0x3410 respectively). Currently it should work by
default in Windows XP using the driver Abbott supplied, and in OpenBSD since
&lt;a href=&quot;http://marc.info/?l=openbsd-cvs&amp;amp;m=129261992926939&amp;amp;w=2&quot;&gt;this&lt;/a&gt; commit. Getting it working with other operating systems
should be trivial.&lt;/p&gt;

</description>
        <pubDate>Sun, 19 Dec 2010 16:00:00 +0000</pubDate>
        <link>http://www.flupzor.nl/2010/12/19/abbott_stuff.html</link>
        <guid isPermaLink="true">http://www.flupzor.nl/2010/12/19/abbott_stuff.html</guid>
        
        <category>diabetes</category>
        
        <category>reverse engineering</category>
        
        
      </item>
    
  </channel>
</rss>
