It is reported from Anas bin Malik, may Allah be pleased with him, that the Messenger of Allah (peace and blessings of Allaah be upon him) said:
“If one of you performs ablution and puts on his Khuff (socks), let him pray in them and wipe them, and, if he wants, let him not take them off except because of a major impurity / Janaba / “.
This hadith was narrated by ad-Darakutni 795 and al-Hakim 643 from the words of Anas.
Sheikh al-Albani called the hadith authentic. See Sahih al-jami ‘as-saghir 447.
447 ( صحيح )
إذا توضأ أحدكم و لبس خفيه فليصل فيهما و ليمسح عليهما ثم لا يخلعهما إن شاء إلا من جنابة
( قط ك ) عن أنس .
Grade: Sahih as per Shaykh al-Albani
Note: In both the hadith of ad-Darqutni and Hakim there is Miqdam bin Dawood who is a Daif narrator. Darqutni himself weakened him.
** Wiping over the socks is specific to minor impurity, not major impurity. As for major impurity, it is not permissible to wipe with it, rather it is necessary to take off the socks.
This hadith is weakened because there is a time period for wiping over socks such as one day and night of the resident and 3 days and night for the traveler. The wording of this hadith gives the implication that one does not need to take off the socks indefinitely.
And Allah Knows Best.