Was changing the two dead light bulbs and a piece fell off than noticed the wire became exposed. Is this something I can fix as a diy and how dangerous to use the light.
There's definitely a water-ingress problem here (or was). That green corrosion on the copper wires is very severe. So your much bigger problem is structural damage to the building (or black mold) due to what else the water has been up to.
However in the meantime, those loose wires are dangerous, and the remaining visible bare wire is probably shot. Even if the sockets were replaceable, it doesn't look like there's enough wire length left to splice to them. So the fixture is shot.
When you buy a new fixture - we're not talking a lot of money here - either buy a pure-LED fixture that does not have replaceable bulbs (this will be more money), or buy one that is open on the sides and allows airflow to the bulbs. That way you can upgrade to LED and save a ton off your electric bill.
If swapping a fixture is too much for you, any competent handyman can handle the task. To give you a sense of the difficulty, most towns that require permits don't require a permit for "swapping a light fixture", as it is considered to be a trivial repair by electrical standards.
This fixture is definitely due for full replacement. The wire ends at the ceramic bulb sockets are typically riveted to the socket with the bulb contacts. There is not a practical way to clean up and reattach the wires to the socket.
A completely new fixture of this type is not so expensive as to break the bank account so it should be the first level choice. In addition the current fixture shows a lot of rust on the threaded piece in the center and on the tabs which hold the sockets. This indicates other problems of moisture being present which will have to be addressed.
Lastly if you are set on a real DIY repair it is possible to remove the bulb sockets on this fixture. You would have to remove the nut that secures the socket to the tab bent down from the main plate of the fixture. It is possible to get replacement sockets of this type that have the attached wire pigtails. You may have to search around for a good old fashioned lamp store to find the replacement parts. Do not be surprised if the cost of the replacement parts comes close to the new fixture cost at a big box store.
Please heed the safety advice given in the other answer here.
It is DEFINITELY dangerous to keep using this fixture as-is. Turn OFF the circuit-breaker that controls this light and take the fixture down for repair or replacement.
You may want to closely inspect the connections as this shows signs of corrosion and other parts may be damaged as well. But you may be able to reconnect that wire, after cleaning it up or cutting off the end and stripping the insulation off to expose some fresh copper.
If you don't feel comfortable with this type of work, call in a professional.