We study gravitational lensing by a generic extended mass distribution. For that, we consider the diffraction of electromagnetic (EM) waves by an extended, weakly aspherical, gravitating object. We account for the static gravitational field of such a lens by representing its exterior potential in the most generic form, expressed via an infinite set of symmetric trace free (STF) tensor multipole mass moments. This yields the most general form of the gravitational phase shift, which allows for a comprehensive description of the optical properties of a generic gravitational lens. We found that at each order of the STF moments, the gravitational phase shift is characterized by only two parameters: a magnitude and a rotation angle that characterize the corresponding caustics, which form in the point spread function (PSF) of the lens. Both of these parameters are uniquely expressed in terms of the transverse-trace free (TT) projections of the multipole moments on the lens plane. Not only does this result simplify the development of physically consistent models of realistic lenses, it also drastically reduces the number of required parameters in the ultimate model. To help with the interpretation of the results, we established the correspondence of the gravitational phase shift expressed via the TT-projected STF multipole mass moments and its representation via spherical harmonics. For axisymmetric mass distributions, the new results are consistent with those that we obtained in previous studies. For arbitrary mass distributions, our results are novel and offer new insight into gravitational lensing by realistic astrophysical systems. These findings are discussed in the context of ongoing astrophysical gravitational lensing investigations as well as observations that are planned with the solar gravitational lens (SGL).