How to restore the privileges of the user postgres in PostgreSQL? Someone logged in my PostgreSQL as the user postgres, because a lack of security in my configuration files. What he did is to create a lot of superusers, and then, he revoked SUPERUSER privilege from postgres.

I've corrected the configuration files to avoid more problems, but now the harm is done and I can only log in as postgres, who is no more a superuser.

I would like to grant SUPERUSER privileges again to postgres user, but of course as I can't log in as a superuser I can't do it. Which is the best way to achieve this? I prefer to avoid reinstalling postgresql, is there other way?

I've also glanced the PostgreSQL log and I've seen the moment when the users were created, and their passwords, but these ones are encrypted through MD5 and I'm not able to desencrypt them.

What would you do in this case? Thank you!
If you edit your pg_hba.conf to allow login as one of the other superusers, then you can login as one of those and then alter role postgres superuser.