News: 1587636372

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

GCC 10 gets security bug trap. And look what just fell into it: OpenSSL and a prod-of-death flaw in servers and apps

(2020/04/23)


A static analysis feature set to appear in GCC 10, which will catch common programming errors that can lead to security vulnerabilities, has scored an early win – it snared an exploitable flaw in OpenSSL.

Bernd Edlinger discovered [1]CVE-2020-1967 , a denial-of-service flaw deemed to be a high severity risk by the OpenSSL team. It is possible to crash a server or application that uses a vulnerable build of OpenSSL by sending specially crafted messages while setting up a TLS 1.3 connection.

This means it's possible to disrupt or knock offline HTTPS websites that use a vulnerable version of the crypto library, by sending a prod-of-death. It can also be used by rogue servers to crash web browsers and other apps connecting in.

OpenSSL is a software library widely used to provide encrypted connections across networks and the internet. Here's the technical description from the OpenSSL maintainers of the flaw:

Server or client applications that call the SSL_check_chain() function during or after a TLS 1.3 handshake may crash due to a NULL pointer dereference as a result of incorrect handling of the "signature_algorithms_cert" TLS extension. The crash occurs if an invalid or unrecognised signature algorithm is received from the peer. This could be exploited by a malicious peer in a Denial of Service attack.

NULL pointer dereference means the library tried to access something at memory location zero, and doing so on modern operating systems triggers a crash because no sane software should do that. There's nothing there at that location, anyway. A pointer value of zero usually indicates the pointer is invalid and shouldn't be accessed, so trying to use it, and thus accessing memory location zero, indicates the code has gone awry and should be terminated. Something inside OpenSSL tries to use a zero-value pointer when given unexpected data when establishing a TLS 1.3 connection, and crashes.

The programming blunder is fixed in the OpenSSL 1.1.1.g release: versions 1.1.1d, 1.1.1e, and 1.1.1f are affected. Users with buggy versions installed are advised to upgrade as soon as possible. Developers shipping the library should update their packages and push them to users to install. Matt Caswell and Benjamin Kaduk are credited for performing further analysis of the bug prior to its disclosure this week.

While the flaw is an irritation – it's not remote-code execution but it can potentially hose servers and apps – programmers may be more interested in how it was uncovered. Edlinger credits the discovery of the bug to GCC 10's brand new [2]static analysis feature . Edlinger ran that tool over the OpenSSL source, and the flaw was revealed in diagnostic output.

GCC is the GNU Compiler Collection, a free software suite of tools that compile source code written in C, C++, and other languages, into applications and other executables.

The static analysis feature was introduced as a way to check C code for common exploitable programming gaffes during build time, before any binaries are shipped to users. It can catch things like double free() calls, use-after- free() calls, memory leaks, and so on. C++ support is said to be in the works.

Last month, Red Hat toolchain developer David Malcolm, who worked on the feature, said the aim was to help developers iron out potentially exploitable vulnerabilities in their code prior to release.

"My thinking here is that it’s best to catch problems as early as possible as the code is written, using the compiler the code is written in as part of the compile-edit-debug cycle, rather than having static analysis as an extra tool 'on the side' (perhaps proprietary)," he [3]explained in a technical memo that details the analyzer's features.

"Hence, it seems worthwhile to have a static analyzer built into the compiler that can see exactly the same code as the compiler sees — because it is the compiler."

That the analyzer tool, accessed through the -fanalyzer command-line option, has already been shown to be capable of catching serious errors in deployed code will be a nice vote of confidence in the feature.

"My hope is that the analyzer provides a decent amount of extra checking while not being too expensive," Malcolm said earlier. "I’ve aimed for -fanalyzer to 'merely' double the compile time as a reasonable trade-off for the extra checks."

For what it's worth, other toolchains, [4]such as Clang-LLVM , feature static analysis, though it's good to see it built into GCC, which is used to compile a huge number of things, not least the Linux kernel. That means hopefully a good number of security bugs out there will be discovered and squashed as more programmers migrate to GCC 10 and take the analyzer out for a spin (preferably ahead of miscreants using the feature to develop exploit code for nefarious purposes.)

