 There were seismometers that were placed on the moon during the Apollo missions, multiple ones, so they get really good data. And then they crashed Saturn V's upper stages into the moon to make those seismometers get data. And from that data, researchers who study seismology were able to get a very clear idea of the interior of the moon, and it's generally solid.