News for hackers. Stuff that matters.
Re:Hacking Transcend WiFi SD Cards by jrockway on Sunday August 11, 2013 @05:01PM (#6196314)
As someone who's written software for all his life, I'll posit that most "software engineers" write code like this. People don't test corner cases; they just shit out code, check that it works in the browser, and ship it. That's why the regexes like /.PNG/ are in there: they work, but they don't prevent the security problems they intend to prevent. If the engineer writing the code had written unit tests that checked various filenames, he would have discovered the bug immediately. If there were code reviews by someone who knew even the tiniest bit of Perl, the `$user_controlled_command > file` bug would be gone. If the programmer had run Perl with taint mode enabled, he would have discovered this bug instantly.

I think it's a mental thing: most people writing code never think "how could this go wrong", since they assume that they don't make mistakes. If you don't have a healthy fear of the code you write, you're not going to test the corner cases or not write complex features.

Ultimately, I'm not complaining, because buggy software is great in the context of devices that try to prevent you from doing something with your own property. I especially encourage people to write their system-level software in C and use lots of strcpy calls. It ensures that I can root my phone even though the carrier doesn't want me to.

Re:Hacking Transcend WiFi SD Cards by femto on Sunday August 11, 2013 @08:39PM (#6197051)
Another explanation is that there is no benefit to the manufacturer in writing tighter code. Tighter code means more time spent on testing and review, but probably wouldn't increase sales. From a bottom line point of view, the mantra is get it working and ship it.
Re:Hacking Transcend WiFi SD Cards by toble on Sunday August 11, 2013 @10:29PM (#6197350)
Yep. Whenever you work in an industry that involves churning out software as quickly as possible, it's easy to appreciate that commercial pressures are often too great to test properly. Whereas with start-ups (for example), they're usually well funded and have a strong focus on building great software.
Re:Hacking Transcend WiFi SD Cards by yuhong on Sunday August 11, 2013 @05:43PM (#6196443)
Ultimately, I'm not complaining, because buggy software is great in the context of devices that try to prevent you from doing something with your own property. I especially encourage people to write their system-level software in C and use lots of strcpy calls. It ensures that I can root my phone even though the carrier doesn't want me to.

Reminds me of claims of deliberate backdoors. Of course, these can often be used for bad things too.

Re:Hacking Transcend WiFi SD Cards by deegles on Monday August 12, 2013 @12:58PM (#6200245)
How can I as a developer be sure my unit tests are complete? How can we develop or improve that ability to think "what could go wrong?"

I don't think they developers of Android, iOS, or the PS3 (and many others) were using insecure coding practices. They still got rooted over and over again.

Re:Hacking Transcend WiFi SD Cards by mikeash on Sunday August 11, 2013 @09:40PM (#6197204)
I don't think it's that they assume they don't make mistakes, but simply that they literally can't do any better. For some programmers, making something work at all is a mighty struggle, and once it does work, that's the best the can do.

We were all there once. It's a stage you hit when learning to program. Some of us passed through it, while others simply remain there forever.