It could have been an opportunity like they had renovations in the building, an agent disguised as a worker planted it inside the wall or something. Or like a plot on a Sopranos episode, feds snuck into Tony’s house and swapped a lamp with an exact replica with a listening device inside. Definite security failure for a secure compound though.