A format string flaw was found in the Python CGI Kit (neo_cgi) module of ClearSilver, a language-neutral HTML templating system, processed certain input, leading to Common Gateway Interface (CGI) script errors. A remote attacker could provide a specially-crafted input, which once processed by an application, using the Python language API of ClearSilver neo_cgi module, could lead to that particular application crash, or, potentially arbitrary code execution with the privileges of the user running the application.
Patch, proposed by the issue reporter to the Debian Bug Tracking System:
This issue affects the versions of the clearsilver package, as shipped with Fedora EPEL 4, 5, and 6 releases. Please schedule an update.
This issue affects the versions of the clearsilver package, as shipped with Fedora release of 14, 15, and 16. Please schedule an update.
Created clearsilver tracking bugs for this issue
Affects: fedora-all [bug 757543]
Affects: epel-all [bug 757544]
Created attachment 537196 [details]
Local copy of patch, proposed in the Debian Bug Tracking System
Follow up from Colin Watson on this
(  http://www.openwall.com/lists/oss-security/2011/11/27/2 ):
On Sun, Nov 27, 2011 at 06:21:15PM +0100, Jan Lieskovsky wrote:
> a format string flaw was found in the Python CGI Kit (neo_cgi)
> module of ClearSilver, a language-neutral HTML templating system,
> processed certain input, leading to Common Gateway Interface (CGI)
> script errors. A remote attacker could provide a specially-crafted
> input, which once processed by an application, using the Python
> language API of ClearSilver neo_cgi module, could lead to that
> particular application crash, or, potentially arbitrary code
> execution with the privileges of the user running the application.
Thanks for responding to this. FWIW, I've attached a copy of the
original mail I sent to a couple of security@ addresses about this
-- Colin Watson [firstname.lastname@example.org]
Subject: clearsilver: possible format string vulnerability in Python extension
From: Colin Watson <email@example.com>
Date: 11/17/2011 06:12 PM
To: firstname.lastname@example.org, email@example.com
While doing the Perl 5.14 transition in Ubuntu, I noticed that
clearsilver has a -Wformat-security warning (Ubuntu builds with
-Werror=format-security by default to catch exactly this kind of
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -Wall -fPIC -Wall -I.. -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python2.7 -I.. -D_FORTIFY_SOURCE=2 -fPIC -I../ -I/usr/include/python2.7 -c neo_cgi.c -o build/temp.linux-i686-2.7/neo_cgi.o
neo_cgi.c: In function 'p_cgi_error':
neo_cgi.c:181:3: error: format not a string literal and no format arguments [-Werror=format-security]
The effects of this can be reproduced like this:
>>> import neo_cgi
>>> cgi = neo_cgi.CGI()
An error occured:<pre>|▒U▒LfU▒LfU▒@▒` ▒`▒y▒, x▒</pre></body></html>
In fact, the examples shipped with clearsilver include exception
handlers that call cgi.error(s), so if you can manage to get a % into
something that will end up in a Python traceback then you can read bits
of process memory over the Internet and possibly do a limited amount of
modification too (with %n).
I have not reported this upstream.
shows that it has not yet been fixed. Upstream appears to be
http://www.clearsilver.net/ / firstname.lastname@example.org; perhaps somebody could
coordinate with him if you confirm this as a possible vulnerability?
-- Colin Watson [email@example.com]
This was assigned CVE-2011-4357: