Skip to content

Commit 81a6b42

Browse files
committed
RootMyTV v2 release
1 parent ad55713 commit 81a6b42

File tree

11 files changed

+374
-61
lines changed

11 files changed

+374
-61
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [informatic]

README.md

Lines changed: 184 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,189 @@ If you want the full details of how the exploit works, [skip ahead to our writeu
1111

1212
# Is my TV vulnerable?
1313

14-
At the time of writing (2021-05-15), all webOS versions between 3.4 and 6.0 we
15-
tested (TVs released between mid-2017 and early-2021) are supported by this exploit
16-
chain. Note: this versioning refers to the "webOS TV Version" field in the settings menu, *not*
17-
the "Software Version" field.
14+
At the time of writing the original exploit (RootMyTV v1 - 2021-05-15), all
15+
webOS versions between 3.4 and 6.0 we tested (TVs released between mid-2017 and
16+
early-2021) are supported by this exploit chain. Around June-July 2021 LG
17+
started rolling out updates which added some minor mitigations that broke our
18+
original exploit chain.
1819

19-
If you want to protect your TV against remote exploitation, please see the
20-
[relevant section](#mitigation-note) of our writeup and/or await an update from LG.
20+
**At the time of writing (RootMyTV v2 - 2022-01-05)**, all webOS versions
21+
between 4.x and 6.2+ we tested (TVs released between early-2018 and late-2021)
22+
are supported by the new exploit chain.
23+
24+
Some versions between 3.4 and 3.9 may be supported by RootMyTV v2, but your
25+
mileage may vary.
26+
27+
Note: this versioning refers to the "webOS TV Version" field in the settings menu, *not* the "Software Version" field.
28+
29+
*If you want to protect your TV against remote exploitation, please see the
30+
[relevant section](#mitigation-note) of our writeup and/or await an update from LG.*
2131

2232
# Usage Instructions
2333

2434
**Step Zero (disclaimer):** Be aware of the risks. Rooting your TV is (unfortunately) not supported by
2535
LG, and although we've done our best to minimise the risk of damage,
2636
we cannot make any guarantees. This may void your warranty.
2737

28-
1. Make sure the "LG Connect Apps" feature is enabled. It seems to be enabled by default on
29-
webOS 4.0+. For older models, follow [LG's instructions](https://www.lg.com/in/support/help-library/lg-webos-tv-how-to-use-lg-connect-apps-CT20150005-1437127057046).
30-
2. (Optional but recommended) If you have LG's Developer Mode app installed, uninstall it. You won't be able to use it after running the exploit, and its functionality is replaced by the Homebrew Channel.
38+
1. (Pre-webOS 4.0) Make sure "Settings → Network → LG Connect Apps" feature is enabled.
39+
2. Developer Mode app **must be uninstalled before rooting**. Having this
40+
application installed will interfere with RootMyTV v2 exploit, and its full
41+
functionality is replaced by Homebrew Channel built-in SSH server.
3142
3. Open the TV's web browser app and navigate to [https://rootmy.tv](https://rootmy.tv)
3243
4. "Slide to root" using a Magic Remote or press button "5" on your remote.
3344
5. Accept the security prompt.
3445
6. The exploit will proceed automatically. The TV will reboot itself once
3546
during this process, and optionally a second time to finalize the installation
3647
of the Homebrew Channel. On-screen notifications will indicate the exploit's
37-
progress. Occasionally, the TV may turn off instead of rebooting - if this happens, just turn the TV back on again.
48+
progress. On webOS 6.x **Home Screen needs to be opened** for
49+
notifications/prompts to show up.
3850

39-
Your TV should now have Homebrew Channel app installed, and an
40-
unauthenticated(!) root telnet service exposed.
51+
Your TV should now have Homebrew Channel app installed.
52+
53+
By default system updates and remote root access are disabled on install. If
54+
you want to change these settings go to Homebrew Channel → Settings. Options
55+
there are applied after a reboot.
4156

4257
For exploiting broken TVs, check out the information [here](./docs/HEADLESS.md).
4358

59+
## Why rooting
60+
61+
* Unlimited "Developer Mode" access
62+
63+
* While LG allows willing Homebrew developers/users to install unofficial
64+
applications onto their TVs, official method requires manual renewal of
65+
"developer mode session", which expires after 50 hours of inactivity.
66+
* Some of the [amazing homebrew](https://repo.webosbrew.org) that has been
67+
built/ported onto webOS would likely never be accepted onto LG's official
68+
Content Store.
69+
70+
* Lower level user/application access
71+
72+
* This allows willing developers to research webOS system internals, which
73+
will result in creation of amazing projects, like
74+
[PicCap](https://github.com/TBSniller/piccap) (high performance video
75+
capture used for DIY immersive ambient lighting setups), or access to some
76+
interesting features like customization of system UI, remote adjustment of
77+
certain TV configuration options, and others.
78+
79+
## FAQ
80+
81+
### Is it safe?
82+
83+
While we cannot take any responsibility for Your actions, we have not
84+
encountered any bricks due to rooting. If you only use trusted software from
85+
[official Homebrew Channel repository](https://repo.webosbrew.org), then you
86+
should be safe.
87+
88+
### Will this void my warranty?
89+
90+
**This is not a legal advice.** At least in the EU, [rooting and other software
91+
modifications are generally deemed to be legal](https://piana.eu/root/) and
92+
should not be a basis for voiding your warranty.
93+
94+
### How do I get rid of this?
95+
96+
[Factory
97+
reset](https://www.lg.com/us/support/video-tutorials/lg-tv-how-to-reset-my-lg-smart-tv-CT10000020-1441914092672)
98+
should remove all root-related configuration files.
99+
100+
We don't have a convenient tool for root removal *without factory reset*, though
101+
a knowledgable person may be able to [remove our customizations manually](https://github.com/webosbrew/webos-homebrew-channel/issues/11).
102+
103+
### Are system updates possible?
104+
105+
While updates are technically possible, if LG patches the exploit, you might end
106+
up "locked out" and unable to re-root your TV if you somehow lose access. We
107+
also can't predict how future updates will affect our techniques used to elevate
108+
and operate the Homebrew Channel app.
109+
110+
### Will this break Netflix/YouTube/AmazonVideo?
111+
112+
No. This does not break or limit access to subscription services or other DRMed
113+
content.
114+
115+
However, staying on very old firmware version (which may be required for keeping
116+
root access persistent) may limit Your access to LG Content Store application
117+
installs, updates, or (rarely) launches. Workarounds for this [are in the
118+
works](https://github.com/webosbrew/webos-homebrew-channel/issues/75).
119+
120+
### How do I update from RootMyTV v1? (released 2021/05)
121+
122+
If you are not going to update your TV Software Version to the one that is
123+
already patched (most 4.x+ released after 2021/06) there is no need to update.
124+
New chain does not bring any new features - the most sensible thing you can do
125+
is to update your Homebrew Channel app.
126+
127+
If you are already rooted on downgraded/pre-2021-06 firmware version and want to
128+
upgrade further, doing an official software update will remove existing root
129+
files and homebrew applications. Running RootMyTV v2 then will reenable root
130+
access again. You will need to reinstall removed applications yourself.
131+
132+
**If you know what you are doing** and want to persist installed applications,
133+
you need to remove
134+
`/media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh`
135+
file right before an update (without rebooting inbetween), and then run
136+
RootMyTV v2 right on first boot after software update.
137+
138+
### I quickly turned my TV on and off and it's really angry about Failsafe Mode
139+
140+
**If "Failsafe Mode" got tripped on your TV and it's showing angry notifications,
141+
go to Homebrew Channel → Settings, switch "Failsafe Mode" off and press
142+
"Reboot".**
143+
144+
"Failsafe Mode" is a mode where none of our system customizations are enabled
145+
and only an emergency remote access server gets started up.
146+
147+
This mode gets enabled automatically when the TV crashes, gets its power removed
148+
or is shut down during early system startup. In order to reduce chances of that
149+
happening we recommend enabling "Quick Start+" setting in webOS System Settings
150+
General tab. This will make the TV only go to "sleep mode" (which doesn't take
151+
much more power) instead of doing a full shutdown, and will not need to restart
152+
our services on every suspend. This will also make TV startup much faster.
153+
44154
## Post-Installation Advice (IMPORTANT!)
45155

46-
1. For security reasons, it is **highly recommended** to disable
47-
Telnet, and enable SSH Server with public key authentication
48-
(Homebrew Channel → Settings → SSH Server). You will need to manually copy
49-
your SSH Public Key over to `/home/root/.ssh/authorized_keys` on the TV.
156+
1. Don't update your TV. While updates are technically possible, if LG patches the
157+
exploit, you might end up "locked out" and unable to re-root your TV if you
158+
somehow lose access. We also can't predict how future updates will affect
159+
our techniques used to elevate and operate the Homebrew Channel app. **"Block
160+
system updates" option in Homebrew Channel will disable firmware update
161+
checks.** Make sure "Automatic system updates" option in webOS System
162+
Settings is disabled as well.
50163

51-
GitHub user registered keys can be installed using the following snippet:
164+
2. Don't Install, Uninstall, or Update LG's "Developer Mode" app. Doing so will
165+
overwrite, remove or otherwise interfere with the startup script used to
166+
bootstrap the jailbreak. It is **required** to remove "Developer Mode" app
167+
before rooting. SSH service exposed by Homebrew Channel is compatible with
168+
webOS SDK tooling.
169+
170+
3. If you need remote root shell access and know how to use SSH, you can enable
171+
it in Homebrew Channel settings. Default password is `alpine`, but we recommend
172+
setting up SSH Public Key authentication by copying your SSH Public Key over
173+
to `/home/root/.ssh/authorized_keys` on the TV. This will disable password
174+
authentication after a reboot.
52175

176+
GitHub user registered keys can be installed using the following snippet:
53177
```sh
54178
mkdir -p ~/.ssh && curl https://github.com/USERNAME.keys > ~/.ssh/authorized_keys
55179
```
56-
2. Don't update your TV. While updates are technically possible, if LG patches the
57-
exploit, you might end up "locked out" and unable to re-root your TV if you
58-
somehow lose access. We also can't predict how future updates will affect
59-
our techniques used to elevate and operate the Homebrew Channel app. "Block
60-
system updates" option in Homebrew Channel will disable firmware update
61-
checks.
62-
3. Don't Install, Uninstall, or Update LG's "Developer Mode" app. Doing so will
63-
overwrite or remove the startup script used to bootstrap the jailbreak. It is
64-
advisable to remove "Developer Mode" app before rooting. SSH service exposed
65-
by Homebrew Channel is compatible with webOS SDK tooling.
180+
181+
Alternative option is Telnet (can be enabled in Homebrew Channel → Settings
182+
→ Telnet) though it is **highly discouraged**, since this gives
183+
unauthenticated root shell to anyone on a local network.
184+
185+
4. It is recommended to have "Quick Start+" functionality **enabled**. This will
186+
make shutdown button on a remote not do a full system shutdown. If you
187+
quickly turn the TV on and off without Quick Start+, our "Failsafe Mode" may
188+
get triggered (which is there to prevent startup scripts bricking the TV)
189+
which will go away after switching relevant switch in Homebrew Channel
190+
Settings.
66191

67192
## Troubleshooting
68193

69194
In case of any problems [join the OpenLGTV Discord server](https://discord.gg/xWqRVEm)
70-
and ask for help on `#rootmytv` channel, or file a GitHub issue.
195+
and ask for help on `#rootmytv` channel, ask on [our `#openlgtv:netserve.live`
196+
Matrix channel](https://matrix.to/#/#openlgtv:netserve.live), or file a GitHub issue.
71197

72198
Before asking for support, please consult our [Troubleshooting guide](./docs/TROUBLESHOOTING.md).
73199

@@ -97,8 +223,8 @@ More importantly, this exploit could be easily triggered over the local network,
97223
using SSAP (details below), making it much more reliable and user-friendly.
98224

99225
At time of writing, the code in this repo is the combined work of David
100-
Buchanan (Web design, initial PoC exploit) and Piotr Dobrowolski (Improved "v2" exploit
101-
implementation, and writeup).
226+
Buchanan (Web design, initial PoC exploit) and Piotr Dobrowolski (Improved "v1" exploit
227+
implementation, writeup, and "v2" research and implementation).
102228

103229
We would like to thank:
104230

@@ -240,3 +366,31 @@ shell and removing itself (in case something goes wrong and the user needs to
240366
reboot a TV - script keeps running but will no longer be executed on next
241367
startup), installs the homebrew channel app via standard devmode service calls
242368
and elevates its service to run unjailed as root as well.
369+
370+
### 2021/06: The Old-New Chain (RootMyTV v2)
371+
Around 2021/06 LG started rolling out a patched version which involved some
372+
fixes for the tricks we used in this chain:
373+
374+
* Certain applications we used for private bus access have their permissions limited to `public`
375+
* LunaDownloadMgr now checks target paths against a list of regular expressions
376+
in `/etc/palm/luna-downloadmgr/download.json`
377+
* `start-devmode.sh` script is now shipped with a signature and is now verified using `openssl` on each boot
378+
* This one had an interesting side effect - it took approximately a month
379+
for LG to roll out a new Developer Mode application with signed
380+
`start-devmode.sh`, during which time updated TVs were unable to use
381+
developer mode at all.
382+
383+
Most of these mitigations are too trivial to work around, thus we still consider
384+
this chain unfixed.
385+
386+
* There are still applications on the system that are vulnerable to XSS attacks
387+
with private bus permissions
388+
* Regular expressions used to verify target paths are too broad, and thus still
389+
allow us to write to relevant paths
390+
* There are multiple paths that are executed during bootup, so we don't even
391+
need to use `start-devmode.sh`
392+
393+
Our initial estimate for fixing these issues in our chain were "a couple of
394+
hours" - patches theorized on our side on 2021/05/27 turned out to be correct,
395+
but due to some strategic choices and lack of personal time, we decided to
396+
postpone testing and release for a couple of months. Sorry. :)

css/common.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ header > h1 {
2929
font-size: 4em;
3030
text-shadow: 0 0 3px #d4ffff, 0 0 3px #d4ffff, 0 0 3px #d4ffff, 0 0 1em #0bb6be, 0 0 0.2em #0bb6be;
3131
}
32+
33+
header > h1 > small {
34+
font-size: 20pt;
35+
text-shadow: 0 0px 2px white, 0 0px 2px white, 0 0 0.4em #731178, 0 2px 0.2em pink, 0 -3px 0.2em #aa0000;
36+
}
37+
3238
article {
3339
line-height: 1.5;
3440
color: #c4f0fd;

docs/HEADLESS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ perform rooting on. This can help when rooting a TV without a working display.
2424
- Exit (or press back multiple times)
2525
2. Run an exploit in an external browser providing an IP address of a TV
2626
3. When asked for a connection prompt after a couple of seconds, press → and OK
27+
(or ↓ and OK on webOS 6.x+ / TVs released in 2021+)
2728
4. TV should reboot after a while and should start responding to unauthenticated
2829
telnet connections on its IP address.
30+
5. **Important:** since RootMyTV v2 we disable telnet by default after a second
31+
reboot. In order to keep it on you will need to connect over telnet on first
32+
boot after rooting and remove
33+
`/var/luna/preferences/webosbrew_telnet_disabled` file.

files/devmode_enabled

Lines changed: 0 additions & 1 deletion
This file was deleted.

files/dummy

Whitespace-only changes.

files/jumpstart.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# *** W A R N I N G ***
2+
#
3+
# Do **not** touch this file, nor /var/lib/webosbrew/startup.sh - this is a
4+
# crucial part of RootMyTV exploit chain.
5+
#
6+
# If you want your own startup script customization, create an executable script
7+
# in /var/lib/webosbrew/init.d/ directory - this will be ran during early
8+
# bootup.
9+
#
10+
# *** W A R N I N G ***
11+
12+
LD_PRELOAD="" nohup sh /var/lib/webosbrew/startup.sh & >/dev/null

files/shutdown-fix.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# This script is executed at bootup to fix up shutdown hook script that will
4+
# remove developer mode flag on certain shutdown events if start-devmode.sh
5+
# script is missing. (which is the case on post-2021/06 firmware versions, where
6+
# start-devmode.sh is signed)
7+
8+
# TODO: do we want to force-create com.lgerp directory here as well?
9+
10+
# Running pre-webOS 5.x (upstart)
11+
if [[ -f /etc/init/shutdown.conf ]]; then
12+
if ! findmnt /etc/init/shutdown.conf >/dev/null ; then
13+
echo "upstart: fixing shutdown.conf..."
14+
cp /etc/init/shutdown.conf /tmp/.shutdown.conf
15+
sed -i 's;/media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh;/var/lib/webosbrew/startup.sh;g' /tmp/.shutdown.conf
16+
mount --bind /tmp/.shutdown.conf /etc/init/shutdown.conf
17+
initctl reload-configuration
18+
else
19+
echo "upstart: fixed already"
20+
fi
21+
fi
22+
23+
# Running webOS 5.x+ (systemd)
24+
if [[ -f /etc/systemd/system/scripts/shutdown.sh ]]; then
25+
if ! findmnt /etc/systemd/system/scripts/shutdown.sh >/dev/null ; then
26+
echo "systemd: fixing shutdown.sh"
27+
cp /etc/systemd/system/scripts/shutdown.sh /tmp/.shutdown.sh
28+
sed -i 's;/media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh;/var/lib/webosbrew/startup.sh;g' /tmp/.shutdown.sh
29+
mount --bind /tmp/.shutdown.sh /etc/systemd/system/scripts/shutdown.sh
30+
else
31+
echo "systemd: fixed already"
32+
fi
33+
fi

0 commit comments

Comments
 (0)