Looks like a resin anchor to me (including some resin still on the threads, so it wasn't well installed IMHO - and BTW it was installed wrong way round because the square should be at the outer end so you can get an adjustable spanner onto it). Best replaced, although for non-structural work threaded metric rod will do the job just as well. Needs the holes on the wall to be redrilled (2mm bigger diameter than the threaded bar) and new resin squirted in
I think that is plaster they dropped on the thread, I could be wrong though.
So I'm clear, I can straighten up the bolts, drill new holes and then fix it in place with with the resin?