How to attach a security camera to an existing box?
Many camera's like this popular Lorex model:



come with a small 2" surface mounting "Plate" that you can use if you don't have electrical box mounting.  They also screw into a 1/2" weatherproof threaded knockout, so that they can be used with 4" weatherproof flood light accessory plates: