There are a few ways they can gain access, one way being the breather holes at the bottom of the house or the gaps around pipes. A mouse can fit through a gap the thickness of your little finger and a rat to the thickness of your thumb.
Once they gain access through the breather holes or pipes, they climb up the inside of the walls and up into the roof cavity.
Another common way is if you have branches or trees leaning up against your house. So, it’s always advisable to trim these back a metre from your roof.