The community detection was performed from the perspective of links, and we proposed an inhibition method against social network worms. Firstly, a community detection algorithm was proposed, which based on link clustering, and we got related link incremental information through the network structure information at various time points. In order to obtain the link communities, we adopted an improved link partition density function to dispose the link incremental information. Next, we gave three selection strategies of key nodes in community and proposed corresponding worm inhibition method. Finally, on the basis of real web data sets, we applied community detection and worm inhibition experiments to prove validity of algorithm in this paper.