The upload handling code in Gallery places uploaded files in a temporary directory. After 30 seconds, these files are deleted if they are not valid images. However, since the file exists for 30 seconds, a carefully crafted script could be initiated by the remote attacker during this 30 second timeout. Note that the temporary directory has to be located inside the webroot and an attacker needs to have upload rights either as an authenticated user or via "EVERYBODY".

Impact

An attacker could run arbitrary code as the user running PHP.

Workaround

There are several workarounds to this vulnerability:

Make sure that your temporary directory is not contained in the webroot; by default it is located outside the webroot.

Disable upload rights to all albums for "EVERYBODY"; upload is disabled by default.