HNHacker News
TopNewBestAskShowJobs

timschumi

434 karma · joined December 25, 2021

submissionscomments
timschumi··on Actively exploited sandbox RCE in all Chromium versions
> you seem to understand the domain

I'll have to note that I'm probably way worse than anyone doing this professionally or semi-professionally. This is the extent of what I learned as part of university, which was exclusively using planted vulnerabilities. The knowledge required to find and exploit such issues in a real-world scenario goes much deeper. My dayjob in security is on the entirely opposite side, since I'm doing defensive security on the system-level.

In short, it is quite likely that someone may join in and point out where my information is outdated or plain wrong. (Please do so!)

> My experience with C/C++ is somewhat limited but I imagine V8 does something like reserve a whole bunch of addresses and then manage them itself [...]

That is essentially correct, that's what the 4 Gigabyte allocation I mentioned before is. Let's call it the "v8 heap", because it is distinct from the heap that your system manages (which is the one used for `malloc` and `new`), but it will largely work in the same way.

> [...] with some internal list where script arrays/objects correspond to blocks.

v8 does have a lot of internal checks to make sure that what it is touching looks sane (at least on debug builds), but it will not have a lot of duplicated information. Having to check or update information in multiple places is both an artificial limit on performance as well as its own source of bugs (if not kept in sync correctly).

If v8 needs a JavaScript Object then it will simply ask the v8 heap for an appropriately sized memory allocation and fill in its data there, not unlike normal C or C++ objects (except that v8 usually refcounts, I believe). After this it will simply continue to work with the pointer that it already has.

> But what scripted integer or array could you pass it that would access anything already freed or outside the bounds of the addresses that array was mapped to?

You need to keep in mind that in this scenario, reading/writing outside the intended memory area is already the effect that we want to achieve, it is not the vulnerability.

