Assalamualaikum w.b.t. Is it permissible for Muslims to eat mangrove worms or also known as temilok? Hope for an explanation. Thank you.
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions and all those who follow his footsteps until the Last Day.
We begin with the statement Allah SWT:
يَا أَيُّهَا الَّذِينَ آمَنُوا لَا تُحَرِّمُوا طَيِّبَاتِ مَا أَحَلَّ اللَّـهُ لَكُمْ وَلَا تَعْتَدُوا ۚ إِنَّ اللَّـهَ لَا يُحِبُّ الْمُعْتَدِينَ
“O you who have believed, do not prohibit the good things which Allah has made lawful to you and do not transgress. Indeed, Allah does not like transgressors.” 
The above verse contains reminders for believers to not prohibit anything that is good, which Allah SWT permits for them which includes food, drink and marrying women that constricts what Allah SWT has widened for them. Furthermore, this verse also reminds them to not transgress the limitations that Allah SWT has prohibited, for indeed, Allah SWT dislikes transgressors. 
Definition of Teredo Worm, Shipworm or Tamilok
Tamilok is a type of caterpillar or worm found in mangrove wood. In Sarawak, these caterpillars are not uncommon for residents in the Lundu area. The people there call these caterpillars the title of kejumah caterpillars. Those who first see this Tamilok, will definitely feel a little uncomfortable or amused because of its long and smooth shape. Tamilok also has a round eye section and a tail section that is shaped like two small bones. The diameter is about the size of a pen or a little bigger than that.
Tamilok is usually found in the roots of mangrove trees that have long been submerged in water or in mangrove trees that have fallen. Its habitat is in the mangrove swamp forest area. It can not only be found in Sarawak, but also in any mangrove swamp area in Asia. For example, in Papua New Guinea, the Philippines and even Australia. The name also varies by place. If in Papua, it is called tambelo. If in the Philippines, it is called tamiloc or tamilok while the people in Australia call it Mangrove Worms or Shipworms. The kejumah seekers will know the mangrove wood inhabited by this Tamilok based on the holes that were present when the wood was split.
These caterpillars can be eaten raw or cooked by stewing with lemongrass and spicy dishes. The filling is white and sometimes sucked and consumed just like that, it tastes as if a half-cooked chicken egg without the yolk filling. Not only is it loved by the Malays and Ibans, but it is also hunted by the Chinese community in the area. 
The ruling of eating Tamilok
The habitat is considered, tamilok is found in submerged woods and trees. Thus, it is considered as an aquatic animal. Regarding this matter, Dr Muhammad al-Zuhaili stated that aquatic animals are divided into two categories, the fish species that have the same physical attributes known to fish. It is halal to be eaten even if it dies without being slaughtered. This is based on the statement of Allah SWT:
أُحِلَّ لَكُمْ صَيْدُ الْبَحْرِ وَطَعَامُهُ مَتَاعًا لَّكُمْ وَلِلسَّيَّارَةِ
“Lawful to you is game from the sea and its food as provision for you and the travellers,” 
Likewise, there is a narration from Ibn Umar R.Anhuma, he said:
أُحِلَّت لَنا مَيتَتانِ ودَمانِ؛ الجَرادُ والحيتانُ، والكَبدُ والطِّحالُ
“Two types of animals which have died a natural death and two types of blood have been made allowable to us, the two which die a natural death being the fish and the locust, and the two types of blood being the liver and the spleen.” 
Second, aquatic animals that don’t have the physical attributes of a fish such as a capybara or seal. Scholars have differing opinions about animals in this category and the sahih opinion among scholars of madhhab al-Syafi’I is that all of them are halal to be eaten, without needing for them to be slaughtered. Thus, the carcass is halal to be eaten. The reason is the word al-Samak “السَّمَك” – is as stated in the hadith – refers to all aquatic animals.  It is included in the statement of Allah SWT:
أُحِلَّ لَكُمْ صَيْدُ الْبَحْرِ وَطَعَامُهُ
“Lawful to you is game from the sea and its food,” 
Likewise, there is a narration from Abu Hurairah RA, Rasullullah PBUH said:
هُوَ الطَّهُورُ مَاؤُهُ، الحِلُّ مَيْتَتُهُ
“Regarding the sea, “It’s water is purifying,” 
Hence, tamilok or teredo worm is considered a type of aquatic animal that is halal to be eaten without slaughtering as stated by scholars from madhhab Syafi’i. Moreover, the State of Sarawak Fatwa Committee has unanimously agreed on the following ruling:
- According to the jumhur of scholars (scholars of madhhab Syafi’I, Hanafi, Maliki and Hanbali) animals that live in water and cannot live without water are halal to be eaten based on the statement of Allah SWT in surah Fatir verse 12 and surah al-Ma’idah verse 96.
- According to hadith from Abu Hurairah narrated by al-Tarmizi it is explained that Allah SWT did not differentiate animals that humans named only as fish, however, it includes capybara that doesn’t refer to the swine.
- This shows that all the above evidences support all types of aquatic animals, regardless of whether they are caught or taken while they are alive or dead, all of them are halal.
- Hence, in line with the opinion of scholars that states animals that live in the sea and cannot live without water are halal to be eaten and this includes tamilok. 
According to the above discussion, in our opinion, tamilok or also known as teredo worm, shipworm or kejumah (in Malay) is permissible to be eaten because they are considered aquatic animals. Thus, they can be eaten without slaughter and their carcasses are pure just like fishes. This opinion is in line with the fatwa issued by the Sarawak Mufti State Department (JMNS) dated: 20th November 2014.
Moreover, it is said to have high nutritional value, and provide physical and mental energy in the form of glucose, glycogen and fat that develops stamina.
May Allah SWT grant us all a clear understanding in religion. Amin.
 Surah al-Maidah: 87
 See al-Tafsir al-Muyassar, pg. 122
 See https://www.iloveborneo.my/cerita-menarik-dari-borneo/temilok-kejumah-cacing-kayu-bakau-yang-enak-sebagai-alternatif-ulat-mulong/. Accessed on 10th February 2022.
 Surah al-Ma’idah: 96.
 Narrated by al-Baihaqi (1211) he stated al-Sunan al-Kabir, the sanad of hadith is sahih.
 See al-Mu‘tamad fi al-Fiqh al-Syafi‘i, 2/547-548; See al-Majmu‘ Syarh al-Muhazzab, 9/33-34.
 Surah al-Ma’idah: 96
 Narrated by Abu Daud (83); al-Tirmizi (69) dan al-Nasa’i (59)
 See https://muftinegeri.sarawak.gov.my/modules/web/pages.php?mod=news&sub=news_view&nid=156. Accessed on 10th February 2022.