Shells are low surface brightness arcs of overdense stellar regions, situated on both sides of the galaxy center and extending to large galactocentric distances. In this talk, I will focus on their origin in a cosmological setting and on their influence on the shape of the stellar and dark matter halos of the host galaxy. We study the type of galaxy mergers that produce shells using a cosmological gravity+hydrodynamics simulation - Illustris. We identify the individual stars and progenitor galaxies responsible for forming shells and our results indicate that z=0 shells in massive ellipticals are the result of relatively major mergers, with progenitors accreted on low angular momentum orbits, between 4 and 8 Gyrs ago. Outer shells are often more metal-rich than the surrounding stellar material in the host halo, and in the case of galaxies with multiple shell-forming satellites, it is possible to detect significant differences in the metallicity of the shells produced by each progenitor. We investigate the shape of the stellar and dark matter halos for the shell galaxies in our sample, and we find that Type I shells are predominantly found in prolate halos. By separating the in-situ and ex-situ stellar components, we show that the stellar haloes of many shell galaxies are oblate in the inner regions, which are dominated by in-situ stars, but become prolate or triaxial at larger radii where the shape is dictated by the presence of shells.