We are not abusing some insufficient bounds check on an existing Array, _we make v8 believe that there is an Array_ (or at the very least something that it can use like one; in either case it's completely made up), and it happens to have its data stored at the location and length that we want.

> Wouldn't that have been accounted for in the most basic design?

Yes, and for that reason the interpreter itself is considered pretty much battle-tested. However, in search for more performance, multiple JavaScript engines have turned towards engineering Just-In-Time compilers to accelerate running code that runs so often that the compile overhead is worth it. v8 / Chromium / Google alone have a set of three JIT compilers (Sparkplug, Maglev, TurboFan) that compile interpreter bytecode to actual machine instructions depending on what is currently required and how fast the resulting code should be.

> What's an actual snippet of pseudo-JS that could make the engine overrun its memory and start reading out of arbitrary addresses, even within the sandbox?

Those are a bit hard to come by, even more so since the focus for v8 exploitation has changed to targeting the JIT compilers. This usually means that a lot of the exploit would be concerned with wrangling the compiler into place.

I'll try to give an example of what a type confusion involving the JIT compiler looks like, but this is based on work by my classmates, since I never finished that particular part of the exercise. It is also recited purely from recollection, since I'm not near my university notes.

To get the best possible code optimization the compiler wants to work with some assumptions. If any of those don't hold anymore, the compiler should either never have optimized or at the very least it should deoptimize before anything happens and fall back to a more flexible way of running that code.

One such nugget of information is whether certain well-known properties (let's say .name) can have side effects, those are kept as lists in the source code of the compiler [1]. If the compiler is told that .name can not mutate its object (contrary to the specification and the remainder of the v8 implementation), then it may choose to elide type change checks within the optimized function (that has already been optimized for a specific type) and miss a deoptimization.

If v8 then uses the optimized function after it should have been deoptimized, we essentially get a function that uses an area of memory as if it were a different type of object.

PS: I should get back into this, even just explaining already-done things sounds fun.

[1] https://chromium.googlesource.com/v8/v8/+/9f30cc5fc4ad6c3236...

timschumi··on Actively exploited sandbox RCE in all Chromium versions
The Chromium issue is not public yet, so let's go with a very simple example.

Let's say that you have a type confusion bug that (in terms of the interpreted language) allows you to use an Integer variable as an Array.

That sounds nonsensical when just considering the high-level language, but your computer is going to need something to work with when running a script. For an Integer variable it will for example store the value, and for an Array it would store a pointer to a data area (and that area then contains values).

Now, if the interpreter loses track of which type a certain variable is, then it will also not know whether to interpret the internal data as a plain value (arbitrarily chosen by the script/attacker) or a pointer to well-formed data (carefully chosen by the runtime).

As an immediate step, letting the attacker use an address of their choosing for array operations would allow them to read and write arbitrary memory that is reachable with this form of addressing.

I'm putting specific emphasis on "form of addressing" here, because the v8 authors have considered this possibility and put additional protections in place. Within the sandbox, "addresses" are limited to a size of 32 bits, and address within a dedicated 4 Gigabyte area that is specifically for interpreter data. Within that area you are not going to find a lot of critical data to affect outside operations, you'd have to find a way to escape that memory area first.

The next part is going to be a bit hazy because it's been some time since I did Chromium exploitation, and getting code execution within the sandbox from data writes is itself not an easy task.

Now, we have established that there is not a lot of terribly important data within the 4 GB area. The data managing the interpreter lives outside, and any JITed code will also live outside because it needs different access permissions. We only really get to play with Objects and their data.

Objects handling executable code are rare, but there are a few that are at least adjacent. Last time I checked, WASM was one feasible choice where you get reasonably predictable results with custom data, as it included a pointer to actual executable code that represents the WASM program.

Under the assumption that the WASM interpreter/compiler does its job correctly the full block of executable code will not be very interesting. However, any integer constant in the program will end up somewhere within the executable code, and that would give you enough controllable data to encode one or two arbitrary instructions and a relative jump to the next integer constant. To start execution at the first integer constant, we'd then just modify the Object data of the WASM program to slightly offset the entrypoint.

And that's the short form of a possible (and likely outdated) way of getting semi-arbitrary code execution within the sandbox (as we are running as a WASM program, and therefore have all the usual syscall restrictions and other security features engaged).

timschumi··on Asahi Linux Progress Report: Linux 7.2
The processor version with the debugging incompstibilities was M4, I think.
timschumi··on llama.cpp
Is that with vanilla llama.cpp or with the third-party llama-swap manager? Last time I checked llama-swap was still the go-to solution, although I admit I haven't looked into it further.
timschumi··on LineageOS Statistics
If you are talking about the addition of microG, that indeed seems like it hasn't been mentioned on the blog, although I'd argue very likely due to an oversight.

I can find internal conversations that it deserves to be announced in a more prominent way than on the "Sunsetting LineageOS 18.1" post, was left as "to be added to the LineageOS 22.x" blog post, and then just never made the initial draft. Whoops.

If you are talking about the rules on the subreddit (or the other social platforms), that one indeed has been discussed a lot on the platform itself (and which we usually keep available).

timschumi··on LineageOS Statistics
> They stopped that malpractice a while ago (last year?).

By now it has actually been almost two and a half years.

> But they really hurt their credibility with the prior stance, and that their subreddit still has rules forbidding almost all discussions [...].

While I'm not looking to turn this into an off-platform meta discussion, pretty much all of those rules have their very good reasons to be there.

As an example, you would be surprised how many people install a Magisk module to strip away LineageOS-specific build version properties, and then end up in our support platforms asking why the Updater can't search for new updates (of course while not mentioning that they have modified their system).

microG I don't even see listed as a part of any rule anymore, it was removed when upstream support for microG was merged.

timschumi··on LineageOS Statistics
For a slightly more manageable list, the 590 of those that are or were supported officially are also listed on the LineageOS wiki [1].

[1] https://wiki.lineageos.org/devices/

timschumi··on GrapheneOS fixes Android VPN leak Google refused to patch
Not sure where CalyxOS came up in this?
timschumi··on The Orange Pi 6 Plus
And it doesn't seem like anything newer than ARMv9.2 is available either, no matter the price point.
timschumi··on I stopped using NixOS and went back to Arch Linux
Every system and package manager will be affected if it cannot download source code to build a package.

NixOS less so, because pretty much all source downloads that are not restricted by license are a separate output that will therefore be stored on (and downloadable from) NixOS cache servers.

I'm not sure what your expectation for this is in general, nobody can just wish into existence data that is just gone.

timschumi··on Daily Driving GrapheneOS
> LineageOS was one of the OG de-googled Android ROMs, renamed a few years after Android Jellybean IIRC.

Existing since 2009 as CyanogenMod and since 2016 as LineageOS, that would have been around the time where Android 7 (Nougat) was current.

PS: Not that we are in any way degoogled, other than what we are forced to by the license.

timschumi··on Fabrice Bellard Releases MicroQuickJS
It's unfortunate that he uploaded this without notable commit history, it would be interesting to see how long it takes a programmer of his caliber to bring up a project like this.

That said, judging by the license file this was based on QuickJS anyway, making it a moot comparison.

timschumi··on Gimp Source Code
That's... cool, I guess?
timschumi··on GrapheneOS is the only Android OS providing full security patches
Not for the ones on the receiving end.
timschumi··on LineageOS 23
> I can't even fathom what the build system is doing in order to require this amount of storage.

A large number of 17 year old repositories, prebuilt toolchains, and the fact that you otherwise have every little bit of source code, intermediary results, and output to create a full operating system all in the same place.

As for the memory, the very first step (that basically already is the benchmark for the most memory usage) is loading the entire build tree and generating build steps. Yes, that takes 32GB of RAM, if not 64GB nowadays.

timschumi··on LineageOS 23
There is a guide on how to set up LineageOS for libvirt (i.e. QEMU) [1], but there exist no prebuilt images at this point in time.

[1] https://wiki.lineageos.org/libvirt-qemu

timschumi··on LineageOS 23
As far as I have heard they have not actually secured partner access for themselves, they just got someone who has access to break their NDA.
timschumi··on LineageOS 23
:^)
timschumi··on Helium Browser
> What's wrong with asking to expedite the removal process, considering the process is detailed in the guidelines?

Asking is one thing, the other thing is not accepting the decision of a maintainer on a topic that is at the maintainers discretion and instead taking it to social media [1] [2] for it to be brigaded.

Addendum: It additionally appears that this was filed before the browser was even launched, if the Wayback Machine and their social media posts are anything to go by.

[1] https://x.com/uwukko/status/1970161297783238905 [2] https://x.com/theo/status/1970266199469810127

timschumi··on Helium Browser
Couldn't try to (together with Theo / t3) bully the Homebrew developers into a forced takeover of a package [1] if it were a conflict-free name.

[1] https://github.com/Homebrew/homebrew-cask/pull/229061

timschumi··on Graphene OS: a security-enhanced Android build
> My main complain by far to LineageOS is the necessity to wipe everything for major releases on my S10. That's not possible every year.

Are you sure that you are not just misinterpreting the upgrade instructions?

For the S10 a mandatory wipe-on-upgrade has last been the case when upgrading from versions _older than LineageOS 21.0_.

During the time where LineageOS 20 was the current version there was no requirement to wipe listed at all, so presumably it didn't exist then.

timschumi··on Google WiFi Pro: Glitching from Root to EL3: Part 1 – Characterization
Just so that nobody ends up confused: This is the same topic as posted here [1] a week ago, but presented in a blog post series format instead of as a slide deck.

[1] https://news.ycombinator.com/item?id=44498614

timschumi··on How a single line of code could brick your iPhone
> Screwing up EFI vars doesn't make most systems unbootable. I have corrupted my EFI vars quite a few times trying to do funny things. UEFI implementations do tend to be buggy, but not all of them are that catastrophically bad.

For what it's worth, I have a laptop here that can be irrevocably (short of having a flash memory dump on-hand that can be flashed back) bricked just by messing around with EFI variables through fully intentional operations (i.e. operations that would be available to any program with Administrator privileges on Windows, or the root user on Linux).

timschumi··on Welcome to Ladybird, a truly independent web browser
> It's already a basically bleeding edge C++. Why is it so much to ask for developers to use a more mature and established iteration so I don't need a brand new compiler?

Because C++ got better and better in recent versions?

You are essentially asking to forego large amounts of improvements that allow for writing more maintainable code, just because you are too lazy to install a compiler that has been released 1 year and 10 months ago (in the case of GCC 13) or 1 year and 5 months (in the case of Clang 17).

timschumi··on Ask HN: Google login has circular dependency
But that's still not a circular dependency then, that's just the normal case for "I lost all my verification options" and it's exactly what the last option is for.

If I create an account via e-mail and password at a random service, destroy the password and delete the e-mail account, then it's not a circular dependency. In fact, the service has nothing to do with it, it can not know that you don't have access to either the e-mail or the password.

timschumi··on Ask HN: Google login has circular dependency
There is no circular dependency.

Notifications and prompts are going to show up on your old iPhone, and you got some 2FA backup codes when enabling your 2FA authenticator.

timschumi··on LineageOS 22
Prebuilts of various LineageOS apps are available here: https://www.sebaubuntu.dev/lineageapps.html
timschumi··on LineageOS 22
The user-side will work with all kernels that contain the matching driver, but the user-side will not necessarily work on future Android versions without modification.
timschumi··on LineageOS 22
The kernel side of drivers is already published under a FLOSS license, it's just that the code quality is usually subpar and the important changes are crammed into a tarball together with (sometimes) millions of other lines of changed code.

The sources for the matching userspace binaries (which are usually the issue for Android version bumps) are usually under NDA by the component manufacturer and can not be released by the OEM independently.

timschumi··on LineageOS 22
There also is an updated version with fixes that never got merged into upstream Heimdall: https://git.sr.ht/~grimler/Heimdall
Page 1 of 2Next →