This sock that once belonged to Harry Potter was given to the house-elfDobby by Lucius Malfoy (his master). Harry tricked Lucius Malfoy by presenting him with Tom Riddle's Diary, with the sock inside. When Lucius Malfoy took the diary from Harry, he handed it to Dobby. Harry then told Dobby to open the book, which he did - and he discovered the sock, which had been unwittingly given to him by Lucius Malfoy. This meant that Dobby was free. Dobby kept that sock on until the day he died.

Another sock of Harry's was used to hold his Sneakoscope and also later given to Dobby.