The Messenger of Allah ﷺ said, "Whoever plants crops on someone else's land without their permission has no right to any of the produce, but he is entitled to recover his expenses."
حدثنا قتيبة بن سعيد حدثنا شريك عن أبي إسحق عن عطاء
قال رسول الله ﷺ من زرع في أرض قوم بغير إذنهم فليس له من الزرع شيء وله نفقته
[Its chain of transmission is daif] Narrated by Tirmidhi, in the Book of Rulings, Chapter on what has been said about one who plants in another people's land without their permission, hadith no. 1366, from Qutayba, with this wording, and he said, "Hasan gharib." Ibn Majah also narrated it, hadith no. 2466. * Ataa did not hear from Rafi bin Khadij, and Abu Ishaq narrated with an ambiguous chain (an'ana).