Mura traced this back to the Prophet ﷺ, who said, "When one of you wakes up fasting, he should not engage in obscene speech or behave ignorantly. If someone insults him or tries to fight him, let him say, 'I am fasting.'"
حدثنا سفيان عن أبي الزناد عن الأعرج
مرة يبلغ به النبي ﷺ إذا أصبح أحدكم صائما فلا يرفث ولا يجهل فإن امرؤ شاتمه أو قاتله فليقل إني صائم
Its chain of transmission is sahih. Muslim narrated it, 1:316, from Zuhayr bin Harb, from Sufyan, with this wording. Malik narrated something similar, 310, from Abu Zinad. Bukhari narrated its meaning within a lengthy hadith, 4:87–94, through the route of Malik, from Abu Zinad. See also Muntaqa, 2142, and Fath Kabir, 1:151."So let him not utter foul speech" (fala yarfuth), with the fa either pronounced with damma or kasra. Hafiz said, what is meant by rafath here, pronounced with fatha on the ra and the fa followed by the letter tha, is obscene speech. This word applies to such speech, and also to intercourse, and to what precedes it, and to mentioning it in the presence of women, or unrestrictedly. It is also possible that it refers to something even broader than these meanings."And let him not act ignorantly" (wa la yajhal), Hafiz said, meaning he should not do any of the deeds characteristic of ignorant people, such as shouting, foolish behavior, and the like.