exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

corsaire-chainkey.txt

corsaire-chainkey.txt
Posted Jan 14, 2007
Authored by Stephen de Vries | Site corsaire.com

Corsaire Security Advisory - The aim of this document is to clearly define an issue that exists with the ChainKey Java Code Protection product, that will allow an attacker to circumvent the encryption protection and de-compile any protected Java application.

tags | advisory, java
advisories | CVE-2007-0014
SHA-256 | 507876689ae809c61bbd55e5605025bf397f044485c22295d1991e697e006a78

corsaire-chainkey.txt

Change Mirror Download
 
-- Corsaire Security Advisory --

Title: ChainKey Java Code Protection Bypass issue
Date: 06.11.06
Application: Java Code Protection
Environment: Java Virtual Machine
Author: Stephen de Vries [stephen.de.vries@corsaire.com]
Audience: General distribution
Reference: c061106-001


-- Scope --

The aim of this document is to clearly define an issue that exists with
the ChainKey Java Code Protection product [1], that will allow an
attacker to circumvent the encryption protection and de-compile any
protected Java application.


-- History --

Discovered: 6.11.06 (Stephen de Vries)
Vendor notified: 08.11.06 (responded 25.12.06)
Document released: 12.01.07


-- Overview --

The ChainKey Java Code Protection product is described as "...a tool to
protect your program codes written in Java, through multi-layer bytecode
encryption, obfuscation and tamper proofing. The Protector can also be
useful for enhancing your server-side security or for protecting
important business logic from leaking." [1]. The tool functions by
encrypting Java class files in order to prevent attackers from de-
compiling the Java class files, and thus exposing the source code.


-- Analysis --

The concept of encrypting Java class files to prevent de-compilition is
fundamentally flawed because the Java Virtual Machine (JVM) cannot read
encrypted class files. It can only read files which comply with the
well defined Java class file format [2]. Therefore, the encrypted class
files have to be delivered to the JVM in the standard, unencrypted
format. An attacker who wishes to de-compile the class file can simply
modify the Java class loader to extract the unencrypted class files
[4][5]. These class files can then be decompiled using well known and
freely available decompilation tools such as Jode [3].


-- Proof of Concept --

The following code[4] was inserted in the defineClass(String name,
byte[] b, int off, int len, ProtectionDomain protectionDomain) method of
the java/lang/ClassLoader.java file which is included in the JDK source
code:

if (!name.startsWith("java")) {
String baseDir = "/Users/stephen/dump";
String dirName = baseDir + File.separatorChar +
name.substring(0,name.lastIndexOf(".")).replace('.',
File.separatorChar);
File dir = new File(dirName);
dir.mkdirs();
File dump = new File(baseDir + File.separatorChar +
name.replace('.', File.separatorChar) + ".class");
FileOutputStream out = null;
try {
out = new FileOutputStream (dump);
out.write (b, off, len);
}
catch (Exception e){
e.printStackTrace ();
}
finally {
if (out != null) {
try {
out.close ();
}
catch (Exception e) {
}
}
}
}

This had the effect of writing the class file to a directory. The
modified ClassLoader.class file was included in the JVM runtime.
The "Game of life" encrypted sample application was then loaded using
the new modified JVM. The raw class files were observed in the
directory /Users/stephen/dump and these were loaded using Jode [3].
Jode was successful in decompiling many of the important class files to
the extent that functional process flow and constant values were
exposed. Some local variable names remained in obfuscated form, but
these did not detract from the overall ability to view the source code.
As an example, the following code is the original source code of the
GameOfLifeCanvas constructor as provided with the sample application:

public GameOfLifeCanvas(GameOfLifeGrid gameOfLifeGrid, int cellSize) {
this.gameOfLifeGrid = gameOfLifeGrid;
this.cellSize = cellSize;
gameOfLifeGrid.clear();

addMouseListener(
new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
draw(e.getX(), e.getY());
}
public void mousePressed(MouseEvent e) {
saveCellUnderMouse(e.getX(), e.getY());
}
});

addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
draw(e.getX(), e.getY());
}
});
}

The same method as decompiled by Jode:

public GameOfLifeCanvas(GameOfLifeGrid gameoflifegrid, int i) {
gameOfLifeGrid = gameoflifegrid;
cellSize = i;
gameoflifegrid.clear();
this.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent mouseevent) {
draw(mouseevent.getX(), mouseevent.getY());
}

public void mousePressed(MouseEvent mouseevent) {
saveCellUnderMouse(mouseevent.getX(), mouseevent.getY());
}
});
this.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent mouseevent) {
draw(mouseevent.getX(), mouseevent.getY());
}
});
}


-- Recommendations --

Simple class file encryption using a pure Java solution is a
fundamentally flawed approach to protecting the intellectual property of
software creators, and as this advisory shows it cannot be relied on to
provide any protection from reverse engineering methods. As a permanent
solution to this issue consider re-architecting Java applications who's
bytecode contains sensitive intellectual property so that the sensitive
areas are executed in secured environments (such as on a server).
Alternatively, consider strengthening the obfuscation mechanisms to
delay decompilation of class files. However, it should be noted that
obfuscation will not provide a permanent solution to the problem, but
will only delay a persistent attacker in obtaining the source code.


-- CVE --

The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CVE-2007-0014 to this issue. This is a candidate for inclusion in
the CVE list (http://cve.mitre.org), which standardises names for
security problems.


-- References --

[1] http://www.chainkey.com/en/jcp/
[2] http://java.sun.com/docs/books/vmspec/2nd-
edition/html/ClassFile.doc.html
[3] http://jode.sourceforge.net
[4] Sergey Edunov's post: http://lists.owasp.org/pipermail/java-
project/2006-October/000096.html
[5] http://www.javaworld.com/javaworld/javaqa/2003-05/01-qa-0509-
jcrypt.html


-- Revision --

a. Initial release.
b. Released.


-- Distribution --

This security advisory may be freely distributed, provided that it
remains unaltered and in its original form.


-- Disclaimer --

The information contained within this advisory is supplied "as-is" with
no warranties or guarantees of fitness of use or otherwise. Corsaire
accepts no responsibility for any damage caused by the use or misuse of
this information.


-- About Corsaire --

Corsaire are a leading information security consultancy, founded in 1997
in Guildford, Surrey, UK. Corsaire bring innovation, integrity and
analytical rigour to every job, which means fast and dramatic security
performance improvements. Our services centre on the delivery of
information security planning, assessment, implementation, management
and vulnerability research.

A free guide to selecting a security assessment supplier is available at
http://www.penetration-testing.com


Copyright 2006-2007 Corsaire Limited. All rights reserved.




----------------------------------------------------------------------
CONFIDENTIALITY: This e-mail and any files transmitted with it are
confidential and intended solely for the use of the recipient(s) only.
Any review, retransmission, dissemination or other use of, or taking
any action in reliance upon this information by persons or entities
other than the intended recipient(s) is prohibited. If you have
received this e-mail in error please notify the sender immediately
and destroy the material whether stored on a computer or otherwise.
----------------------------------------------------------------------
DISCLAIMER: Any views or opinions presented within this e-mail are
solely those of the author and do not necessarily represent those
of Corsaire Limited, unless otherwise specifically stated.
----------------------------------------------------------------------
Corsaire Limited, registered in England No. 3338312. Registered
office: 3 Tannery House, Tannery Lane, Send, Surrey, GU23 7EF.
Telephone: +44 (0)1483-226000


Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close