SummaryPhishing attacks have a remarkable ability to steal user information by using simple techniques. Phishing attacks steal valuable information, such as user names and passwords. The loss caused by phishing attacks is significant, and every year, millions of dollars are lost by internet users and companies through phishing attacks. Deep learning methods such as CNN neural network are one approach to detecting phishing attacks: deep learning methods, optimization for image processing, and efficient techniques used to process URL strings. A convolutional neural network is a widely used deep learning method in image processing. The limitation of CNN learning to images is one of the main challenges of this neural network for detecting phishing attacks. Imbalance in the training dataset and lack of intelligent feature selection are other challenges for CNN training in detecting phishing attacks. This manuscript presents a new approach called CGAN‐IWSO‐ResNet50 to detect phishing attacks. In the first step, the improved version of the conditional GAN is used to balance the URL samples. In the second stage, Hand‐crafted and TF‐IDF methods implement the feature extraction phase. In the feature selection stage, the WOA algorithm is used to improve the WSO algorithm's performance in feature selection. The selected features are implemented on the dataset, and legal and phishing samples are coded as RGB images. In the last step, RGB images are used to teach ResNet50 architecture. Tests in the PhishTank dataset showed that the proposed method's accuracy, sensitivity, and precision index are 99.65%, 99.12%, and 99.46%, respectively. The CGAN‐IWSO‐ResNet50 method is more accurate in detecting phishing attacks than the VGG19, AlexNet, RCNN, DNN + LSTM, and DNN + BiLSTM learning methods.