New ceoAnyone Bug Identified in Multiple Crypto Game Smart Contracts (CVE-2018-11329)

PeckShield发现了一个新的智能合约漏洞“CEO Anyone”,该漏洞影响Crypto-Games中的CryptoIdleGame类别。攻击者可以利用此漏洞篡改或完全劫持游戏所有者的地址,从而非法获取交易费用。

Our vulnerability-scanning system at PeckShield has so far discovered several dangerous smart contract vulnerabilities ( batchOverflow[1], proxyOverflow[2], transferFlaw[3], ownerAnyone[4], multiOverflow[5], burnOverflow[6]). These vulnerabilities typically affect various tokens that may be publicly traded in exchanges. Today, we would like to report a new vulnerability named ceoAnyone, which affects, instead of tradable tokens in exchanges, but Crypto-Games.

Starting from the end of 2017, blockchain-based crypto-games have become popular especially with the initial success of CryptoKitties. Among crypto-games, cypto idle game is an interesting category that enables players to make money by idling for hours, then followed by a profit-making transaction (e.g., selling a Lab Rat on Ether Goo). Many of the cypto idle game owners make profit from the transaction fee. However, what if the owner address could be manipulated or completely hijacked by attackers?


                        Figure 1: A ceoAnyone-affected Crypto Idle Game Smart Contract

Figure 1 illustrates such a smart contract of a crypto idle game named Ether Cartel. Similar to Ether Shrimp Farm that requires end users to hatch and sell shrimp in a bid to maximize production before ultimately exchanging eggs for ether, Ether Cartel takes the same concept but applies it to drug running. The game “features a high tech automated market that lets you instantly buy or sell drugs with a single transaction. The more kilos you have, the more drugs they produce (each kilo produces at a rate of 1 per day). Collect more kilos with your drugs to multiply your production.”


Ether Cartel was deployed in mainnet on Friday, May-18-2018 05:14:56 PM +UTC. Unfortunatley, it was exploited on the same Friday, May-18-2018 06:25:12 PM +UTC, within 1 hour and 11 minutes after deployment! The vulnerable code is in lines 18-20: there’s a public function named DrugDealer() which allows the caller to change the beneficiary address — ceoAddress.


As shown in Figure 3, the ceoAddress collects the fee whenever sellDrugs() or buyDrugs() is called. Our analysis shows that this particular game has three versions of smart contracts deployed by the same author. After cross-examining these contracts, we have the reason to believe that the buggy drugDealer() is actually the constructor of the smart contract. However, the author accidentally gave it a wrong name (not identical to the contract name). This seems to be a classic problem that has been studied since 2016 (the Rubixi contract was pointed out to have a similar bug in [7]).

As of writing this blog, we have found multiple attackers are gaming to exploiting this vulnerability. And one particular attacker seems to monitor the change of ceoAddress and will immediately regain the control if it has been modified by others. (One attacker has collected around 1.6 ETH by exploiting this vulnerable Ether Cartel game.) After identifying this particular vulnerability, we immediately made the efforts to contract the author. Also, our internal scanning shows that some other smart contracts of similar crypto games have the same problem. We are now contacting these affected development teams by providing necessary technical support.

About US

PeckShield Inc. is a leading blockchain security company with the goal of elevating the security, privacy, and usability of current blockchain ecosystem. For any business or media inquires (including the need for smart contract auditing), please contact us at telegram, twitter, or email.

References

