1 OpenCA Security Advisory: Cross Site Scripting vulnerability
4 Martin Bartosch <mb-bugtraq@cynops.de>
5 Michael Bell <michael.bell@cms.hu-berlin.de>
7 2004-09-01 Initial revision
8 2004-09-06 Public release
9 2004-09-07 OpenCA 0.9.1-10 released (initial bugfix release contained a bug)
10 2004-09-23 Fixed advisory released
15 The OpenCA Project is a collaborative effort to develop a robust,
16 full-featured and Open Source out-of-the-box Certification Authority
17 implementing the most used protocols with full-strength cryptography
18 world-wide. OpenCA is based on many Open-Source Projects. Among the
19 supported software is OpenLDAP, OpenSSL, Apache Project, Apache mod_ssl.
21 A Cross Site Scripting (XSS) vulnerability was found in the OpenCA PKI
22 software, allowing users of the system to inject malicious HTML
23 code into the system. The malicious code may even affect offline
30 All versions of OpenCA, including 0.9.1-8 and 0.9.2 RC6.
36 Form input to the web frontends is not properly validated, making it
37 possible to inject malicious HTML code into the system. Once the
38 offending code has been inserted into the system, it may affect
39 PKI staff or other users accessing the data.
41 OpenCA advocates the separation between individual frontends and the
42 use of an offline CA and RA. In this case data is exchanged using
43 a removable medium such as a floppy disk. The offending code embedded
44 in the user data may thus be transferred even to systems not connected
45 to a network and might be used to attack offline nodes.
51 Cross site scripting attacks primarily affect the client system
52 running the browser used to display the web page. OpenCA itself is
53 not directly affected by such attacks. However, XSS exploit
54 code may be deployed e. g. in order to gain session credentials,
55 allowing for session takeover. More advanced attacks (requiring
56 specially crafted exploit code) could even be targeted at manipulating
57 data on the OpenCA node on the user's behalf.
63 All users of OpenCA should upgrade to a version that is not affected
66 OpenCA version 0.9.1 users are encouraged to upgrade to version 0.9.1-9.
67 Users of the current development branch 0.9.2 should upgrade to CVS
75 The Common Vulnerabilities and Exposures project (cve.mitre.org) has
76 assigned the name CAN-2004-0787 to this issue.
78 http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0787
80 URL for this Security Advisory:
81 http://www.openca.org/news/CAN-2004-0787.txt
90 ###########################################################################
91 ## Patches against version 0.9.2
92 ###########################################################################
94 Index: src/common/lib/functions/initServer
95 ===================================================================
96 RCS file: /cvsroot/openca/openca-0.9/src/common/lib/functions/initServer,v
97 retrieving revision 1.40
98 diff -u -r1.40 initServer
99 --- src/common/lib/functions/initServer 30 Aug 2004 12:31:53 -0000 1.40
100 +++ src/common/lib/functions/initServer 1 Sep 2004 13:27:27 -0000
102 $query->set_gettext (\&i18nGettext);
105 + ## validate input data
106 + ## 2004-08-27 Martin Bartosch <m.bartosch@cynops.de>
107 + validateCGIParameters(\$query);
109 ## reinit configuration
110 my $CONFIG = $AUTOCONF {"etc_prefix"}.'/servers/'.$AUTOCONF {"config_prefix"}.'.conf';
111 if( not defined (my $ret = $config->loadCfg( "$CONFIG" )) ) {
112 Index: src/common/lib/functions/misc-utils.lib
113 ===================================================================
114 RCS file: /cvsroot/openca/openca-0.9/src/common/lib/functions/misc-utils.lib,v
115 retrieving revision 1.50
116 diff -u -r1.50 misc-utils.lib
117 --- src/common/lib/functions/misc-utils.lib 26 Aug 2004 14:08:03 -0000 1.50
118 +++ src/common/lib/functions/misc-utils.lib 1 Sep 2004 13:27:27 -0000
123 +# 2004-08-31 Martin Bartosch <m.bartosch@cynops.de>
124 +# clean up CGI parameters
125 +# input: reference to CGI class instance
126 +# This function modifies the object itself
127 +sub validateCGIParameters {
128 + my $queryref = shift;
130 + ## validate input data
131 + ## 2004-08-27 Martin Bartosch <m.bartosch@cynops.de>
132 + foreach my $param (keys %{$$queryref->Vars}) {
133 + my @values = $$queryref->param($param);
135 + # replace < and > with < and &rt; for all CGI parameters passed
136 + # NOTE/FIXME: unescaping might be necessary when actually
137 + # passing this data to e. g. certificate generation routines
138 + # to prevent literal XML entities in certificate contents
143 + $$queryref->param(-name => $param, -value => [ @values ]);
145 + # extra sanity check just to be sure (redundant)
146 + foreach (@values) {
148 + print "Content-type: text/html\n\n";
149 + print "Security violation\n";
163 ###########################################################################
164 ## Patches against version 0.9.1-8
165 ###########################################################################
168 Index: src/common/lib/functions/misc-utils.lib
169 ===================================================================
170 RCS file: /cvsroot/openca/openca-0.9/src/common/lib/functions/misc-utils.lib,v
171 retrieving revision 1.16.2.2
172 diff -u -r1.16.2.2 misc-utils.lib
173 --- src/common/lib/functions/misc-utils.lib 16 Apr 2003 13:24:51 -0000 1.16.2.2
174 +++ src/common/lib/functions/misc-utils.lib 1 Sep 2004 11:49:14 -0000
179 +# 2004-08-31 Martin Bartosch <m.bartosch@cynops.de>
180 +# clean up CGI parameters
181 +# input: reference to CGI class instance
182 +# This function modifies the object itself
183 +sub validateCGIParameters {
184 + my $queryref = shift;
186 + ## validate input data
187 + ## 2004-08-27 Martin Bartosch <m.bartosch@cynops.de>
188 + foreach my $param (keys %{$$queryref->Vars}) {
189 + my @values = $$queryref->param($param);
191 + # replace < and > with < and &rt; for all CGI parameters passed
192 + # NOTE/FIXME: unescaping might be necessary when actually
193 + # passing this data to e. g. certificate generation routines
194 + # to prevent literal XML entities in certificate contents
199 + $$queryref->param(-name => $param, -value => [ @values ]);
201 + # extra sanity check just to be sure (redundant)
202 + foreach (@values) {
204 + print "Content-type: text/html\n\n";
205 + print "Security violation\n";
214 Index: src/web-interfaces/ca/ca.in
215 ===================================================================
216 RCS file: /cvsroot/openca/openca-0.9/src/web-interfaces/ca/ca.in,v
217 retrieving revision 1.8.2.1
218 diff -u -r1.8.2.1 ca.in
219 --- src/web-interfaces/ca/ca.in 10 Nov 2003 13:10:48 -0000 1.8.2.1
220 +++ src/web-interfaces/ca/ca.in 1 Sep 2004 11:49:16 -0000
222 ##// Now it's time to get the parameters passed over the web
223 $query = new OpenCA::TRIStateCGI;
225 +## validate input parameters
226 +validateCGIParameters(\$query);
228 ## Generate a new reference to Configuration ( instance )
229 $dbconfig = new OpenCA::Configuration;
230 $dbiconfig = new OpenCA::Configuration;
231 Index: src/web-interfaces/ldap/ldap.in
232 ===================================================================
233 RCS file: /cvsroot/openca/openca-0.9/src/web-interfaces/ldap/ldap.in,v
234 retrieving revision 1.7.2.1
235 diff -u -r1.7.2.1 ldap.in
236 --- src/web-interfaces/ldap/ldap.in 10 Nov 2003 13:10:48 -0000 1.7.2.1
237 +++ src/web-interfaces/ldap/ldap.in 1 Sep 2004 11:49:16 -0000
239 ##// Now it's time to get the parameters passed over the web
240 $query = new OpenCA::TRIStateCGI;
242 +## validate input parameters
243 +validateCGIParameters(\$query);
245 ## Generate a new reference to Configuration ( instance )
246 $dbconfig = new OpenCA::Configuration;
247 $dbiconfig = new OpenCA::Configuration;
248 Index: src/web-interfaces/node/node.in
249 ===================================================================
250 RCS file: /cvsroot/openca/openca-0.9/src/web-interfaces/node/node.in,v
251 retrieving revision 1.2.2.1
252 diff -u -r1.2.2.1 node.in
253 --- src/web-interfaces/node/node.in 10 Nov 2003 13:10:48 -0000 1.2.2.1
254 +++ src/web-interfaces/node/node.in 1 Sep 2004 11:49:17 -0000
256 ##// Now it's time to get the parameters passed over the web
257 $query = new OpenCA::TRIStateCGI;
259 +## validate input parameters
260 +validateCGIParameters(\$query);
262 ## Generate a new reference to Configuration ( instance )
263 $dbconfig = new OpenCA::Configuration;
264 $dbiconfig = new OpenCA::Configuration;
265 Index: src/web-interfaces/pub/pki.in
266 ===================================================================
267 RCS file: /cvsroot/openca/openca-0.9/src/web-interfaces/pub/pki.in,v
268 retrieving revision 1.7.2.1
269 diff -u -r1.7.2.1 pki.in
270 --- src/web-interfaces/pub/pki.in 10 Nov 2003 13:10:48 -0000 1.7.2.1
271 +++ src/web-interfaces/pub/pki.in 1 Sep 2004 11:49:17 -0000
273 ##// Now it's time to get the parameters passed over the web
274 $query = new OpenCA::TRIStateCGI;
276 +## validate input parameters
277 +validateCGIParameters(\$query);
279 ## Generate a new reference to Configuration ( instance )
280 $dbconfig = new OpenCA::Configuration;
281 $dbiconfig = new OpenCA::Configuration;
282 Index: src/web-interfaces/pub/scepd.in
283 ===================================================================
284 RCS file: /cvsroot/openca/openca-0.9/src/web-interfaces/pub/Attic/scepd.in,v
285 retrieving revision 1.2.2.1
286 diff -u -r1.2.2.1 scepd.in
287 --- src/web-interfaces/pub/scepd.in 10 Nov 2003 13:10:48 -0000 1.2.2.1
288 +++ src/web-interfaces/pub/scepd.in 1 Sep 2004 11:49:17 -0000
290 ##// Now it's time to get the parameters passed over the web
291 $query = new OpenCA::TRIStateCGI;
293 +## validate input parameters
294 +validateCGIParameters(\$query);
296 ## Generate a new reference to Configuration ( instance )
297 $dbconfig = new OpenCA::Configuration;
298 $dbiconfig = new OpenCA::Configuration;
299 Index: src/web-interfaces/ra/RAServer.in
300 ===================================================================
301 RCS file: /cvsroot/openca/openca-0.9/src/web-interfaces/ra/RAServer.in,v
302 retrieving revision 1.8.2.1
303 diff -u -r1.8.2.1 RAServer.in
304 --- src/web-interfaces/ra/RAServer.in 10 Nov 2003 13:10:49 -0000 1.8.2.1
305 +++ src/web-interfaces/ra/RAServer.in 1 Sep 2004 11:49:18 -0000
307 ##// Now it's time to get the parameters passed over the web
308 $query = new OpenCA::TRIStateCGI;
310 +## validate input parameters
311 +validateCGIParameters(\$query);
313 ## Generate a new reference to Configuration ( instance )
314 $dbconfig = new OpenCA::Configuration;
315 $dbiconfig = new OpenCA::Configuration;