Federated learning (FL) enables decentralized model training while preserving data privacy, but it remains vulnerable to network attacks that threaten system integrity. This paper proposes an effective network attack detection method for FL using graph neural networks (GNNs) with an attention mechanism. Devices and their communications are modeled as a graph, allowing the GNN to capture structural relationships and spatial dependencies. An attention mechanism is introduced to prioritize critical nodes and improve detection performance. The model is trained in a privacy-preserving manner using federated learning protocols. Experimental results in MATLAB demonstrate that the proposed approach significantly outperforms traditional methods in detection accuracy, convergence speed, and robustness under various network conditions. The method is intended to enhance the security of FL systems while maintaining privacy.