Git Product home page Git Product logo

rootmyroku's Introduction

Root My Roku

A persistent root jailbreak for RokuOS v9.4.0 build 4200 devices using a Realtek WiFi chip.
A big thank you to ammar2 and popeax from the Exploitee.rs Discord for helping discover and develop this.

Features

  • Spawns a telnet server running as root on port 8023.
  • Enables the low-level hardware developer mode.
  • Adds many new secret screens and debug features to the main menu.
  • Blocks channel updates, firmware updates, and all communication with Roku servers.

Usage

  1. Download any new channels you might want to use after the jailbreak.
    Once you jailbreak your device, all communication with Roku's servers will be blocked.
    Any channels you currently have installed should continue to work.
    Please see the F.A.Q. below for details.
  2. Enable Developer Settings on your Roku device.
  3. Download the latest dev-channel.zip from the releases page.
  4. Upload dev-channel.zip using the guide from the previous step.
  5. Follow the prompts on screen, then reboot to jailbreak!

Applications

F.A.Q.

Which devices does this affect?

Affected devices include almost all Roku TVs and some Roku set-top boxes.
In theory, any Roku device running RokuOS v9.4.0 build 4200 or earlier that uses a Realtek WiFi chip is vulnerable.
You can check your current software version from Settings -> System -> About.
While it is not possible to manually check your WiFi chip manufacturer, the channel provided for this exploit will tell you if your device is vulnerable or not.

Can this brick my device?

No! It makes no changes to the underlying firmware that the device runs.
If anything bad happens, a factory reset will always recover your device.

How do I un-jailbreak my device?

You have two options:

  • Factory reset your device. This will clear NVRAM and remove the jailbreak.
  • Using the telnet server on port 8023, delete /nvram/udhcpd-p2p.conf and reboot.

Is Roku aware of this exploit?

Some of the critical components required for the exploit chain no longer work in RokuOS v10.
The NFS mount option that is used for arbitrary file modification gets disabled, and the service used for persistence and privilege escalation is no longer used.

While RokuOS v10 has started rolling out, many devices have not received the update yet.

Why does the jailbreak block communication with Roku servers?

This is a precautionary measure to prevent the jailbreak from being disabled or removed.
In the past, Roku has taken some creative measures to forcefully patch jailbroken devices. One such example was an update to the screensaver channel that would check for a telnet service, connect to it, and command it to un-root and update the device.

Unfortunately, the servers used for channel and firmware updates the same ones used to communicate with Roku in general. Blocking updates means that no new channels can be installed and that certain features like "My Feed" and "Search" will no longer work.
Applications that communicate with other services (e.g. YouTube, Netflix, HBO) will still work.

How can I prevent my non-jailbroken Roku from updating?

Edit your modem/router's DNS settings to use the IP address of dns.rootmyroku.com.
You can find the current IP address using nslookup, dig, or online DNS lookup tools.

Why should I trust the code you execute on my device?

You don't have to!

All of the files required to reproduce this exploit are available in this repo:

  • The local channel used to load the remote payload is available under local.
  • The remote payload loaded over NFS is available under remote.
  • The script used to create the NFS and DNS servers are available under server.

Exploit Details

There's two main vulnerabilities that make this exploit possible: arbitrary file modification and privilege escalation.

RokuOS actually does a decently good job at sandboxing channels to prevent them from accessing the underlying filesystem. In addition to running as a restricted user, a software sandbox, and a chroot jail, Roku's Linux kernel has grsecurity patches applied. These patches mitigate common exploit techniques used in jailbreaks and privilege escalation. Furthermore, the entire root filesystem is read-only and baked into the firmware. Only persistent storage (NVRAM) and temp directories are writable.

Arbitrary File Modification

Two things conspired to allow arbitrary file modification. The first was that an undocumented pkg_nfs_mount channel manifest option. This option was meant to reduce the software development lifecycle when creating a channel by allowing the channel's source code to be hosted on a different machine using NFS. This removes the need to re-package and re-upload channels after every code change.
The second was a shortcoming of the grsecurity patches and the Linux kernel in general: symlinks over NFS act weird. While grsecurity was configured specifically to not allow symlinking to directories owned by other users, the ownership and permission checks no longer work properly when the symlink resides on an NFS mount. This allows us to create a symlink in the remote channel's package that points to the root of the main filesystem. (See remote/source/Main.brs for details.)
This provided us with the ability to modify persistent storage and temp files, but only as the app user.

Privilege Escalation

