News for hackers. Stuff that matters.
Re:The most dangerous code in the world by kyberias on Thursday October 25, 2012 @12:14AM (#4696342)
While you're attacking curl you (intentionally?) forget to mention that the default value is 2 that is perfectly safe. I don't think it's "reasonable to assume" that the parameter is a boolean value while it's well documented. If programmers are lazy, they make many kind of mistakes.
Re:The most dangerous code in the world by tptacek on Thursday October 25, 2012 @12:18AM (#4696354)
Yes, yes, I know, stupid Paypal, stupid Amazon, we get it. VERIFYHOST=1 doing nothing makes perfect sense, you just have to read the documentation. Of course.
Re:The most dangerous code in the world by kyberias on Thursday October 25, 2012 @12:28AM (#4696377)
Yes, Amazon et.al. made some mistakes due being lazy and PHP being the nice language that it is. They have fixed it. Let's go ahead and find another non-default, documented parameter value in a library and call it a vulnerability.
Re:The most dangerous code in the world by tptacek on Thursday October 25, 2012 @12:35AM (#4696390)
Ok. Your turn. Go!
Re:The most dangerous code in the world by jacques_chester on Friday October 26, 2012 @12:28AM (#4700875)
Policy vs Mechanism.
Re:The most dangerous code in the world by subsystem on Thursday October 25, 2012 @05:28AM (#4696908)
I think it's highly questionable that a default value of 2 is appropriate for something that is critical functionality. DISABLE_HOST_VERIFICATION would have been much better, similar to the example code.

http://curl.haxx.se/libcurl/c/https.html

Re:The most dangerous code in the world by rjh29 on Thursday October 25, 2012 @07:42AM (#4697207)
It's bad API design. Yeah, I get it, you read your docs properly and would never make that mistake. But most programmers are not as gifted and good API design is about mitigating inevitable human error.
Re:The most dangerous code in the world by ianstallings on Thursday October 25, 2012 @09:41AM (#4697584)
Most programmers are not gifted enough to read the docs? Well there's the problem.

Also "The most dangerous code in the world" is a bit misleading. I would say the code that runs a Predator drone is a little higher in the danger department.

Re:The most dangerous code in the world by gmac on Thursday October 25, 2012 @09:49AM (#4697631)
Well, maybe it's 6 of one and half a dozen of the other.

But it's certainly thoughtless API design. The parameter sounds boolean (am I going to verify the SSL host or not?), and essentially it is, except that not verifying it for some reason takes two forms, and a true value turns out to specify one of them.

Whereas I doubt that the giftedness of the programmer has much to do with their reading the docs. A gifted programmer might assume that the API designer would do the same thing they would, which is to specify this with a boolean argument.

Re:The most dangerous code in the world by eru on Thursday October 25, 2012 @12:28PM (#4698196)
Or rename the parameter to CURL_SSL_VERIFICATION_LEVEL.
Re:The most dangerous code in the world by tptacek on Friday October 26, 2012 @12:25PM (#4702920)
No! Because CURL_SSL_VERIFICATION_LEVEL 0 is the same as CURL_SSL_VERIFICATION_LEVEL 1: meaningless.

The problem isn't simply that VERIFY_HOST is documented as a scale from 0-2 that people are mistaking for a boolean by not reading the docs. The problem is that the scale is pointless, because the value it is expressing actually is a boolean: you are either verifying SSL certificates properly or you might as well not verify them at all. There is no real scale to express. The whole option actually documents a misunderstanding of SSL/TLS on the part of curl's author.

Re:The most dangerous code in the world by alex_c on Thursday October 25, 2012 @11:45AM (#4698026)
>Most programmers are not gifted enough to read the docs? Well there's the problem.

Which one's easier - fixing an API, or fixing most programmers?

Re:The most dangerous code in the world by stinky613 on Thursday October 25, 2012 @10:24AM (#4697747)
I don't know if it's fair to blame laziness. Acting in haste, maybe? A ternary implementation for something that intuitively seems like a binary choice is a little... well.. unintuitive. That said, when building an application of significant scale, yeah, you should probably read the documentation of anything you aren't familiar with.
Re:The most dangerous code in the world by justinhj on Thursday October 25, 2012 @12:48PM (#4698304)
Reading the documentation is important, but tests are even more so. A simple test running with a bad certificate would have caught a lot of these issues. Small devs often push out software without having much time to read docs or make tests, but these are big players with lots of resources, and real money at stake.