News for hackers. Stuff that matters.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @04:20AM (#41796743)
We need a browser written in managed lang

Even if it means some perf drop, modern hardware will get it back in X years, but safety will be significantly improved

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by SoothingSorbet on Thursday October 10, 2024 @04:29AM (#41796803)
Why managed when it could be in Rust and have both performance and safety?

The Servo shouldn't have ever been laid off. Yes, I'm aware a team is working on it now, but it isn't up to the same speed and enthusiasm as it was when funded by Mozilla, is it?

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @05:25AM (#41797105)
Im aware of Rust, but there is C#/Java too, with way bigger ecosystem, community and lower entry level.

At the end of the day web browser is just bunch of parsers and compilers working together, and some video/audio

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Malidir on Thursday October 10, 2024 @06:21AM (#41797381)
Microsoft are re-writing c# stuff in Rust! https://news.ycombinator.com/item?id=39240205
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by sunshowers on Thursday October 10, 2024 @06:00AM (#41797272)
The problem with writing a browser in C# or Java is that neither of them can provide anywhere close to the level of thread safety that Rust does.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by chii on Thursday October 10, 2024 @06:42AM (#41797486)
both java and c# has thread safety primitives that are also pretty easy to use. E.g., the java concurrency package.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by om8 on Thursday October 10, 2024 @08:02AM (#41797989)
The cool thing about rust is that it forces you to use thread safety primitives. It's called fearless concurrency
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Yoric on Thursday October 10, 2024 @09:09AM (#41798426)
Having done concurrency in Java and Rust, my experience is that Rust's concurrency primitives are an order of magnitude better than Java's. I haven't tested C#'s.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by sunshowers on Thursday October 10, 2024 @01:26PM (#41801124)
No, that's not what I'm talking about. C# and Java have nothing like the Send and Sync traits, and they don't have & and &mut.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by neonsunset on Thursday October 10, 2024 @06:04PM (#41804058)
C# doesn't have Send and Sync that is true. It frequently does not need either because it uses GC instead of affine types for automatic memory management. Synchronization is indeed "just don't write bugs", where Rust offers a massive upgrade, but .NET CoreCLR's memory model is more strict than C one, like object reference assignment having release semantics, so quite a few footguns are luckily avoided: https://github.com/dotnet/runtime/blob/main/docs/design/spec...

'&' and '&mut', however, are your 'ref readonly' and 'ref' respectively.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by sunshowers on Friday October 11, 2024 @02:41AM (#41806880)
Is there anything in C# which ensures what Rust does statically, that you must acquire a lock to access data protected by a mutex? Rust also has MutexGuard not be sendable i.e the mutex won't be released on a different thread from which it is acquired.

With traditional mutex APIs it's just far too easy to get it wrong. I think you just have to structure your thread-related APIs to be misuse resistant. As humans we're just not good enough at not making mistakes.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by neonsunset on Friday October 11, 2024 @09:23AM (#41809276)
> I think you just have to structure your thread-related APIs to be misuse resistant

The premise of this stays. C# approaches this in a more traditional way, with exposing the set of synchronization primitives. It's a step above C and, usually, C++ still because you don't need to e.g. have an atomic reference counting for objects shared by multiple threads.

Concurrent access itself can be protected as easily as doing

  lock (obj) {
    // critical section
  }
This, together with thread-safe containers provided by standard library (ConcurrentDictionary, ConcurrentStack, etc.) is usually more than enough.

What Rust offers in comparison is strong guarantee for complex scenarios, where you usually have to be much more hands-on. In C#, you can author types which e.g. provide "access lease", that look like 'using var scope = service.EnterScope(); ...`, where using turns into a try-finally block, where finally that calls .Dispose() on the scope is guaranteed to be executed.

It's a big topic, so if you have a specific scenario in mind - let me know.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by sunshowers on Friday October 11, 2024 @03:05PM (#41812439)
Thanks! To be fair, there are certain advanced scenarios which Rust's mutex model can't handle either -- sometimes you want to protect writes via a mutex, but allow reads without them (maybe you're okay with torn state on reads). This is a rare, expert use case with architecture-specific considerations that must be handled with care.

I do think Rust's mutexes handle almost every use case that can be thrown at them, though, and in a way where it's next to impossible to get it wrong. I think if you're writing a browser engine in the 21st century you should bake in parallelism and concurrency from the start, and Rust is the most suitable language to do that in.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by eqvinox on Thursday October 10, 2024 @05:44AM (#41797196)
Servo exists, in Rust. I don't know of any browser engine in C#/Java?

Also, modern browsers as a whole outsize entire OSes (sans browser)...

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by cesarb on Thursday October 10, 2024 @08:03AM (#41797994)
> I don't know of any browser engine in C#/Java?

A famous one is HotJava. According to Wikipedia, it was also the first web browser to support Java applets.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Yoric on Thursday October 10, 2024 @09:09AM (#41798429)
It was also a mess :)
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by eqvinox on Thursday October 10, 2024 @04:21PM (#41803126)
> A famous one is HotJava.

"Final release: Late 2004; 20 years ago"

I guess I should've specified "not completely and utterly dead"? ;D

(Also, the size and complexity of a browser at that point in time was arguably still a whole lot less than a modern one)

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Ygg2 on Thursday October 10, 2024 @05:48AM (#41797215)
> At the end of the day web browser is just bunch of parsers and compilers working together

At the end of the day, OS is just a bunch of command lines being piped together. /sarcasm

Sure, you are just missing: rendering, layout, security, network traffic for sockets, low-level control over hardware, writing a decent enough VM, image processing, video playback, music playback, compression, decompression, self-update, decryption, don't forget add-ons people love add-ons, also add-on security and isolation, web edit and debug tools, network analysis tools, etc.

You know, little things.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @06:06AM (#41797301)
Why would you need to reinvent networking layer instead of just sending http requests via matrue, battle tested lib available in your programming ecosystem e.g from MSFT? Same with crypto, sockets, compression, etc?

Video and audio I mentioned.

Extensions are tricky, right, but more from privacy standpoint cuz after all you can just expose too much

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by viraptor on Thursday October 10, 2024 @08:00AM (#41797971)
Browsers are using new http features much earlier than they're available in the system libraries. Browsers supported http2 and 3 before they were standardised enough to include in systems. .net http client still can't even tell you about http2 early hints as far as I understand it.

It's going to be the same for crypto and compression. Systems don't ship with brotli for example. The battle tested implementations come to the browsers first in many cases - or at least they're battle tested at the point anyone starts including them in .net or Java.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @09:52AM (#41798836)
Sure, not being at the leading edge is a disadvantage, but I guess you could still handle 99.x% of web pages
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by michaelt on Thursday October 10, 2024 @07:18AM (#41797697)
All the major browsers came out when Windows XP had substantial market share.

So browser vendors couldn't rely on the platform to provide up-to-date SSL support. Or MP3 support. Or MPEG-4 support. Or PDF support. This established the norm that browsers would ship their own video support, their own SSL support, and so on.

And Google realised they like the power this gives them - if Google wants to replace HTTP with QUIC or introduce a new video DRM standard, or a new video codec like VP9 - they don't need the cooperation of anyone outside of Google.

If Chrome bundles DRM support (allowing it to play Netflix), and its own HTTP/2 stack for speed - are you going to release a browser that's slower and doesn't play Netflix? Doesn't sound like a recipe for big market share.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Ygg2 on Thursday October 10, 2024 @07:14AM (#41797673)
> Why would you need to reinvent networking layer instead of just sending http requests via matrue, battle tested lib available in your programming ecosystem e.g from MSFT?

Because modern browsers are essentially cross-compatible OSes.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @09:47AM (#41798774)
So is .net
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by eqvinox on Thursday October 10, 2024 @04:25PM (#41803191)
You've clearly never tried to use .net on a non-MS OS. Sure, it's possible. But it's also a royal pain, at least last time I checked.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Friday October 11, 2024 @03:24AM (#41807143)
I had .net on prod linux since 2018 and it works very fine. Web apps.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by eqvinox on Friday October 11, 2024 @07:23AM (#41808450)
I'm happy to hear of your experience, but all we have at this point is a sample size of 2 with one good experience and one poor one…

(I've tried [and failed/given up after about 2 weeks] to get a .net desktop application to build on Linux.)

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by neonsunset on Friday October 11, 2024 @09:32AM (#41809351)
I hope you haven't been trying to use Mono or something obscure for this, which unfortunately happens from time to time.

If you have .NET SDK installed (you can get it with apt/dnf install dotnet8 or dotnet-sdk-8.0), you only need the following:

  dotnet new install Avalonia.Templates
  dotnet new avalonia.app
  dotnet run
If you don't like XAML, you can use https://github.com/AvaloniaUI/Avalonia.Markup.Declarative to write declarative SwiftUI-like code. You can also use F# if that's your cup of tea: https://github.com/fsprojects/Avalonia.FuncUI.

If you prefer GTK, there are rich GObject bindings that are a successor to GTK#: https://gircore.github.io/

Here are samples that demonstrate basic GTK4 usage scenarios: https://github.com/gircore/gir.core/tree/main/src/Samples/Gt...

All this should require less than 10 minutes including setup and such.

Lastly, I want to make a disclaimer that you do not need C# Dev Kit extension (which requires an account that annoys many people, including me) for VS Code, only the base C# one, which is what gives you language server, debugger, etc. If you are using VSCodium which cannot use closed-source vsdbg component that the base extension uses, you can replace it with https://github.com/muhammadsammy/free-vscode-csharp which uses open-source debugger from Samsung instead. It can be rough around the edges but works well enough in standard scenarios. Just don't use Debugger.WriteLine over Console. :D

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Yoric on Thursday October 10, 2024 @09:31AM (#41798614)
Many of these components have been made part of the ecosystem long after they were introduced in Firefox. Also, the more platform-specific you go for each component, the more you're going to introduce subtle incompatibilities between Firefox running on different versions of Windows or in Firefox for Windows vs. macOS vs. Linux. Also, for a very, very long time, Microsoft had an extremely poor record in terms of security fixes. So what happens when you rely on a Microsoft http library and Microsoft takes a year or two to release a 0-day?

There are benefits to this approach, of course, but the costs would have been consequential.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Yoric on Thursday October 10, 2024 @09:11AM (#41798455)
> At the end of the day web browser is just bunch of parsers and compilers working together, and some video/audio

That's... an interesting reduction :) I guess it's about as true as saying that the Linux Kernel is a bunch of I/O and a scheduler?

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by ftrobro on Thursday October 10, 2024 @05:01AM (#41796980)
Rust was created at Mozilla and currently 11.7% of the Firefox source code is in Rust:

https://4e6.github.io/firefox-lang-stats/

That's down from 12.49% at the peak in July 2020 so I assume the conversion work was halted after the layoffs in 2020:

https://docs.google.com/spreadsheets/d/1flUGg6Ut4bjtyWdyH_9e...

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by mozvalentin on Thursday October 10, 2024 @06:27AM (#41797409)
Android code was recently imported into mozilla-central which is quite considerable in size.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by extraduder_ire on Thursday October 10, 2024 @06:29AM (#41797420)
I was thinking it looked like non-rust code diluted the percentage from the graphs, rather than an amount of rust code being removed.
[dead]
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by sph on Thursday October 10, 2024 @05:35AM (#41797155)
What's that got to do with anything? The CEO situation is awful, but this is just flame bait on your part.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by psychoslave on Thursday October 10, 2024 @07:27AM (#41797752)
It’s all have to do with resource management here.

It’s obvious that laying off people that were working hard at making more robust the flagship product of the non-profit wasn’t going to result in a an increase of security in this product. Could the whole lay-off have been prevented? That would require some number analysis here, and insights I lake.

Could at least some termination have been avoided? Freezing the income of the CEO until some agreed metrics improve, and use the amount thus spare to save some employ salary was certainly an option here, wasn’t it?

Claiming "think of my family, look how much more some other people earn elsewhere" while almost simultaneously (at organization level at least) putting so many people in a jobless position, that’s a rather bold cognitive dissonance to throw at the world to my mind.

If pointing out "odd financial priorities" of a non-profit is flame bait, one might wonder how humanity is supposed to mend all organizational dysfunctions it can ever fall into.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by redserk on Thursday October 10, 2024 @05:53AM (#41797244)
It’s pretty relevant considering the continued mismanagement of Mozilla.

Nobody would care about Mozilla in 2024 without Firefox, but Firefox development seemingly takes a back seat to a variety of other pet projects that Mozilla’s management tries (and keeps failing, over and over) to chase.

For example, they’ve been trying a pivot to become a community-focused privacy company the last couple of years, yet are fine with implementing ad topics.

AFAIK didn’t Safari advocate against it over privacy concerns? If so, what is Mozilla doing?

Or their partnering with a shady company for removing data from data brokers.

Before the privacy pivot, there was the “we want to make browsing better” pivot with their acquisition of Pocket that went nowhere.

From the outside Mozilla looks like a low-scoring charity grift you’d find on CharityNavigator with how far they deviate from the missions they claim to support.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by heresie-dabord on Thursday October 10, 2024 @05:34AM (#41797148)
From the fine article:

> Throughout 2024, so far, Mozilla had to fix zero-day vulnerabilities on Firefox only once.

> On March 22, the internet company released security updates to address CVE-2024-29943 and CVE-2024-29944, both critical-severity issues

Vulnerabilities will be found in everything. Firefox is a fully internationalised application and it is FOSS. The team responsible for Firefox is doing a good job.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @05:46AM (#41797201)
>Vulnerabilities will be found in everything.

Different ratios, different consequences, etc.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by mikae1 on Thursday October 10, 2024 @04:56AM (#41796956)
Ladybird[1] is switching to Swift[2].

[1] https://ladybird.org

[2] https://news.ycombinator.com/item?id=41208836

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by hypeatei on Thursday October 10, 2024 @05:36AM (#41797165)
That's not completely accurate. The plan is to use Swift for "security critical" areas like decoding data. It's unlikely core components like the layout/CSS engine will be converted to Swift.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by actualwitch on Thursday October 10, 2024 @05:24AM (#41797101)
Swift didn't save apple from rce's in blastdoor.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by fulafel on Thursday October 10, 2024 @04:52AM (#41796935)
They already are partly in JS so there's a smooth path.

(Wasm isn't safe but could be a building block too)

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by flohofwoe on Thursday October 10, 2024 @04:59AM (#41796973)
I can't find the link right now but I seem to remember that Firefox already replaced some internal native subsystems with the same code compiled to WASM - or maybe even compiled to WASM and then translated back to C, which basically adds a runtime memory safety layer to unsafe C code at the cost of some performance (I think it was a couple of media codecs, but not sure).

Not sure why you think that WASM is less secure than JS though. Even if the WASM heap has internal corruption there's no way for this to do damage outside the WASM sandbox that wouldn't be possible in JS.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by cesarb on Thursday October 10, 2024 @08:07AM (#41798024)
> I can't find the link right now but I seem to remember that Firefox already replaced some internal native subsystems with the same code compiled to WASM - or maybe even compiled to WASM and then translated back to C

Was it this one? https://hacks.mozilla.org/2021/12/webassembly-and-back-again...

Or perhaps this one? https://hacks.mozilla.org/2020/02/securing-firefox-with-weba...

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by fulafel on Thursday October 10, 2024 @05:05AM (#41797002)
If your browser is running in a wasm sandbox, it's a minor comfort that only your browser gets compromised which contains all your creds, etc.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by flohofwoe on Thursday October 10, 2024 @05:05AM (#41797006)
Only parts of the browser are running in multiple small isolated WASM sandboxes, those WASM sandboxes are isolated from outside world about as well as if they would run in their own process.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by fulafel on Thursday October 10, 2024 @05:06AM (#41797010)
Compartments of internally unsafe sandboxes are what we have now, with browsers employing native-code sandboxes and isolated renderer processes etc. It gets leaky.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by guappa on Friday October 11, 2024 @05:09AM (#41807714)
> there's no way for this to do damage outside the WASM sandbox

java applets promised a sandbox and then we had years of continuous vulnerabilities of escaping said sandbox.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by tomrittervg on Friday October 11, 2024 @08:26AM (#41808880)
This is true, but adding a sandboxing to browsers has been a huge part in driving up the difficulty/cost of browser exploits, and driving down the frequency of their use.

And also we'll pay for a bypass of the wasm sandbox. (Actually, looking at our table, I'm going to try and get the bountyamount upped...)

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by flohofwoe on Saturday October 12, 2024 @05:52AM (#41817897)
Java applets didn't sandbox shit though, because you could call straight into your own native code via JNI (I know because I used exactly that approach to integrate a Win32 game client into browsers). The only thing that the applet launcher did was asking if it is ok to run the applet.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by guappa on Sunday October 13, 2024 @02:17PM (#41830212)
You're probably thinking of microsoft java. I was talking about the proper java.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Ygg2 on Thursday October 10, 2024 @05:02AM (#41796988)
Sounds like Mozilla should invent a low level language with great safety guarantees, maybe even call it after some form of oxidation process[1]. Then make a browser engine called after a motor[2], and then NOT axe the team responsible for it[3].

I think the last part might be crucial.

[1] https://www.rust-lang.org/

[2] https://servo.org/

[3] https://paulrouget.com/bye_mozilla.html

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by high_na_euv on Thursday October 10, 2024 @05:24AM (#41797098)
Im aware of Rust, but there is C#/Java too, with way bigger ecosystem, community and lower entry level
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by Yoric on Thursday October 10, 2024 @06:28AM (#41797414)
A long time ago, the possibility of using Java or C# in Gecko (the core of Firefox) was pondered.

Java was rejected because of the huge memory requirements and the unpredictable (and sometimes lengthy) garbage-collection pauses.

C# was rejected because (at the time) it was too tied to the Microsoft ecosystem and there was no way to get it to build on all the platforms for which Firefox is available. I don't remember garbage-collection pauses being discussed, but they would also be an issue.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by m4rtink on Thursday October 10, 2024 @06:21AM (#41797380)
It seems to me that both C#/Java have build their own niches and are hard to impossible to realistically use outside of them, such as to write a web browser.
Re:Mozilla fixes Firefox zero-day actively exploited in attacks by aryonoco on Thursday October 10, 2024 @06:16AM (#41797349)
I think of browsers these days on par with OSes. I mean, they provide a runtime to execute binary code (wasm). They do process management and scheduling. They do a lot of things which up until 15 years ago, we thought bongs to the realm of Operating Systems.

And history has shown that when you need to do that kind of low level code, it's nigh on impossible to achieve acceptable results with a garbage collected language. Many people tried, none really succeeded.

Hence why Rust was made

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by moffkalast on Thursday October 10, 2024 @05:32AM (#41797137)
> if it means some perf drop, modern hardware will get it back in X years

I think the unfortunate reality is that other browsers will also take advantage of that speed boost, sites will get even more bloated because they can and it will stay unusable for a long long time.

Re:Mozilla fixes Firefox zero-day actively exploited in attacks by guappa on Friday October 11, 2024 @05:07AM (#41807707)
Run your browser in a namespace. You can get firejail.