From there, we discovered that the process that configures udhcpd (a DHCP service used for pairing speakers and remotes) for Realtek chipsets could be made to read a config file from NVRAM, a location that the app user has access to. If we could leverage it properly, it would let us manipulate a service running as the root user and also give us a means of persisting across reboots. Thankfully, udhcpd has an option for executing a script (notify_file) with a single parameter (lease_file) whenever a DHCP lease is created. It wasn't perfect though: the udhcpd service would only run the script if it has the "execute" bit set. While we could create arbitrary files using our previous exploit, we didn't have control over the file's permissions and as a result, none of the payload scripts we create are marked as executable. To make matters more difficult, we couldn't pass the payload script as lease_file to the built-in shell executables because udhcpd would overwrite the script contents first.
Ultimately, the solution involved creating a lease_file value polyglot that is both an AWK script and a legal file name. (See remote/bootstrap.conf for details.)

Footnote

If anyone at Roku is reading this: you desperately need a real bug bounty program.

Without one, there's little incentive to research and report vulnerabilities when you're not sure if you'll be rewarded for your efforts or not. While we took this project on for fun as a hobby, almost no professional security researchers are going to dedicate as much effort as we did for a "maybe".

rootmyroku's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rootmyroku's Issues

Unable to run exploit on RokuOS 9.1 on a Roku 2 XS

I have a roku 2 XS which I am trying to jailbreak.
IMG_20220214_201330
^system info
The interesting thing is through some research, this model didnt ever get os version 9.2 or higher so I cant get to the recommended 9.4. I am getting the "If you're seeing this, the NFS mount failed or the exploit was patched" message. Is it worth trying to host the exploit on a local server or am I SOL. Any ideas you have would be welcome. Thanks!

Bypass Lets get started Screen

Hi,

I have manged to find a old 3 gen device thast has not been setup. If I complete the setup this will autoupdate blocking this root method.

Is there anyway to bypass this screen?

Thanks

NOT WORKING !!

I tried this on my roku 2 xs(software- 9.1.0 : build 5009-02) it is not working, after upload it shows the screen "if you are seeing this the NFS mount failed or the exploit was patched. Do I need to setup my own NFS server??

Possibly unable to mount NFS on build 4210

Unable to verify if this is a communication problem, or if build 4210 is incapable of mounting NFS.

Device information:
Model: C232X
Hisense Model: 58R6+
Software ver: 9.4.0 4210-94

Update occurred after jailbreak

I wanted to warn future users that the DNS change does not appear to be sufficient to blocking updates. My previously rooted TV updated to 10.5 right after I connected the device to the network and started to poke around in the OS through telnet.

This may not be a fault of this jailbreak, and instead due to the update check that is required when enabling dev mode (see #10), but it seems unlikely that it would check and download the update, but not actually instigate it until 20 days alter.

@llamasoft, what hosts are you blocking via dns.rootmyroku.com? I imagine those should be blackholed in the hosts file or similar instead (it would also be nice if the update script could be identified and disabled).

Dumps of Roku apps for analysis

Hello!

I am seeking for some application samples of Roku apps, and see how they work internally, but I can't find much resources online (or even places outside this GitHub repo to talk about it!) and I don't have any Roku TV to jailbreak. Is there any place to discuss about that?

Thanks for your work and have a great day.

Sideload installer requires update

Is it still possible to install this hack if your Roku didn't already have dev mode enabled? After cautiously enabling dev mode without triggering an update check, I am stuck seeing the message "Failed To Check For Software Update" when visiting the HTTP server my Roku is now hosting.

I'm assuming some sort of check was added to activating dev mode, and as such it's no longer possible to side load channels without an update check.

Cant upload dev-channel.zip

Model: 3930RW
SW: 9.4.0 build-4200-AE

Application Received: 1114 bytes stored.
Install Failure: nfs mount failed: mount (193.122.148.131:/exports/940E04200 --> /tmp/plugin/NIAAAAjWvJiA/pkg:) failed errno:113

Can't upgrade to 9.4 from 9.2.2

With newer TVs that ship with 9.2.2, the exploit does not seem to work and when trying to force an update to the tested 9.4 version there is a message showing that one cannot downgrade...?

Install Failure: No *.brs script files found.

When uploading via Developer UI:
"Install Failure: No *.brs script files found."

TCL 55S20
9.4.0 - Build 4210-93

Not sure where to go from here.

  • Is this version unsupported?
  • If so, is it possible it will be?
  • I was hoping mainly to be able to enable change some HDR settings that are not available on my model. Would I be able to do that with this exploit if it worked?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.