Sunan an-Nasa'i, Volume 5, Book 37, Hadith 4061 (DarusSalam)

It was narrated that Jarir said: "Any slave who runs away from his masters and joins the enemy, he has made it permissible to shed his blood."

أَخْبَرَنَا عَلِيُّ بْنُ حُجْرٍ، قَالَ حَدَّثَنَا شَرِيكٌ، عَنْ أَبِي إِسْحَاقَ، عَنْ عَامِرٍ، عَنْ جَرِيرٍ، قَالَ أَيُّمَا عَبْدٍ أَبَقَ مِنْ مَوَالِيهِ وَلَحِقَ بِالْعَدُوِّ فَقَدْ أَحَلَّ بِنَفْسِهِ ‏.‏

sunnah.com