Harriet Harman has said she has accepted an apology from a Tory MP for hacking into her website and altering its contents.

Kemi Badenoch, the MP for Saffron Walden and a rising star in the Conservative party, made the confession in a video interview unearthed this week.

Asked about the “naughtiest” thing she had done, Badenoch said: “About 10 years ago, I hacked into a Labour MP’s website and I changed stuff in there to say nice things about Tories.”

She told the Mail on Sunday, which obtained the video: “This was a foolish prank over a decade ago, for which I apologise.”

The newspaper quoted an anonymous Conservative HQ source who said Badenoch had guessed the password to Harman’s website but not carried out “real hacking”.

Harman, a former deputy Labour leader, tweeted: “@KemiBadenoch has written to me apologising. I have accepted her apology.”

Though Badenoch did not name the Labour MP, it was reported in 2008 that Harman’s personal website had been hacked, with posts announcing her defection to the Conservatives and calling on Londoners to back Boris Johnson for mayor of London.

At the time, the hacker told the rightwing site Guido Fawkes they got into Harman’s website with a guessable password, and added a fake blog entry.

A PhD researcher said he had submitted a crime report to the UK’s national reporting centre for fraud and cybercrime.