Twitter has restricted the ability of attackers to post tweets and perform other actions on behalf of many users who have phone numbers associated with their accounts, but some users need to enable a PIN option in order to be protected.
On Monday, a developer and security researcher named Jonathan Rudenberg reported that attackers can abuse the Twitter accounts of users who added their phone numbers to their profiles in order to use the service via SMS (Short Message Service).
Twitter allows users to control their accounts by sending commands via text messages to phone numbers set up by the company. The supported commands include following and unfollowing users, tweeting, retweeting, sending direct messages, modifying profile information such as name, bio or URL, and more.
The problem is that the origin of text messages can be spoofed and there are services that allow users to do this easily.
"Like email, the originating address of a SMS cannot be trusted. Many SMS gateways allow the originating address of a message to be set to an arbitrary identifier, including someone else's number," Rudenberg said.
This means that if an attacker knows the phone number of a Twitter user and that user associated his phone number with his account, the attacker can issue SMS commands on behalf of the user without actually having access to his phone.
In order to use Twitter via SMS users have to first associate their own phone numbers with their accounts. This can be done from the account settings menu in the Twitter website or by sending a sequence of commands, including the user name and password, to one of three Twitter phone numbers registered in the U.K., Germany and Finland.
Once this is done, users can start sending SMS commands from their phones to Twitter "short codes" -- special short numbers registered by Twitter with mobile operators in various countries -- or long codes, Twitter's internationally accessible phone numbers from U.K., Germany and Finland.
Sending text messages with a spoofed origin address to short codes is not possible, because those special phone numbers are only accessible from inside the operator's network and messages don't pass through an external SMS gateway that could allow spoofing. However, in Twitter's case attackers had the option of sending commands through the long codes.
Facebook and Venmo, a payment service, were vulnerable to the same type of attack, but fixed the problem after being contacted in August and November respectively, Rudenberg said. However, after initially responding to the private report in August, Twitter stopped answering, he said.
As a result, the researcher decided to make the issue public a few months later.
"Our team has already addressed this vulnerability," a Twitter representative said Tuesday via email.
However, it turns out that Twitter's fix does not automatically protect all users. Rudenberg was still able to demonstrate the vulnerability on a test account after Twitter said the vulnerability was addressed.
Twitter made changes that prevent users with phone numbers from mobile operators for which the company has a short code, to send commands through the long codes. This blocks the spoofing attack for a lot of users.
However, there are many mobile operators for which Twitter doesn't have a short code available. Users with phone numbers from those operators are allowed to send SMS commands through long codes. Those users can only associate their phone numbers with their accounts by using the long-code based process and not through the Twitter website.
Bogdan Alecu, an independent mobile security researcher, confirmed that users who are forced to use long codes are still vulnerable to account hijacking attacks via SMS spoofing.
Alecu performed a test using a phone number from an operator for which Twitter doesn't have a short code available. Sending an SMS with a spoofed origin through an SMS spoofing service doesn't cost more than 7 euro cents in Europe, he said.
"Users that use the long codes are vulnerable to spoofing, but can enable the PIN code feature," Rudenberg said Tuesday via email.
Twitter offers an option for every SMS command to be authenticated with a PIN. The option can be turned on and the PIN can be configured in the mobile section of the account settings on the Twitter website.
Rudenberg believes that hundreds of thousands of early Twitter users might have used the SMS feature, but never removed their phone numbers from their accounts when they later bought smartphones and started using Twitter's mobile apps.
"I also know a few people who use this feature for various reasons," he said. "I think that there are countries where smartphones don't have very high penetration that have users of this feature."