The “KindleDrip” attack would have allowed attackers to siphon money from unsuspecting victims.
<div class="c-article__content js-reading-content"> <p>Three vulnerabilities in the <a href="https://threatpost.com/amazon-kindle-embedded-devices-code-execution/150003/" target="_blank" rel="noopener noreferrer">Amazon Kindle e-reader</a> would have allowed a remote attacker to execute code and run it as root – paving the way for siphoning money from unsuspecting users.</p> <p>Yogev Bar-On, researcher at Realmode Labs, found that it was possible to email malicious e-books to the devices via the “Send to Kindle” feature to start a chain of attack – a discovery that earned him $18,000 from the Amazon bug-bounty program.</p> <p>“The first vulnerability allowed an attacker to send an e-book to the victim’s Kindle device,” he explained in a <a href="https://medium.com/realmodelabs/kindledrip-from-your-kindles-email-address-to-using-your-credit-card-bb93dbfb2a08" target="_blank" rel="noopener noreferrer">Thursday posting</a>. “Then, the second vulnerability was used to run arbitrary code while the e-book is parsed, under the context of a weak user. The third vulnerability allows the attacker to escalate privileges and run code as root.”</p> <p><a href="https://threatpost.com/newsletter-sign/"><img loading="lazy" class="aligncenter wp-image-141989 size-full" src="https://media.threatpost.com/wp-content/uploads/sites/103/2019/02/19151457/subscribe2.jpg" alt="" width="700" height="50"></a></p> <p>To make the attack work (which the researcher calls KindleDrip), an attacker would first need to know the email address assigned to the victim’s device. There’s also a predefined list of approved emails that any e-books would need to be sent from. According to Bar-On, neither requirement is much of a hurdle.</p> <p>The special destination email address assigned by Amazon is typically just the user’s regular email under the kindle.com domain (e.g. [email protected] becomes [email protected]), which “can be brute forced,” he explained.</p> <p>And as for the list of approved addresses, spoofing can easily get around this. “Email authentication is still not as widespread as you may think,” he wrote. “Since many email servers still don’t support authentication, it is not unreasonable to assume that Amazon will not verify the authenticity of the sender.” And indeed, he was able to spoof an email message to send an e-book to his own device.</p> <h2><strong>The KindleDrip Attack</strong></h2> <p>With the emails sorted, the first step in a KindleDrip attack is to send a malicious e-book to a target. The file is sent as an attachment and automatically shows up in a user’s library. However, the victim doesn’t receive an alert that something new has been installed in the bookshelf.</p> <p>“To make matters worse, there is no indication that the e-book was received from an email message,” said Bar-On. “It also appeared on the home page of the Kindle with a cover image of our choice, which makes phishing attacks much easier.”</p> <p>Then, the victim enters the innocent-looking book and touches one of the links in the table of contents. The link opens the built-in browser with an HTML page that contains a malicious JPEG XR image.</p> <p>The image is parsed, and malicious code now runs as root. The payload changes the boot background and restarts the device. Then, the attacker receives private credentials from the device and can log into the victim’s account.</p> <h2><strong>Technical Details</strong></h2> <p>To booby-trap the e-book with malicious code, the researcher found that the Kindle web browser supports the use of an obscure image format called JPEG XR. Conveniently, the Kindle itself has a firmware library called libjpegXR.so, which parses JPEG XR.</p> <p>He found that it was possible to trigger a buffer overflow while parsing JPEG XR with the Kindle, with controlled bytes from an JPEG XR image file.</p> <p>Immediately following the overflowed buffer, there is a pointer struct jxr_tile_qp *tile_quant. Bar-On found that using the overflow, the pointer could be overridden to be able to write data to an attacker-controlled address – what’s known as an absolute-write primitive.</p> <p>“Using the absolute-write primitive, a shellcode could be written to the executable section,” he explained. “Then, the primitive could be used again to ‘spray’ the Global Offset Table (GOT) with the address of the shellcode. The mesquite process is multi-threaded, so one of the other threads would inevitably call a function from the GOT, causing the shellcode to execute.”</p> <p>With code executed, the third step in the attack is privilege escalation.</p> <p>“The mesquite process is run under chroot with a weak user called framework,” he wrote. “So the previous vulnerability couldn’t be used to even reboot the device. Privilege escalation was needed.”</p> <p>In looking for root processes that listen on a local socket, he uncovered something called stackdumpd.</p> <p>“This process is responsible for generating stack dumps of crashed processes,” he said. “It receives information like the crashed process id and thread id, and passes it to /usr/bin/dump-stack. This is a shell script that connects to the crashed process with GDB…and like the name suggests, dumps the stack.”</p> <p>GDB is a remote debugger. He found that it can run arbitrary commands given in the command argument, and thus could be used to run arbitrary code as root. There are two security checks before one is able to do so, which can be bypassed with a “simple string,” he explained. “Thus, we had a vulnerability that allowed us to execute arbitrary code under the context of the root user.”</p> <p>The three issues chained together allows root RCE on a vulnerable Kindle, as shown in a proof-of-concept video:</p> <div class="c-video-container"><iframe title="KindleDrip POC" width="500" height="375" src="https://www.youtube.com/embed/S6dPM1KHyYA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div> <p>Armed with this attack, a threat actor can snoop on users’ web sessions, steal credentials – or, more worryingly, can steal money from the victim. To siphon cash, the attacker could publish an e-book and then log into the victim’s account, using their stored credit card to buy it.</p> <p>The attack works on Kindles with firmware version 5.13.2 or below; Amazon fixed KindleDrip in the latest update, firmware version 5.13.4.</p> <p>“Using three different vulnerabilities, I managed to execute arbitrary code on the Amazon Kindle as the root user, given only the email address assigned to the device,” said Bar-On. “This could have allowed an attacker to access device credentials and make purchases on the Kindle store. This could also have been used to jailbreak the newest Kindle devices. Amazon took the report seriously and fixed the issues in a reasonable time.”</p> <p><strong>Download our exclusive </strong><a href="https://threatpost.com/ebooks/healthcare-security-woes-balloon-in-a-covid-era-world/?utm_source=FEATURE&utm_medium=FEATURE&utm_campaign=Nov_eBook" target="_blank" rel="noopener noreferrer"><strong>FREE Threatpost Insider eBook</strong></a> <em><strong>Healthcare Security Woes Balloon in a Covid-Era World</strong></em><strong>, sponsored by ZeroNorth, to learn more about what these security risks mean for hospitals at the day-to-day level and how healthcare security teams can implement best practices to protect providers and patients. Get the whole story and </strong><a href="https://threatpost.com/ebooks/healthcare-security-woes-balloon-in-a-covid-era-world/?utm_source=ART&utm_medium=ART&utm_campaign=Nov_eBook" target="_blank" rel="noopener noreferrer"><strong>DOWNLOAD the eBook now</strong></a><strong> – on us!</strong></p> <p> </p> <footer class="c-article__footer"> <div class="c-article__footer__container"> <div class="c-article__footer__col"> <a href="#discussion" class="c-button c-button--secondary">Write a comment</a> </div> <div class="c-article__footer__col"> <div class="c-article__sharing"> <p><strong>Share this article:</strong></p> <nav class="c-nav-sharing"> <div class="social-likes social-likes_notext" data-title="Amazon Kindle RCE Attack Starts with an Email" data-url="https://threatpost.com/amazon-kindle-attack-email/163282/" data-counters="yes" data-zeroes="yes"><div class="facebook" title="Share via Facebook"></div> <div class="twitter" title="Share via Twitter"></div><div class="linkedin" title="Share via LinkedIn"></div> <div class="reddit" title="Share via Reddit"></div> <div class="flipboard" title="Share via Flipboard"></div> </div> </nav> </div> </div> </div> <div class="c-article__footer__container"> <div class="c-article__footer__col"></div> <div class="c-article__footer__col"> <ul class="c-list-categories"> <li><a class="c-label c-label--secondary-transparent" href="https://threatpost.com/category/iot/">IoT</a></li> <li><a class="c-label c-label--secondary-transparent" href="https://threatpost.com/category/vulnerabilities/">Vulnerabilities</a></li> <li><a class="c-label c-label--secondary-transparent" href="https://threatpost.com/category/web-security/">Web Security</a></li> </ul> </div> </div> </footer> </div>