SAN FRANCISCO — Hackers took over the Twitter account of Twitter’s chief executive, Jack Dorsey, on Friday and used the account to broadcast a string of racist messages and bomb threats.

In the posts, the attackers claimed that Twitter’s San Francisco headquarters would be bombed, and used Mr. Dorsey’s account to retweet posts from several individuals appearing to claim responsibility for the hack.

The brief takeover of Mr. Dorsey’s Twitter account is a reminder of the risks facing celebrities, businesses and public officials that use Twitter. They are prominent targets for hackers and other troublemakers, but their accounts are often poorly protected and can be accessed by determined attackers.

The breach of Mr. Dorsey’s account should also serve as a nudge to tech executives and everyday internet users who go online to shop, bank or simply post photos to pay close attention to the security of their online accounts.