Shaikh Ibn ul-Uthaymeen rahimahullah was asked:
What is the ruling on removing the sock or some of it to scratch some of the foot or remove something in his foot like a small rock or the likes?
If he enters his hand under the sock, then there is no harm in that nor blame. As for removing it to see, if he removes a small portion, then it does not harm. If he removes a lot such that most of his foot is exposed, then it nullifies the wiping upon them in the future.
[Majmoo’ al-Fatawa wa Rasail (11/127)]
Faisal Ibn Abdul Qaadir Ibn Hassan