The microscopic pore shape and topology significantly affect fluid transport and occurrence in porous permeable rock. A quantitive characterization of the impact of pore morphology on permeability is currently lacking, which limits the efficient development of underground hydrocarbon resources. This work introduces the Euler number and shape factor to characterize the pore topology and shape of heterogeneous sandstone based on CT imaging. The pore morphology under different pore sizes and the correlation of the Euler number, shape factor, fractal dimension, and surface area are analyzed. Furthermore, a modified Kozeny–Carman equation is established to explain the influence of the Euler number and shape factor on permeability. The results show that with the increase of pore diameter, the Euler number decreases while the shape factor increases. In a connected pore system, the smaller Euler number corresponds to the complex pore network, which leads to the increase in the surface area, shape factor, and fractal dimension. At constant porosity, the shape factor is negatively correlated with permeability, and with increasing Euler number, the heterogeneity of the pore structure increases, resulting in an increase of flow resistance and a decrease of permeability. The results provide a new pore morphology characterization method for digital rock and help to understand the flow mechanism of hydrocarbons in complex pore networks.