How to secure switch box flush with wall surface
This is most likely easily fixed by swapping the box out with a different style (Old Work Box) or simply running some screws into the side of the existing box if it's against a stud, depending on the situation.   

Pictures will help.

Either way, it's unlikely that you will have to cut into the wall.

a) Here is how to remove an broken electrical box:

https://www.youtube.com/watch?v=qq4UkWsUWoo

b) And here is how to install an "old work box" in its place:  

https://www.youtube.com/watch?v=e8Fq8I_AQ-Q