Small Floating Cabinet on Drywall?
Hang a piece of 1/2" to 3/4" birch plywood (depending on how strong you need it to be), the same dimensions as the cabinet, on the wall, securing it with counter sunk #10 or larger screws, at the stud, and countersunk toggles at the corners.

Hang your cabinet from the plywood, and stain/paint the plywood to match.

If you don't want to see the plywood grain, you can cut it a little narrow, and glue hardwood edge banding to it, and then stain/paint to match.