Cybersecurity involves protecting computer networks, systems, and data from unauthorized access and disruptions using advanced technologies. The purpose of this research is to establish a novel cyber security framework for strengthening cloud data protection. In this paper, we propose a novel Dung Beetle optimization-redefined Intelligent Random Forest (DB-IRF) for accurate detection of intrusions in a cloud environment. We obtained a dataset that includes cloud system logs and network traffic data, including normal and malicious activities, to train our proposed model. We utilized z-score normalization to pre-process the gathered raw data. Our suggested model enhances classification accuracy by integrating DB optimization with the IRF algorithm. It optimizes feature importance weights during training and improves the model's ability to detect intrusions in cloud environments accurately. The proposed detection model is implemented in Python software. In the findings assessment phase, we effectively assessed the performance of our proposed DB-IRF in detecting earthquake incidents across multiple evaluation metrics such as Accuracy (97.5%), Precision (97.96%), F1 Score (98.48%) and Recall (97.85%). We also conducted a comparison analysis with other conventional methodologies. Our experimental results demonstrate the capability and reliability of the recommended framework.