Worked example: getting a hacked X account back, step by step

Dev and his account are fictional, an invented example that shows the recovery steps in a realistic order.

Dev has a small woodworking channel and posts on X most evenings. On a Saturday morning, a friend sends him a screenshot. During the night, Dev’s account has been used to post three replies, all promoting the same crypto giveaway link. However, Dev did not write any of them. Below is the order he works through, which is also the order X’s own help pages point to.

Step What Dev does Why it comes at this point
1 Checks whether he can still log in Decides which recovery path applies
2 Secures his email account Whoever controls the email can reset the X password
3 Changes or resets his X password Cuts off the attacker’s login
4 Revokes unknown connected apps Apps keep access even after a password change
5 Turns on two-factor authentication A stolen password alone stops working
6 Deletes the spam posts and warns followers Limits damage to people who trust him

Step 1: Can Dev still log in?

The first thing to check is whether you can still sign in, because that decides which recovery path you take.

Dev opens the X app on his phone. Fortunately, he is still logged in. Although the attacker has posted from his account, neither the password nor the email has been changed yet. Should Dev have been logged out with his password no longer working, he would start with the Forgot password link on the login page. However, if the email had also been changed, the reset would go nowhere. In that case, X points people to its form for hacked or compromised accounts, where you give your username and the date you last had access.

Step 2: Why does Dev secure his email before anything else?

Your email inbox can reset your X password, so an attacker with your email can undo every fix you make on X.

Dev is guilty of reusing passwords. His X password was the same one he once used on a forum that leaked years ago. Therefore, before touching X, he logs in to his email account, changes that password to a new one and turns on two-factor authentication there. He also reviews the email account’s forwarding rules and recent sign-ins, as attackers sometimes set up a quiet forwarding rule to catch reset messages.

Step 3: How does Dev change his X password?

If you are still logged in, change the password right away from the Password tab in your settings.

Dev goes to Settings and privacy, then Your account, then Change your password. Using a password manager, he generates a long random password, something he has never used anywhere else. X’s help page also notes that if any trusted outside app uses your X password, you should update it there as well. As Dev does not have any such apps, he moves on.

Step 4: Why remove connected apps after changing the password?

A third-party app you once authorized can keep posting for you even after a password change, so unknown apps have to be revoked.

Many people skip this step. Dev opens Settings and privacy, then Security and account access, followed by Apps and sessions, then Connected apps. The list surprises him. There is a scheduling tool which he tried in 2021, a quiz app which he has no recollection of and another which he cannot identify. He revokes everything he does not use today, keeping only the one tool he relies on. While he is there, he also checks the sessions list and logs out every device apart from his phone and laptop.

Step 5: Which two-factor method does Dev pick?

Dev turns on an authentication app, because text message codes on X are limited to Premium subscribers and the app method is free.

He goes to Security and account access, then Security, then Two-factor authentication. Since March 20, 2023, text message 2FA has only been available to paid subscribers. Therefore, Dev picks the authentication app option and scans the QR code. X then displays a backup code. Dev writes this on a card and puts it in his desk drawer rather than in his camera roll. You can have up to five active backup codes and, crucially, X requires them to be used in the order they were generated.

Step 6: What does Dev do about the spam posts?

He deletes every post he did not write, checks his profile for changes and tells his followers what happened.

Dev then deletes the three giveaway replies. Scrolling back further, he finds one more that he missed. There has also been a direct message sent to a dozen followers, again containing the same link. He then checks his bio, display name and header, as attackers sometimes change these too. Everything else appears untouched. Finally, he posts a short note:

  • His account was compromised overnight.
  • The giveaway posts and messages were not from him.
  • Nobody should click that link.
  • The account is secured again.

While deleted posts disappear from X, X cannot remove copies which live on other sites or in quote posts by other people. A warning post therefore helps anyone who saw the spam before Dev cleaned up.

What would Dev do differently next time?

Use a unique password from the start, keep two-factor authentication on, and review connected apps a couple of times a year.

Overall, the whole recovery took Dev a little under an hour, mostly because the account was still in his hands. Those who lose the email and password together face a much slower path through X’s support form. The three habits above would have made Dev’s Saturday a lot quieter.

FAQ

What if the hacker changed my email address?

A password reset will go to the attacker’s address, so use X’s form for hacked or compromised accounts and include your username and the date you last had access.

Does changing my password log the hacker out?

It stops their password login, but apps you once authorized can keep access. Revoke unknown apps and end unfamiliar sessions as well.

Can I use text message codes for two-factor authentication?

Only with an X Premium subscription. Free accounts can use an authentication app, a security key or a passkey.

Should I delete posts the hacker made?

Yes. Delete them, check your direct messages for spam sent in your name and post a short warning for your followers.

Sources


Eric Anderson

Eric is an analytics-minded social media blogger who likes asking what a number actually means before celebrating it. His Twitein articles examine X post performance, engagement quality, impressions, and simple ways to review a content strategy. He aims to help readers make better choices with the data they already have.