EXCLUSIVE

Masked gunman stormed into the home where the hip hop duo Rae Sremmurd were staying, assaulted a security guard, and made off with a safe ... TMZ has learned.

Law enforcement sources tell us ... 4 armed robbers knocked on the door of the San Fernando Valley home at 4:30 AM Saturday. We're told a security guard answered, got pistol-whipped ... and the crooks entered.

Our sources say the men, wearing ski masks, demanded to be taken to the safe in the house ... stole the entire thing and fled. It's unclear at this time what's inside. Slim Jxmmi was home at the time of the break in, but Swae Lee was not.

We're told Swae and Jxmmi are staying at the pad, which doubles as a recording studio Cops are investigating.

*NSFW* 😳

Fan wanted a selfie and threw her cell phone at @swaelee ...here’s the result! Should he sue?? #dazedandblazedtour #K104

WARNING EXPLICIT LANGUAGE pic.twitter.com/wDjPey2yw9 @K104FM