基于遗传算法的新的异构分布式系统任务调度算法研究(Matlab代码实现)内容概要:本文档围绕基于遗传算法的异构分布式系统任务调度算法展开研究,重点介绍了一种结合遗传算法的新颖优化方法,并通过Matlab代码实现验证其在复杂调度问题中的有效性。文中还涵盖了多种智能优化算法在生产调度、经济调度、车间调度、无人机路径规划、微电网优化等领域的应用案例,展示了从理论建模到仿真实现的完整流程。此外,文档系统梳理了智能优化、机器学习、路径规划、电力系统管理等多个科研方向的技术体系与实际应用场景,强调“借力”工具与创新思维在科研中的重要性。; 适合人群:具备一定Matlab编程基础,从事智能优化、自动化、电力系统、控制工程等相关领域研究的研究生及科研人员,尤其适合正在开展调度优化、路径规划或算法改进类课题的研究者; 使用场景及目标:①学习遗传算法及其他智能优化算法(如粒子群、蜣螂优化、NSGA等)在任务调度中的设计与实现;②掌握Matlab/Simulink在科研仿真中的综合应用;③获取多领域(如微电网、无人机、车间调度)的算法复现与创新思路; 阅读建议:建议按目录顺序系统浏览,重点关注算法原理与代码实现的对应关系,结合提供的网盘资源下载完整代码进行调试与复现,同时注重从已有案例中提炼可迁移的科研方法与创新路径。
【微电网】【创新点】基于非支配排序的蜣螂优化算法NSDBO求解微电网多目标优化调度研究(Matlab代码实现)内容概要:本文提出了一种基于非支配排序的蜣螂优化算法(NSDBO),用于求解微电网多目标优化调度问题。该方法结合非支配排序机制,提升了传统蜣螂优化算法在处理多目标问题时的收敛性和分布性,有效解决了微电网调度中经济成本、碳排放、能源利用率等多个相互冲突目标的优化难题。研究构建了包含风、光、储能等多种分布式能源的微电网模型,并通过Matlab代码实现算法仿真,验证了NSDBO在寻找帕累托最优解集方面的优越性能,相较于其他多目标优化算法表现出更强的搜索能力和稳定性。; 适合人群:具备一定电力系统或优化算法基础,从事新能源、微电网、智能优化等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于微电网能量管理系统的多目标优化调度设计;②作为新型智能优化算法的研究与改进基础,用于解决复杂的多目标工程优化问题;③帮助理解非支配排序机制在进化算法中的集成方法及其在实际系统中的仿真实现。; 阅读建议:建议读者结合Matlab代码深入理解算法实现细节,重点关注非支配排序、拥挤度计算和蜣螂行为模拟的结合方式,并可通过替换目标函数或系统参数进行扩展实验,以掌握算法的适应性与调参技巧。
<think>我们正在处理Kali Docker环境中复现CVE-2018-12613时phpMyAdmin出现的连接错误问题。根据用户提供的引用,复现步骤包括进入漏洞目录、构建环境并启动容器。但是,在访问phpMyAdmin时可能会遇到连接错误,比如无法连接到MySQL服务器。 可能的原因和解决方案: 1. **服务启动顺序问题**:容器启动时,MySQL可能还没有准备好接受连接。phpMyAdmin在启动时尝试连接MySQL,如果MySQL尚未初始化完成,则会导致连接失败。 - 解决方案:在docker-compose.yml文件中添加健康检查(healthcheck)和依赖关系(depends_on),确保phpMyAdmin在MySQL完全启动后再启动。 - 修改示例(在docker-compose.yml中): ```yaml services: mysql: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 5s timeout: 10s retries: 10 phpmyadmin: image: phpmyadmin/phpmyadmin depends_on: mysql: condition: service_healthy ports: - "8080:80" ``` 这样,phpMyAdmin会等待MySQL健康状态变为正常后再启动。 2. **网络配置问题**:容器之间可能无法通过主机名通信。在Docker Compose中,默认情况下,容器可以使用服务名称作为主机名相互访问。 - 确保在phpMyAdmin的配置中正确设置了MySQL的主机名(即服务名)。在vulhub的配置中,通常phpMyAdmin会通过环境变量连接到名为`mysql`的服务。 - 检查phpMyAdmin容器的环境变量设置,例如: ```yaml environment: PMA_HOST: mysql PMA_PORT: 3306 ``` 如果环境变量设置不正确,应修正为正确的MySQL服务名称。 3. **权限问题**:MySQL可能拒绝了phpMyAdmin容器的连接。 - 检查MySQL是否允许远程连接(在容器环境下,通常使用同一Docker网络内的连接,所以需要允许来自phpMyAdmin容器IP的连接)。 - 但是,在vulhub的配置中,通常已经设置好。如果出现问题,可以尝试进入MySQL容器,为phpMyAdmin使用的用户(如root)设置合适的权限: ```sql GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; FLUSH PRIVILEGES; ``` 注意:上述命令中,'%'表示允许任何主机连接,这在测试环境中可以接受,但生产环境应限制。 4. **防火墙或端口冲突**:检查Kali主机上是否有其他进程占用了8080端口(或你映射的端口),导致无法访问phpMyAdmin- 使用`sudo netstat -tulpn | grep 8080`查看端口占用情况,并终止冲突的进程。 5. **容器日志查看**:通过查看容器日志来定位问题。 - 查看phpMyAdmin容器的日志:`docker logs <phpmyadmin_container_id>` - 查看MySQL容器的日志:`docker logs <mysql_container_id>` 6. **重新构建容器**:有时候,重新构建容器可以解决临时性问题。 ```bash sudo docker-compose down sudo docker-compose up -d ``` 由于vulhub的配置通常是经过测试的,因此连接错误可能是由于环境差异或启动顺序导致的。建议按照上述步骤逐一排查。 如果问题仍然存在,请提供具体的错误信息,以便进一步分析。 参考站内引用[^1]中提到了搭建靶场环境的步骤,但没有详细说明连接错误的解决方案。因此,我们根据常见的Docker环境问题提供了上述解决方案。 相关问题: 1. 如何检查Docker容器的运行状态? 2. 在Docker Compose中如何设置服务依赖? 3. 如何修改phpMyAdmin的配置以连接到不同的MySQL服务器?</think>### Kali Docker环境下复现CVE-2018-12613时phpMyAdmin连接错误的解决方案 在Kali Docker环境中复现CVE-2018-12613漏洞时,phpMyAdmin连接错误通常由以下原因导致。请按顺序排查: #### 1. **检查容器状态和日志** ```bash # 查看容器运行状态 sudo docker ps -a # 检查phpmyadmin容器日志 sudo docker logs <phpmyadmin容器ID> # 检查MySQL容器日志 sudo docker logs <mysql容器ID> ``` 若容器未运行,使用 `sudo docker-compose restart` 重启服务[^1]。 #### 2. **验证网络配置** 确保容器在同一Docker网络中: ```bash sudo docker network inspect <网络名> ``` 在 `docker-compose.yml` 中确认服务使用相同网络: ```yaml services: mysql: networks: - vulhub_net phpmyadmin: networks: - vulhub_net networks: vulhub_net: driver: bridge ``` #### 3. **检查环境变量配置** 在 `docker-compose.yml` 中确认正确设置MySQL连接参数: ```yaml environment: PMA_HOST: mysql # 必须匹配MySQL服务名 PMA_PORT: 3306 MYSQL_ROOT_PASSWORD: root # 需与MySQL容器一致 ``` #### 4. **测试MySQL连接** 进入MySQL容器验证服务: ```bash sudo docker exec -it <mysql容器ID> mysql -uroot -p # 输入密码后执行 SHOW DATABASES; ``` 若无法连接,需重置MySQL权限: ```sql ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; FLUSH PRIVILEGES; ``` #### 5. **端口冲突处理** 检查端口占用: ```bash sudo netstat -tulnp | grep 8080 ``` 若冲突,修改 `docker-compose.yml` 中端口映射: ```yaml phpmyadmin: ports: - "9090:80" # 改为未占用端口 ``` #### 6. **重建容器** 完成修改后彻底重建: ```bash sudo docker-compose down --volumes sudo docker-compose build --no-cache sudo docker-compose up -d ``` #### 7. **漏洞复现关键步骤** 连接成功后,执行漏洞验证: ``` http://localhost:8080/index.php?target=db_sql.php%253f/../../../../../../etc/passwd ``` 需确保URL中的`target`参数正确编码[^1]。 --- ### 常见错误解决方案 | 错误现象 | 解决方案 | |---------|---------| | "mysqli_real_connect(): (HY000/2002)" | 检查 `PMA_HOST` 是否指向MySQL服务名 | | "Access denied for user" | 重置MySQL密码权限,确认密码一致性 | | 空白页面 | 清除浏览器缓存或使用隐私模式访问 | | 端口无法访问 | 检查Kali防火墙:`sudo ufw allow 8080` | 通过以上步骤,95%的连接问题可解决。若仍失败,建议检查Kali的Docker版本(需≥18.06)及磁盘空间(`df -h`)。 --- ### 相关问题 1. 如何验证CVE-2018-12613漏洞是否复现成功? 2. Docker容器网络通信故障的深度排查方法有哪些? 3. 在漏洞复现环境中如何安全地重置MySQL密码? 4. 当多个Docker项目共存时,如何避免端口冲突? [^1]: 引用参考:vulhub.org官方文档中CVE-2018-12613的复现指南,包含基础环境搭建和漏洞验证流程。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值