The analyzer is available from the master branch of the GCC 10 [5]source code . It's hoped the feature will be finalized in time for version 10's official release, due this month or next. The current latest version is 9.3. ®

Sponsored: [6]Legacy Modernization: Finding Your Way With Low-Code



[1] https://www.openssl.org/news/secadv/20200421.txt

[2] https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer

[3] https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/

[4] https://clang.llvm.org/docs/ClangStaticAnalyzer.html

[5] https://gcc.gnu.org/

[6] https://go.theregister.co.uk/tl/1936/-8553/legacy-modernization-finding-your-way-with-low-code?td=wptl1936

llvm already had it - thought so

bombastic bob

I remember seeing something uncovered in a kernel module by a new feature in llvm nearly a year ago. I forget exactly what it was, [it was an nvidia driver module compiled for FreeBSD] but it spat out some warnings I hadn't seen before. The updated version didn't have those warnings, though. But the older compiler didn't show those warnings, so I guess it was added last year some time.

Yeah, It's all good. I should add this flag to my own stuff, check for it in the configure script

El Reg (or the readership) really has changed

Steve Crook

> GCC is the GNU Compiler Collection, a free software suite of tools that compile source code written in C, C++, and other languages, into applications and other executables.

When did article authors start to think the readership wouldn't know this?

Re: El Reg (or the readership) really has changed

Graham Cunningham

I have no problem with acronyms being explained, even if I already know them. Unexplained acronyms needlessly put up barriers to visiting readers who may be new to the subject matter.

Re: El Reg (or the readership) really has changed

diodesign

As our readership expands - and it has done lately - we have developers (and non-developers) following us with a wide range of ability. Some know C/C++. Some know JavaScript and Python. Some have never touched GCC and are pure Windows developers.

I edited that sentence in to throw a bone to those thinking, 'wtf is GCC 10'. Sometimes people need their memory jogged. Articles that are focused on specific tools, like Docker or Powershell, don't need reminders like this. Articles that have a potential wide appeal may have a line or two explaining the toolchains involved.

If I don't put these in, I get accused of alienating potential new readers. If I do put them in, I get accused of dumbing down the site.

We don't think you're dumb. But I don't want to assume everyone knows what GCC is.

C.

Re: El Reg (or the readership) really has changed

Mike Shepherd

Oh, let's have more, not fewer, explanations. No real expert will be insulted by seeing his familiar jargon explained to others. It will annoy only those who fear that their mystique will be punctured. I've used GCC, but am not an expert in it, because most of my work is elsewhere. Do I feel embarrassed by this? I do not. I worked in what's now called IT when most GCC users were still soiling their pants, so their attempts to impress me with an array of acronyms will likely fall flat.

IT is now a vast field. Those who believe their recondite portion is the whole need to get out more.

Re: El Reg (or the readership) really has changed

Warm Braw

For new visitors, El Reg is a familiar, shorthand name used to refer to the online publication "The Register" which covers issues relating to Information Technology, regional foodstuffs and bodily functions.

Re: El Reg (or the readership) really has changed

N2

Otherwise known as El Regizeera

Re: El Reg (or the readership) really has changed

The Man Who Fell To Earth

Anyone who knows how to write a technical document correctly knows you either expand every acronym the first time it is used, or you have an acronym table in the document. Anything less is incompetent technical writing. The goal in any type of professional writing is to be as unambiguous as possible so the document can be read & understood years later without the reader needing to know what fad long past you were were talking about. This is true for papers (I bounce a lot for this first round when I referee journal articles), technical documents (we send back before signoff a lot of new hires writing because they never learned to write properly in college), and news articles (if they have competent copy editors).

Your comment makes me wonder if you know how to write properly commented code...

karlkarl

Some more info about the static analyser here: https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10

Impressive how it is already being used in large (overly) complex software like OpenSSL.

Linux, because we don't need no steenkin' Blue Screen of Death!