Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 27 Nov 2011 18:51:10 +0000
From: Colin Watson <>
Cc: "Steven M. Christey" <>,
	Leo Iannacone <>
Subject: Re: CVE Request -- ClearSilver (neo_cgi) -- Format string flaw by
 processing CGI error messages in Python module

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                                       []

Date: Thu, 17 Nov 2011 17:12:44 +0000
From: Colin Watson <>
Subject: clearsilver: possible format string vulnerability in Python extension
Message-ID: <>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
Content-Transfer-Encoding: quoted-printable

While doing the Perl 5.14 transition in Ubuntu, I noticed that
clearsilver has a -Wformat-security warning (Ubuntu builds with
-Werror=3Dformat-security by default to catch exactly this kind of

  gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototy=
pes -g -O2 -fstack-protector --param=3Dssp-buffer-size=3D4 -Wformat -Wfor=
mat-security -g -O2 -fstack-protector --param=3Dssp-buffer-size=3D4 -Wfor=
mat -Wformat-security -Werror=3Dformat-security -Wall -fPIC -Wall -I.. -D=
_FORTIFY_SOURCE=3D2 -fPIC -I/usr/include/python2.7 -I.. -D_FORTIFY_SOURCE=
=3D2 -fPIC -I../ -I/usr/include/python2.7 -c neo_cgi.c -o build/temp.linu=
  neo_cgi.c: In function 'p_cgi_error':
  neo_cgi.c:181:3: error: format not a string literal and no format argum=
ents [-Werror=3Dformat-security]

The effects of this can be reproduced like this:

  $ python
  >>> import neo_cgi
  >>> cgi =3D neo_cgi.CGI()
  >>> cgi.error('%s')
  Status: 500
  Content-Type: text/html
  An error occured:<pre>|=E2=96=92U=E2=96=92LfU=E2=96=92LfU=E2=96=92@...=96=
=92`   =E2=96=92`=E2=96=92y=E2=96=92, x=E2=96=92</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 /; perhaps somebody could
coordinate with him if you confirm this as a possible vulnerability?


Colin Watson                                       []

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.