Since I can't find any contact info and there is no mention of this on the front-page or elsewhere: are the developers and users of Zenphoto aware of the vulnerabilities which can be exploited by malicious people to conduct SQL injection attacks.
It's on the secunia site, so in public. Everybody better fix their code!
Comments
But anyway, for your interesst:
The rss feed sql injection issue has been already reported and is solved in the nightly build and will be in 1.1.4 which is on it's way.
The second report I found on the secunia site is stated for zenphoto 1.0.4 to 1.0.6 and to be solved in 1.0.7.
These versions are clearly outdated.
@sbillard: the vulnerability still exists in the 1.1.3 release I downloaded today.
For the HTTP_HOST story, see also http://shiflett.org/blog/2006/mar/server-name-versus-http-host
Thanks for the tip on HTTP_HOST.
At line 8 and 9 $_GET variables are included. Just 10 lines lower one of them is echo'd out without any escaping or validation.
Another 20 lines down one of them is used directly in a query. Again without any validation or escaping.
These are so obvious and easy to spot. Why have they been overlooked? And what about the possible harder to spot vulnerabilities?
I think it would be a lot better to rewrite the code in such a way that there are a few distinct groups of variables. One is raw input (GET, POST, SERVER, etc). The second is a $clean array, only containing validated content. So
`$clean = array();
$clean['somenumericid'] = (int)$_GET['someid'];
`
for a variable which must be an integer
etc etc
Then the third and fourth are used in output to HTML and output to mysql:
`
$html = array();
$sql = array();
$html['somevar'] = htmlentities($clean['somevar'], ENT_QUOTES, 'UTF-8');
$sql['var'] = mysql_real_escape_string($clean['var']);
`
Everybody familiar with Chris Shifflet's work will recognize the ideas.
If there's any help needed, I would be willing to help. I use zenphoto and it's a great piece of software and I'm thankful to the developers who have put a lot of work in it.
If you look at the new rss code in the nightly, we use already existing functions called sanitize and sanitize_numeric to validate the input now. You find them in zp-core/functions.php if you want to take a look at their code.
So if you have the indepth knowledge, the time to help you are welcome. Create an account on the trac, then you can create tickets and attach fixes if you find anything more.
Indeed, I saw that the new rss is updated. However, there is still some un-escaped output ($albumname and $_SERVER["HTTP_HOST"]). Even though $albumname has been "validated" (I haven't looked at the sanitize function yet, so don't know what that does), it still needs escaping. And for the $_SERVER["HTTP_HOST"]: on line 60 further down there is a escaped variable created, $host. If that one is placed earlier in the code and then used in place of the echo'd $_SERVER["HTTP_HOST"] in line 30 that is solved as well.
I will create an account on the trac and maybe I'll be able to help.
There is a new secunia advisory ( 2012-02-09) about vulnerabilty in ZenPhoto. What about ??
The 1.4.2.1 is not a security update.
Edit : Sorry I had better to read first before speaking.