I need to install some new outlet boxes in an old lathe and plaster wall. I have the baseboards pulled out so I can see where the studs are, which is just great. However, behind the lathe is a brick wall (exterior of the building) and I was wondering if it would be OK to just attach the boxes directly to the brick (through a box-sized hole) instead of having to dig out a bigger hole in the plaster to get at the studs and attach them there.
There is no obligation to attach an outlet box to a stud. There are many applications where a box is "free floating" in a plaster wall using boxes that have various types of flanges that lock the box in. Boxes are sometimes embedded in wooden boards, such as baseboards.
The important thing is to ensure that the box is firmly secured. This could be done by screwing the box into the brick (using masonry anchors) through an existing opening in the box. It may be more practical to obtain "old-work" type boxes that have their own retaining mechanisms. the box is slipped in, then the retaining mechanism is tightened to grip the back of the plaster and lathe.