{"id":{"repo_id":"uoit","oai_identifier":"oai:ontariotechu.scholaris.ca:10155/2163"},"canonical_url":"https://search.ndltd.org/etd/uoit/oai:ontariotechu.scholaris.ca:10155/2163","repository":{"repo_id":"uoit","name":"Ontario Institute of Technology","base_url":"https://ontariotechu.scholaris.ca/server/oai/request"},"display":{"title":"Can LLM-based code mutation power the next generation of metamorphic malware?","abstract":"Metamorphic malware evades detection by rewriting its own code while preserving its malicious functionality. Traditional mutation engines rely on fixed, hand-crafted rule sets that defenders can eventually catalog and counter. Large language models trained for code synthesis can automate the mutation processed with a diversity that rule-based engines cannot match; such automation undermines detection that depends on recognizing known patterns. This thesis investigates LLM-based code mutation as an emerging threat to malware detection. We formalize code mutation as a learning task distinct from code generation and introduce mutate@k, a metric that jointly measures the functional correctness and structural diversity of generated codes using LLMs. Guided by a proposed taxonomy of behavior-preserving transformations, we build a large-scale mutation corpus and use it to fine-tune several open-source code LLMs, improving their mutate@k by up to 21.2 percentage points while retaining general code generation ability. To measure the security impact, we develop Morphic, a platform that applies the fine-tuned models to real malware and tracks detection over time. Across samples in several scripting languages, the mutated variants achieve a mean first-scan evasion rate of 78.7% against commercial detection engines, with more heavily mutated variants remaining undetected for extended periods. These results give empirical weight to a largely speculative threat and motivate detection approaches resilient to automated, LLM-driven code transformation.","abstract_html":"Metamorphic malware evades detection by rewriting its own code while preserving its malicious functionality. Traditional mutation engines rely on fixed, hand-crafted rule sets that defenders can eventually catalog and counter. Large language models trained for code synthesis can automate the mutation processed with a diversity that rule-based engines cannot match; such automation undermines detection that depends on recognizing known patterns. This thesis investigates LLM-based code mutation as an emerging threat to malware detection. We formalize code mutation as a learning task distinct from code generation and introduce mutate@k, a metric that jointly measures the functional correctness and structural diversity of generated codes using LLMs. Guided by a proposed taxonomy of behavior-preserving transformations, we build a large-scale mutation corpus and use it to fine-tune several open-source code LLMs, improving their mutate@k by up to 21.2 percentage points while retaining general code generation ability. To measure the security impact, we develop Morphic, a platform that applies the fine-tuned models to real malware and tracks detection over time. Across samples in several scripting languages, the mutated variants achieve a mean first-scan evasion rate of 78.7% against commercial detection engines, with more heavily mutated variants remaining undetected for extended periods. These results give empirical weight to a largely speculative threat and motivate detection approaches resilient to automated, LLM-driven code transformation.","abstract_has_math":false,"creators":["Setak, Mohammadhossein"],"institution":"University of Ontario Institute of Technology","degree_name":"Master of Science (MSc)","degree_level":null,"degree_discipline":"Computer Science","degree_department":null,"school":null,"contributors":[],"advisors":["Madani, Pooria"],"committee_chairs":[],"committee_members":[],"year":2026,"date_issued":"2026-08-01","date_published":"2026-08-01","updated_at":"2026-11-19T09:02:19Z","subjects":["Code mutation","Large language models","Metamorphic malware","Malware detection","Code generation"],"languages":["en"],"rights":[],"rights_urls":[],"identifier_entries":[],"person_identifier_entries":[]},"links":{"outbound_url":"https://hdl.handle.net/10155/2163","outbound_label":"Handle","outbound_source":"dc:identifier.uri","record_url":"https://hdl.handle.net/10155/2163","record_label":"Repository record","record_kind":"handle","record_source":"dc:identifier.uri","access_status":null,"embargo_until":null,"access_note":null},"oai_pmh_record":{"url":"https://union.ndltd.org/oai-pmh/?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai%3Aunion.ndltd.org%3Arepo%3Auoit%3Aoai%3Aontariotechu.scholaris.ca%3A10155%2F2163","prefix":"oai_dc"},"source_record":{"url":"https://ontariotechu.scholaris.ca/server/oai/request?verb=GetRecord&metadataPrefix=dim&identifier=oai%3Aontariotechu.scholaris.ca%3A10155%2F2163","prefix":"dim"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor.advisor","label":"Advisor","values":["Madani, Pooria"]},{"key":"dc:creator","label":"Author","values":["Setak, Mohammadhossein"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date.accessioned","label":"Dc Date Accessioned","values":["2026-09-14T19:13:00Z"]},{"key":"dc:date.issued","label":"Date","values":["2026-08-01"]},{"key":"dc:type","label":"Dc Type","values":["Thesis"]},{"key":"thesis:degree_discipline","label":"Discipline","values":["Computer Science"]},{"key":"thesis:degree_name","label":"Degree Name","values":["Master of Science (MSc)"]},{"key":"thesis:institution_name","label":"Thesis Institution Name","values":["University of Ontario Institute of Technology"]}]},{"id":"subjects_keywords","label":"Subjects and Keywords","entries":[{"key":"dc:subject.other","label":"Dc Subject Other","values":["Code mutation","Large language models","Metamorphic malware","Malware detection","Code generation"]}]},{"id":"language_rights","label":"Language and Rights","entries":[{"key":"dc:language.iso","label":"Language (ISO)","values":["en"]}]},{"id":"identifiers","label":"Identifiers","entries":[{"key":"dc:identifier.uri","label":"Identifier URI","values":["https://hdl.handle.net/10155/2163"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description.abstract","label":"Abstract","values":["Metamorphic malware evades detection by rewriting its own code while preserving its malicious functionality. Traditional mutation engines rely on fixed, hand-crafted rule sets that defenders can eventually catalog and counter. Large language models trained for code synthesis can automate the mutation processed with a diversity that rule-based engines cannot match; such automation undermines detection that depends on recognizing known patterns. This thesis investigates LLM-based code mutation as an emerging threat to malware detection. We formalize code mutation as a learning task distinct from code generation and introduce mutate@k, a metric that jointly measures the functional correctness and structural diversity of generated codes using LLMs. Guided by a proposed taxonomy of behavior-preserving transformations, we build a large-scale mutation corpus and use it to fine-tune several open-source code LLMs, improving their mutate@k by up to 21.2 percentage points while retaining general code generation ability. To measure the security impact, we develop Morphic, a platform that applies the fine-tuned models to real malware and tracks detection over time. Across samples in several scripting languages, the mutated variants achieve a mean first-scan evasion rate of 78.7% against commercial detection engines, with more heavily mutated variants remaining undetected for extended periods. These results give empirical weight to a largely speculative threat and motivate detection approaches resilient to automated, LLM-driven code transformation."]},{"key":"dc:title","label":"Title","values":["Can LLM-based code mutation power the next generation of metamorphic malware?"]},{"key":"others:access_status","label":"Others Access Status","values":["open.access"]}]}],"canonical_facts":{"dc:contributor.advisor":["Madani, Pooria"],"dc:creator":["Setak, Mohammadhossein"],"dc:date.accessioned":["2026-09-14T19:13:00Z"],"dc:date.issued":["2026-08-01"],"dc:description.abstract":["Metamorphic malware evades detection by rewriting its own code while preserving its malicious functionality. Traditional mutation engines rely on fixed, hand-crafted rule sets that defenders can eventually catalog and counter. Large language models trained for code synthesis can automate the mutation processed with a diversity that rule-based engines cannot match; such automation undermines detection that depends on recognizing known patterns. This thesis investigates LLM-based code mutation as an emerging threat to malware detection. We formalize code mutation as a learning task distinct from code generation and introduce mutate@k, a metric that jointly measures the functional correctness and structural diversity of generated codes using LLMs. Guided by a proposed taxonomy of behavior-preserving transformations, we build a large-scale mutation corpus and use it to fine-tune several open-source code LLMs, improving their mutate@k by up to 21.2 percentage points while retaining general code generation ability. To measure the security impact, we develop Morphic, a platform that applies the fine-tuned models to real malware and tracks detection over time. Across samples in several scripting languages, the mutated variants achieve a mean first-scan evasion rate of 78.7% against commercial detection engines, with more heavily mutated variants remaining undetected for extended periods. These results give empirical weight to a largely speculative threat and motivate detection approaches resilient to automated, LLM-driven code transformation."],"dc:identifier.uri":["https://hdl.handle.net/10155/2163"],"dc:language.iso":["en"],"dc:subject.other":["Code mutation","Large language models","Metamorphic malware","Malware detection","Code generation"],"dc:title":["Can LLM-based code mutation power the next generation of metamorphic malware?"],"dc:type":["Thesis"],"others:access_status":["open.access"],"thesis:degree_discipline":["Computer Science"],"thesis:degree_name":["Master of Science (MSc)"],"thesis:institution_name":["University of Ontario Institute of Technology"]},"updated_at":"2026-11-19T09:02:19Z"}