In existing malware visualization classification models, there are inadequate accuracy and robustness. For this reason, this paper proposes a malicious code visualization classification method CasKD Net (Cascade DenseNet with KAN) based on an improved DenseNet. The CasKDNet is to realize the improvements in accuracy and robustness by three key technologies. Firstly, a cascaded classifier structure is constructed to enhance the feature discrimination ability of texture similar families. Secondly, the KAN structure is used to replace the multi-layer perceptron in the DenseNet network, optimizing the non-linear expression ability of the feature extraction process and improving the overall accuracy of the model. Finally, the FFM image restoration algorithm is used to enhance the training set and improve the robustness of the model. It appears from the experimental results on the malicious code dataset Malimg that the CasKDNet model achieves 99.69% of classification accuracy, and is superior to the existing research methods. Furthermore, in the context of white box attacks, the success rate of FGSM and I-FGSM algorithms attack against the CasKDNet only serves as 12.7% and 37.5% respectively, and the model is valid in preventing adversarial attacks.