Data privacy is essential in the financial sector to protect client's sensitive information, prevent financial fraud, ensure regulatory compliance, and safeguard intellectual property. It has become a challenging task due to the increase in usage of the internet and digital transactions. In this scenario, DDoS attack is one of the major attacks that makes clients' privacy questionable. It requires effective and robust attack detection and prevention techniques. Machine Learning (ML) has the most effective approaches for employing cyber attack detection systems. It paves the way for a new era where human and scientific communities will benefit. This paper presents a hierarchical ML-based hyperparameteroptimization approach for classifying intrusions in a network. CICIDS 2017 standard dataset was considered for this work, Initially, data was preprocessed with the min-max scaling and SMOTE methods. The LASSO approach was used for feature selection, given as input to the hierarchical ML algorithms: XGboost, LGBM, CatBoost, random forest, and decision tree. All these algorithms are pretrained with hyperparameters to enhance the effectiveness of algorithms. Models performance was assessed in terms of recall, precision, accuracy, and F1-score metrics. Evaluated approaches have shown that the LGBM algorithm gives a proven performance in classifying DDoS attacks with 99.77% of classification accuracy.