News for hackers. Stuff that matters.
Re:A specific network name can completely disable Wi-Fi on y... by bitwize on Saturday June 19, 2021 @07:03PM (#27565336)
Yet another reason why C was a mistake.
Re:A specific network name can completely disable Wi-Fi on y... by jtaft on Saturday June 19, 2021 @09:09PM (#27566090)
Oof. I hate to call C a mistake. I hold the language close to my heart; quirks and all.

Sure there are safer models for computing. But it has served its purpose for a long time. A small language allowing highly performant programs/operating systems to be written. Plus we got to see the beautiful art form of exploit writing. Sure at what cost (lots), but all hackers can appreciate when a system gets owned. It’s the intentions that come after which bother us all.

Don’t get me wrong, I’m excited for newer languages like rust to come along. However, I learned so much about low level computing from c, and I’m forever grateful.

Hats off to Dennis Ritchie. Thanks for creating a language I met so many other hackers through, and sparking the curiosity of hacking within me.

Re:A specific network name can completely disable Wi-Fi on y... by m45t3r on Saturday June 19, 2021 @08:13PM (#27565795)
Parsing unstruted strings without escaping special characters is an issue in any language. This is completely Apple's fault.
Re:A specific network name can completely disable Wi-Fi on y... by plantain on Saturday June 19, 2021 @09:08PM (#27566082)
Funny how these faults keep happening over and over again in the same set of languages.
Re:A specific network name can completely disable Wi-Fi on y... by m45t3r on Saturday June 19, 2021 @09:40PM (#27566275)
I am pretty sure that I can have injection attacks from unsanatized user inputs in any language.
Re:A specific network name can completely disable Wi-Fi on y... by melff on Monday June 21, 2021 @10:19AM (#27579429)
Yes, but some languages (like my personal favorite Rust) make it practically impossible to happen with their equivalent of printf().
Re:A specific network name can completely disable Wi-Fi on y... by dmitrygr on Saturday June 19, 2021 @10:15PM (#27566496)
Funny how most car crashes are caused by humans driving.
Re:A specific network name can completely disable Wi-Fi on y... by melff on Monday June 21, 2021 @10:23AM (#27579467)
It's completely their fault either way. They are responsible for the technology they use.

This nasty printf()-like way of formatting is a giant footgun though. Apple are not the first ones to fall into this trap.

Re:A specific network name can completely disable Wi-Fi on y... by dylan604 on Saturday June 19, 2021 @09:09PM (#27566089)
We've all been trained to sanitize user input, but the WiFi SSID isn't a user input string, so why should I need to sanitize it? --some poor dev wondering where their Twitterverse sympathy is
Re:A specific network name can completely disable Wi-Fi on y... by m45t3r on Saturday June 19, 2021 @09:38PM (#27566259)
Yeah it is, I can definitely type my SSID in any device that I have.
Re:A specific network name can completely disable Wi-Fi on y... by kwdc on Sunday June 20, 2021 @12:39AM (#27567121)
I'm typing a new SSID in right now...
Re:A specific network name can completely disable Wi-Fi on y... by scintill76 on Saturday June 19, 2021 @10:58PM (#27566725)
In a better language than C, format string injection would be less likely to lead to arbitrary read/write/RCE.

I'll admit I looked around before writing this and saw that Python's str.format() can be pretty bad. So let's say a reasonably constrained formatting language in a good runtime -- the attacker is limited in what they can see or control, and the formatter can see how many arguments were actually passed so it doesn't tromp off into other memory.

Re:A specific network name can completely disable Wi-Fi on y... by pshc on Saturday June 19, 2021 @11:06PM (#27566765)
You are making a false equivalence—not all languages are equally busted. Any sanely designed modern language does not allow this to happen. Accidentally parsing a string you didn’t mean to parse is a fault of C’s outdated API design, a design flaw that keeps tripping people up again and again.
Re:A specific network name can completely disable Wi-Fi on y... by junon on Sunday June 20, 2021 @02:12AM (#27567590)
> Any sanely designed modern language does not allow this to happen

Sorry, how does Rust protect you against injection again?

Re:A specific network name can completely disable Wi-Fi on y... by melff on Monday June 21, 2021 @10:13AM (#27579373)
By requiring format strings to be literals.

https://play.rust-lang.org/?version=stable&mode=debug&editio...

Re:A specific network name can completely disable Wi-Fi on y... by pshc on Sunday June 20, 2021 @09:47AM (#27569911)
Why would Rust do anything weird when presented with the string "%p%s%s%s%s%n"?
Re:A specific network name can completely disable Wi-Fi on y... by junon on Sunday June 20, 2021 @11:36AM (#27571051)
Why would C?
Re:A specific network name can completely disable Wi-Fi on y... by pshc on Sunday June 20, 2021 @12:09PM (#27571414)
Do you want the obvious explanation? Because the string was passed into the format string parameter of some sprintf-like, a common mistake in C usually caught by warnings but seemingly ignored or suppressed in this case.

edit: turns out from the analysis it was CFStringCreateWithFormatAndArguments, so yes, a sprintf-like used incorrectly

Re:A specific network name can completely disable Wi-Fi on y... by junon on Monday June 21, 2021 @02:12AM (#27576742)
This is possible with any language. Not just C.
Re:A specific network name can completely disable Wi-Fi on y... by melff on Monday June 21, 2021 @10:15AM (#27579389)
No, Rust for example explicitly disallows this.

https://play.rust-lang.org/?version=stable&mode=debug&editio...

Re:A specific network name can completely disable Wi-Fi on y... by junon on Tuesday June 22, 2021 @02:43AM (#27588690)
You miss my point entirely.
Re:A specific network name can completely disable Wi-Fi on y... by melff on Tuesday June 22, 2021 @07:42AM (#27590441)
What is your point then?
Re:A specific network name can completely disable Wi-Fi on y... by junon on Tuesday June 22, 2021 @12:16PM (#27593553)
You can do this in any language. Rust doesn't support it with PrintLn but it's still possible with Rust. Stop acting like C did anything wrong.
Re:A specific network name can completely disable Wi-Fi on y... by melff on Monday June 21, 2021 @10:44AM (#27579653)
C wasn't a mistake. It used to be very popular for a reason. Just like steem locomotives, they served their purpose very well in their time, but the world has moved on.
Re:A specific network name can completely disable Wi-Fi on y... by kwdc on Sunday June 20, 2021 @12:34AM (#27567093)
Are Apple using C for this level of subsystem? I thought a lot was in Objective-C or is that just higher level stuff?
Re:A specific network name can completely disable Wi-Fi on y... by w0mbat on Sunday June 20, 2021 @02:29AM (#27567672)
Apple uses C for some bits.

Also there are Objective C APIs which take format strings, like +[NSString stringWithFormat:] and the system function NSLog().

Even Swift uses format strings in places. https://developer.apple.com/documentation/swift/string/31267...

Re:A specific network name can completely disable Wi-Fi on y... by chasil on Saturday June 19, 2021 @10:07PM (#27566451)
I would like to see Rust run on a PDP-8.
Re:A specific network name can completely disable Wi-Fi on y... by throayobviousl on Saturday June 19, 2021 @10:53PM (#27566690)
But it doesn't need to, and we are talking about a modern system.

C was great for its time, now its time to move on and use a sensible language.