In modern power grids, a local failure or attack can trigger catastrophic cascading failures, which make it challenging to assess the attack vulnerability of power grids. In this Brief, we define the $K$-link attack problem and study the attack vulnerability of power grids under cascading failures. Particularly, we propose a link centrality measure based on both topological and electrical properties of power grids. According to this centrality, we propose a greedy attack algorithm and an optimal attack algorithm. Simulation results on standard IEEE bus test data show that the optimal attack is better than the greedy attack and the traditional PSO-based attack in fracturing power grids. Moreover, the greedy attack has smaller computational complexity than the optimal attack and the PSO-based attack with an adequate attack efficiency. Our work helps to understand the vulnerability of power grids and provides some clues for securing power grids.