After all a so-called "low-caste" person could go somewhere else and claim to be of a "higher" caste. Do scriptures talk about such cases and how to detect them?
Yes, here is what the Manusmriti says about how to find out the caste of someone whose parentage is unknown; meaning you want to know the caste he was born into but unable to do so because you don't know the caste of his parents, so you would then infer based on the behavior of the person.
The man of impure origin, who is devoid of caste, unknown, a non-Aryan, even though having the appearance of an Aryan,—one shall discover by his acts.—(57)
Snobbishness, harshness, cruelty, and proneness to neglect duties, mark the man of impure origin in this world.—(58)
The base-born man bears the character of his father, or of his mother, or of both; he can never conceal his origin.—(59)
Even when one is born in a great family, if there be a confusion regarding his parentage, he surely imbibes the traits thereof, to a greater or lesser extent.—(60)
Viṣṇu (16.17).—‘All members of the mixed castes may be found out by their deeds, whether their descent has been kept secret or is generally known.’