Skip to content

Commit 9cc4ea2

Browse files
committed
Fixed an XSS exploit in darkfish.js. This could lead to cookie disclosure to third parties. See CVE-2012-0256.rdoc for full details including a patch you can apply to generated RDoc documentation.
1 parent 51c7cb6 commit 9cc4ea2

File tree

6 files changed

+68
-9
lines changed

6 files changed

+68
-9
lines changed

CVE-2013-0256.rdoc

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
= RDoc 2.3.0 through 3.12 XSS Exploit
2+
3+
RDoc documentation generated by rdoc 2.3.0 through rdoc 3.12 and prereleases up
4+
to rdoc 4.0.0.preview2.1 are vulnerable to an XSS exploit. This exploit may
5+
lead to cookie disclosure to third parties.
6+
7+
The exploit exists in darkfish.js which is copied from the RDoc install
8+
location to the generated documentation.
9+
10+
RDoc is a static documentation generation tool. Patching the library itself
11+
is insufficient to correct this exploit. Those hosting rdoc documentation will
12+
need to apply the following patch. If applied while ignoring whitespace, this
13+
patch will correct all affected versions:
14+
15+
diff --git darkfish.js darkfish.js
16+
index 4be722f..f26fd45 100644
17+
--- darkfish.js
18+
+++ darkfish.js
19+
@@ -109,13 +109,15 @@ function hookSearch() {
20+
function highlightTarget( anchor ) {
21+
console.debug( "Highlighting target '%s'.", anchor );
22+
23+
- $("a[name=" + anchor + "]").each( function() {
24+
- if ( !$(this).parent().parent().hasClass('target-section') ) {
25+
- console.debug( "Wrapping the target-section" );
26+
- $('div.method-detail').unwrap( 'div.target-section' );
27+
- $(this).parent().wrap( '<div class="target-section"></div>' );
28+
- } else {
29+
- console.debug( "Already wrapped." );
30+
+ $("a[name]").each( function() {
31+
+ if ( $(this).attr("name") == anchor ) {
32+
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
33+
+ console.debug( "Wrapping the target-section" );
34+
+ $('div.method-detail').unwrap( 'div.target-section' );
35+
+ $(this).parent().wrap( '<div class="target-section"></div>' );
36+
+ } else {
37+
+ console.debug( "Already wrapped." );
38+
+ }
39+
}
40+
});
41+
};
42+
43+
RDoc 3.9.5, 3.12.1 and RDoc 4.0.0.rc.2 and newer are not vulnerable to this
44+
exploit.
45+
46+
This exploit was discovered by Evgeny Ermakov <corwmh@gmail.com>.
47+
48+
This vulnerability has been assigned the CVE identifier CVE-2013-0256.
49+

History.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
=== 3.9.5 / 2013-02-05
2+
3+
* Bug fixes
4+
* Fixed an XSS exploit in darkfish.js. This could lead to cookie disclosure
5+
to third parties. See CVE-2012-0256.rdoc for full details including a
6+
patch you can apply to generated RDoc documentation.
7+
18
=== 3.9.4 / 2011-08-26
29

310
* Bug fixes

Manifest.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.autotest
22
.document
3+
CVE-2013-0256.rdoc
34
History.txt
45
LICENSE.txt
56
Manifest.txt

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
4141
extra_dev_deps << ['isolate', '~> 3']
4242
extra_dev_deps << ['ZenTest', '~> 4'] # for autotest/isolate
4343

44-
extra_rdoc_files << 'Rakefile'
44+
extra_rdoc_files << 'Rakefile' << 'CVE-2013-0256.rdoc'
4545
spec_extras['required_rubygems_version'] = '>= 1.3'
4646
spec_extras['homepage'] = 'http://docs.seattlerb.org/rdoc'
4747
end

lib/rdoc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def self.const_missing const_name # :nodoc:
104104
##
105105
# RDoc version you are using
106106

107-
VERSION = '3.9.4'
107+
VERSION = '3.9.5'
108108

109109
##
110110
# Method visibilities

lib/rdoc/generator/template/darkfish/js/darkfish.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ function hookQuickSearch() {
7373
function highlightTarget( anchor ) {
7474
console.debug( "Highlighting target '%s'.", anchor );
7575

76-
$("a[name=" + anchor + "]").each( function() {
77-
if ( !$(this).parent().parent().hasClass('target-section') ) {
78-
console.debug( "Wrapping the target-section" );
79-
$('div.method-detail').unwrap( 'div.target-section' );
80-
$(this).parent().wrap( '<div class="target-section"></div>' );
81-
} else {
82-
console.debug( "Already wrapped." );
76+
$("a[name]").each( function() {
77+
if ( $(this).attr("name") == anchor ) {
78+
if ( !$(this).parent().parent().hasClass('target-section') ) {
79+
console.debug( "Wrapping the target-section" );
80+
$('div.method-detail').unwrap( 'div.target-section' );
81+
$(this).parent().wrap( '<div class="target-section"></div>' );
82+
} else {
83+
console.debug( "Already wrapped." );
84+
}
8385
}
8486
});
8587
};

0 commit comments

Comments
 (0)