r/programming • • Apr 09 '14

Theo de Raadt: "OpenSSL has exploit mitigation countermeasures to make sure it's exploitable"

[deleted] — view deleted post

2.0k Upvotes

661 comments sorted by

View all comments

-2

u/drguildo Apr 09 '14

Remember when that Debian developer "fixed" that OpenSSL Valgrind warning. Yeah. Some people shouldn't be allowed near a C compiler. Actually, can we just stop using C now, please?

10

u/partyboy690 Apr 09 '14

C is an extremely versatile and powerful language, the reason they used it over say Java was for performance reasons, as much as people would like C to go away it is here to stay. Also if you read the content in the link you'll realise that this wasn't caused by a design feature in the C language because if the OpenSSL team hadn't rolled their own custom memory allocation function then the operating system would have taken care of this and the bug would have been found ages ago. The problem is that when the OpenSSL's version of free is called it doesn't zero the memory AND it allows you do to a memcpy over your buffer. The regular C library would mitigate both those issues.

-9

u/drguildo Apr 09 '14

C is an extremely versatile and powerful language

No, it isn't. C is an extremely basic (it's referred to as high-level assembler for a reason) and potentially dangerous language and the vast majority of programming problems it's used for would be much better served by a language that is performant enough to tackle them but without the security problems.

Also if you read the content in the link you'll realise that this wasn't caused by a design feature in the C language

It kind of was, and anyway I was referring to both that and the original bug (and all the other myriad bugs caused by "features" of the C language)

The (1) TLS and (2) DTLS implementations in OpenSSL 1.0.1 before 1.0.1g do not properly handle Heartbeat Extension packets, which allows remote attackers to obtain sensitive information from process memory via crafted packets that trigger a buffer over-read

Being able to read past the end of an array is a design "feature" of the C language.

The regular C library would mitigate both those issues.

The problems (the original bug and the malloc fuck-up) shouldn't need to be mitigated.

11

u/partyboy690 Apr 09 '14

Yes C is very basic but to say it's not powerful is absolutely ludicrous, reddit is hosted on web servers that are running an operating system written in C, more than likely the web server is heavily C based(if it's Apache or Nginx) and the computer you're using to read this thread is running an operating system written in C also more than likely your browser if it's Gecko or Webkit based is heavily C and C++ oriented. There's a difference between power and being basic. You have to write twenty lines of code in C what you could do in one on Python but Python wouldn't exist only for its runtime written in C.

Also it is very versatile specifically because it's as you say high level assembler, embedded systems are all heavily C based and lots of these things make your life easier. Don't get me wrong, C is a very unsafe language I know, I've fixed a myriad of bugs myself that wouldn't exist in Java, Python etc.... but basic programming practices and well tested code and you should be fine. If the OpenSSL guys didn't use their own allocation routine then there wouldn't be this mess, leave that to the maintainers of standard libraries, they're incredibly well vetted and used every single second by thousands and thousands of programs worldwide, those guys wouldn't write their own encryption library so the OpenSSL team shouldn't "enhance" the standard C library. This is a fault of the OpenSSL team and not the C language.

I'm not criticising your opinion btw, C can cause dangerous bugs but we can't all get on the C and C++ hate train when this bug is easily mitigated, there are operating system checks that can easily mitigate such a scenario.

0

u/6nf Apr 10 '14

It's become obvious that C and any other language with pointer arithmetic is not suitable for writing security sensitive code. The sheer number of buffer overflow exploits discovered every year makes this clear. Yes you can write insecure code in any language but using a different language will eliminate a whole class of common and often very serious bugs. Like this one.

7

u/[deleted] Apr 09 '14

We can stop using C once there's an alternative that fits in all the tight spaces it can.

That single criterion instantly rules out 99% or more of "nice" languages.

6

u/Zarutian Apr 09 '14

FORTH LOVE IF HONK THEN

;-)

1

u/[deleted] Apr 09 '14

I don't really like to write C, but objectively C will always be the king.