Huawei savaged by Brit code review board over poor dev practices
theregister.co.uk
theregister.co.uk
> Finding general issues is a good thing, but other vendors are not subject to this level of scrutiny. We have no real (at least not this in depth) assurance that products from rival vendors are more secure."
Pretty sure companies like Cisco (who have had recent high-profile security fails) would not want the same code review.
Until they do, and someone can do a comparative analysis of the two sets of codebases, there are no useful conclusions to be taken by decision makers.
The only value here is for firmware developers - learn from these mistakes. Hopefully GCHQ is coming for your code next.
That being said, Cisco is a bag of dicks when it comes to their support contracts, pricing, and any of their consumer rubbish.
Juniper and other 2nd tier hardware vendors are a bigger threat than Cisco IMO, their gear is much more common, and much more vulnerable (JunOS is a pile of security vulns). None of them take proper software development seriously, and the audits they've undergone are often just to rubber stamp their products.
Frankly, none of these companies should be rolling their own "firmware", as they've proven that they won't reliably update as upstream (usually OpenWRT or Debian) push out security critical updates. Downgrading them to a role whereby their secret sauce is just an extra APT repo/extra metapackage from opkg is more than sufficient for what these companies need, while preventing them from accidentally or purposefully blocking updates.
I won't be able to sleep tonight, thank you very much... Lucky me I only develop for medical devices. Nobody seem to care about that too much...
But firmware often does carry config-files for many, many different hardware revisions and versions. Creating a binary is mostly more work than just calling ./configure.
This code is never nice code. It is also difficult to implement unit tests. So for efficient testing, you need a good laboratory. With many fancy hardware devices... Additionally, the code was probably meant to never get public.
> these haven't been "universally applied"
This is probably the case for any vendor that existed for more than half a year. To be honest, I can see the criticism, but there will be lacking "hygiene" at least at some cases.
I wouldn't criticize the coders as much as the person responsible to use hardware from a chines vendor for critical infrastructure, that makes this kind of verification necessary.
Why not build your own system then?
Not until someone in a company has a great idea of hooking that up to the internet insecurely...
Basically the medical equivalent of attaching the internet on Jeep's CAN bus...
I wish I'd had these huge resources (and freedom that comes with it to innovate) available in other projects.
It's well known that Huawei competes on price not on quality so I guess pouring all that cash into QA doesn't make sense for them.
(From my previous related comment[1] here) they are shit because they pitch to ICS and governments but are behaving like a start-up:
> What hurt the established (big) guys most is that they actually thought like a start-up. If you worked at Huawei as a junior in Italy and other sites, you were allowed to move across departments and fields getting a well rounded picture of how the telco-sector works. If you wanted to gain the same experience with the big guys you'd have to stay 15-20 years in the company as opposed to 3-5 with Huawei. This is why Huawei engineers are highly sought after by other telco firms.
I can well imagine what it's like to work on the code described in that document ;-)
> In the first version of the software, there were 70 full copies of 4 different OpenSSL versions, ranging from 0.9.8 to 1.0.2k (including one from a vendor SDK) with partial copies of 14 versions, ranging from 0.9.7d to 1.0.2k, those partial copies numbering 304. Fragments of 10 versions, ranging from 0.9.6 to 1.0.2k, were also found across the codebase, with these normally being small sets of files that had been copied to import some particular functionality."
In large companies there is never 'a' team of programmers, there are N teams of programmers with varying amounts of communications and cooperation going on between them, where "varying" often includes being completely unaware of the other teams existence.
N different teams working independently of each other each implement a variation of feature X to solve their own problem. The someone decides it's time to merge the whole thing together and it's easier to just use the N different implementations of X rather than to try to refactor and debug a single implementation of X that works for all N cases.
"Just get it out the door and we'll fix it later". I've heard that from most managers I've known.
Instead of this:
"We need to audit then refactor the existing codebase to bring it up release quality. It will delay release by 2 months, but we are dealing with customer PII so we have to be as stable as possible to prevent break-ins."
Or this:
"Don't deploy the prototype to production"
The "culture" behind this is endemic to industry and isn't anything unique to Huawei.
People have already commented on this not being a "team". Let me focus on "programmers".
What probably happened is that many of Huawei's programmers are EEs who happened to take a programming course or two in college.
But learning to think and behave like a good programmer is much more than that. It requires a certain mindset. It may require a certain amount of avocation and enthusiasm, beyond what is taught in an introductory programming course. It requires one to grok good software practices.
Most non-CS majors in college (USA or China or whatever country) probably don't get much of that cultural indoctrination during the few programming courses they take. The engineer wants to pass/ace the programming course. Learning the aesthetics or nuances isn't a priority.
Programming is just too easy. Type a few lines into a file, compile, debug syntax errors, tweak until you get something that looks right. There's no rigor involved. No style. No aesthetic.
Don Knuth called it "The Art of Computer Programming". I submit that many engineers don't think of programming as an art. It's just a means to an end.
E.g. here's an example from a large codebase that was extensively reviewed. The context was Toyota's unintended acceleration problem of about 15 years ago. The design review found things like: Other egregious deviations from standard practice were the number of global variables in the system. (A variable is a location in memory that has a number in it. A global variable is any piece of software anywhere in the system can get to that number and read it or write it.) The academic standard is zero. Toyota had more than 10,000 global variables.[1]
None of this will ever change until and unless a company's top level management understands the problem and mandates change.
Additionally, there's always an incredible push to bring new products to market. That's 1000x more important than it is to follow best software practices.
[1] http://www.safetyresearch.net/blog/articles/toyota-unintende...
Oh yes. Most of my classmates have picked EE over software engineering because they "dislike programming". The fact that EE (and any other engineering field really) is now mostly about programming anyway is lost on them.
People designing EE study programs are usually completely unaware that, well, computers exist. I have literally heard "Want to learn programming? Uh, just spend a weekend playing with Matlab or something and you will be set.".
There is also the fact that cryptographic libraries that are certified are often on a 2-3 month delay from the non-certified modules. You have to verify that the Host OS's kernel, the runtime that is providing the containing environment, and every single Docker image that is used to run an application, ensure that each application is running in an appropriate FIPS 140-2 mode inside the container, and also verify that every container is being appropriately kept up to date.
Using Docker does not eschew responsibilities you have to ensure that your OpenSSL and other materials is up to date, especially since Docker doesn't give you any protections when it comes to encryption over the wire or encryption with data at rest which is exactly where a cryptographic library with a vulnerability like in the original article leaves a vulnerability where there shouldn't be one.
Taking a random example from GitHub, installing the npm modules for Polymer/polymer yields duplicate dependencies of @types/node (4.9.1, 6.0.118, 9.6.41, 10.12.18, 10.12.21) dom5 (1.3.6, 1.1.0, 3.0.1) and many more modules...
I'm pretty sure you can find similar examples from most popular open source projects.
This will be the same in a great many places, including western companies. It is market forces in action, the race to the bottom, and a consequence of going for the option that "looks the part and it cheap" for too long which makes the supply-side players support being fast to market with the right buzzword features cheaper than the other lot and the bare minimum of care for other considerations.
The people making the buying decisions are at least vaguely aware of the problem, but work under the hope that they'll be long gone (or the kit will have been replaced by something else) before any excrement gets uncomfortably close to the air conditioning system.
At some point things come to a head and people look more deeply into the problem, hence:
> HCSEC threw a wobbly and told Huawei to sort itself out pronto
What has brought things to a head this time is the question "are we sure that can we trust Chinese companies?" combined with the question come out of the various public surveillance/recording news stories "can we trust any companies?!". People are being told to dig by the powers that be because said powers don't want to be the ones to make a cock-up while there is some public scrutiny going on.
> the Chinese company still came back with software containing "code that is vulnerable to 10 publicly disclosed OpenSSL vulnerabilities some dating back to 2006
That though is particularly damning. Having been pointed to the problem and told to sort it out, they seem to have done less than the bare minimum and hoped to get away with it. Just think how lazy they were being when not actively being told to be more careful, and how lazy they might go back to being if this all blows over before significant internal change is made.
Link to actual report: https://assets.publishing.service.gov.uk/government/uploads/...
F5 Networks should have been branded a black sheep for its various TLS implementation screw ups (they are the prime reason TLSv1 is considered insecure), yet they came out mostly unscathed. We need to stop giving a free pass to horrid development practices that create massively vulnerable software.
Yes, and it also highlights that we need independent review of any code going into critical public infrastructure, no matter where it comes from.
I'm failing to find more information (googling for ssl issues on ssl termination equipment doesn't work well,) though it sounds like it'd be a good read - if you have any more details to share, please...
That said, most of the code coming out of telco vendors is complete crap, it is just endemic in the industry.
This is why I laugh when I see the CNCF talking about getting OpenNFV / MANO code into containers - they can barely deal with moving to VMs currently.
Pick 2.
The memcpy shadowing is really, really, really bad. If I see something like that in production code I would never touch it. Removing it could break code from both, people who relied on a check and those who didn't.
The 4 versions of openssh? Happens if you are in business for a longer time in my experience. We don't know on how many devices the software is run on.
Sure, it could probably be cleaner, but so could nearly every form of production code I saw in the real world. I would surprise me to see a different situation elsewhere.
"There were over 1400 direct invocations of 22 different safe strcpy()-like functions and over 400 direct invocations of 9 different unsafe strcpy()-like functions. Approximately 22% of the direct invocations of strcpy()-like functions are to unsafe variants."
There's nothing provably wrong with using strcpy() instead of strncpy(). If you are are careful to ensure certain initial conditions, there is nothing wrong and on a device with limited resources, it may be important to reduce unnecessary runtime safety checks and instead pay for error avoidance at compile-time.
And you trust people to do this? Even competent programmers need safeguards.
There's no such thing as 'trust people'. If you write the code yourself you decide whether your own code is safe enough. If you are a manager, you look for unit tests, static analysis or do a detailed code review.
Get your own army of coders to create your own 5G electronics.
Nobody is forcing the Brits to buy Huawei Gear - they did it because it was cheaper and they wanted to save a buck.
Huawei will be profitable even if UK,USA,AUS,EU completely stops buying their gear.
The scary part is not that their code is bad, but that they code at all.
30 years ago those hands were picking rice in rural china, and 30 years from now who know what those hands will be doing, maybe writing code for their moonbase.
Chinese gears is a boon to African, Latin American, South Asian countries. Chinese Yaun puts less pressure on their FX reserves.