I'd replace it with one of those new metal ones
But hey DIY-er here and I know shit about fuck.
This looks like an all in one cheapo builder fixture, the kind that would go in new tract housing. The box looks like a box for electrical purposes (instead of a separate terminal box or a proper joist-mounted round box), but it came with the light and the bracket all as one unit, for the finish plate and fixture to be installed after. I couldn't find any example like that on the web.
You can probably turn the nut to loosen the bracket between the joists and remove it. Then get an "old work" electrical box that clamps on to the drywall from behind. Or to really do things right, a new retrofit braced box: https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA
Get a new box similar to this one:
Hubbell Raco 936 4 in. Round Retro-Brace Ceiling Fan-Rated Support, 4 in, Gray https://www.amazon.com/dp/B000HEIYHA/ref=cm_sw_r_apan_i_WYBZNSD36G67MJPR0BQZ?_encoding=UTF8&psc=1
It will extend to grab on to the joists on either side.
I would use something like this that secures between two joists
Here is one off Amazon. Make sure to double check the weight rating on the box will work for the fan you have.(This one is rated for a 35 lb fan but I believe they have others rated for 75lb and higher)
a ceiling fan requires a solid metal box attached directly to a stud, or a bracing system that attached to two joists to properly support the fan.
​
your current setup will fail as soon as you add weight.
the lag screw would have been added to hold the safety cable into the beam above, your box is not safe to install the fan on as it is.
​
something like this can be bought locally and installed in the ceiling. it slide in and you turn it to expand it until it is firmly against both joists.
https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA
Pulled the old box and used this one:
It was the only one Ace had in stock, I wasn't super impressed with it since it can't be screwed down but that's what we used.
Thank you. I'm fucking livid. I want to beat the shit out the guy to tell you the truth. But I know going at people with that attitude rarely ends well for me, even if it's just cussing him out. I need to look up how to file a complaint. I can probably start by looking for a licence lookup. Actually yeah. In my state I've read licensing complaints logged against people when I was looking for a contractor for drainage. I'll start there.
I just bought these and they are rated for up to 35 lbs. Fan is 20lbs. They will be here by 10PM. Thanks Amazon!
https://www.amazon.com/dp/B000HEIYHA/ref=cm_sw_r_cp_api_glt_fabc_4QQNQ1H5HM8JDWCWXF3H
here is the brace you can get to attach to two joists in the ceiling.
https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA
and if you have a heavy fixture (OP doesn't look too heavy), these things work great, especially when you can't or don't want to make/patch a drywall hole to fit in bracing
https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA
Looks like it pulled the box out-it probably wasn't a ceiling fan box.
Step one: Turn off power.
Step two: Buy and install the right box. Something like : https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA/
Hubbell Raco 936 4 in. Round Retro-Brace Ceiling Fan-Rated Support, 4 in, Gray https://www.amazon.com/dp/B000HEIYHA/ref=cm_sw_r_apan_glt_fabc_DVQXP2FM47J4RGS0AVNK
Same thing on amazon
Maybe consider using this I would double check its ability to mount somewhere besides a ceiling but i would imagine it would be fine.
Get an old work ceiling fan box
The wiring is the same, but you need a "fan box" instead of the current electrical box. A fan box is attached to rafters so your fan doesn't fall down. https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA
remove that junction box and install a legitimate fan box. A fan box has steel arms that go into the ceiling joists. https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA/ref=asc_df_B000HEIYHA
if you are super worried you can try a old work fan. It pretty much fits in the hole and clamps between two studs.
https://www.amazon.com/Hubbell-Raco-936-Ceiling-Fan-Support/dp/B000HEIYHA
I've added a new fan/light combo (no fixture there previously) as well as added a new switch to an existing fan/light that ran off of one switch. Both places I used a GE 12724 Smart Dimmer for the lights and a GE 1273 3-Speed Fan Control for the fan. It works great in my opinion, you can manually turn the fan and/or lights on/off or I can use my phone (connected to my Rpi3 DIY hub running homeassistant).
Here's what you'll have to do, it's a little bit of work but if you're handy it's not a very difficult job. If you have access to the fixture from the attic this will be 100% easier.
Assuming that there is a single 14/2 Romex wire from your current switch to the light you'll either have to:
pull another 14/2 Romex wire from the switch receptacle to the light fixture
replace the current wiring with a single 14/3 Romex wire
replace the current ceiling enclosure with an old-work fan-rated box assuming the box isn't ceiling fan-rated
assuming that the switch is in a single-gang enclosure replace the switch enclosure an old-work 2-gang enclosure
wire the fan and switches with the new 14/3 Romex or the dual 14/2 Romex wiring