The network security situation assessment technology can assess the severity of threats to the network system as a whole, find out potential security risks in the network as soon as possible and help managers fully grasp the overall security situation of the network. Aiming at the problems of low assessment efficiency and poor convergence of traditional situation assessment algorithms, a network security situation assessment algorithm based on BP neural network optimized by Sparrow Search Algorithm is proposed. The algorithm uses the Sparrow Search Algorithm to find the optimal weight and threshold and assigns them to the BP neural network for optimization. Then, the situation data is inputted into the algorithm for training to get the situation assessment values, and the threats to the network system are assessed according to the constructed network security situation index system. Comparative experiment results show that the algorithm has faster convergence speed and can objectively reflect the current network security situation.