Castleford secured a crucial victory over a Catalans side struggling with injuries. 