Saved in:
Bibliographic Details
Main Authors: De Tomasi, Lorenzo, Di Sipio, Claudio, Di Marco, Antinisca, Nguyen, Phuong T.
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2504.14024
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908326629998592
author De Tomasi, Lorenzo
Di Sipio, Claudio
Di Marco, Antinisca
Nguyen, Phuong T.
author_facet De Tomasi, Lorenzo
Di Sipio, Claudio
Di Marco, Antinisca
Nguyen, Phuong T.
contents Code obfuscation is the conversion of original source code into a functionally equivalent but less readable form, aiming to prevent reverse engineering and intellectual property theft. This is a challenging task since it is crucial to maintain functional correctness of the code while substantially disguising the input code. The recent development of large language models (LLMs) paves the way for practical applications in different domains, including software engineering. This work performs an empirical study on the ability of LLMs to obfuscate Python source code and introduces a metric (i.e., semantic elasticity) to measure the quality degree of obfuscated code. We experimented with 3 leading LLMs, i.e., Claude-3.5-Sonnet, Gemini-1.5, GPT-4-Turbo across 30 Python functions from diverse computational domains. Our findings reveal GPT-4-Turbo's remarkable effectiveness with few-shot prompting (81% pass rate versus 29% standard prompting), significantly outperforming both Gemini-1.5 (39%) and Claude-3.5-Sonnet (30%). Notably, we discovered a counter-intuitive "obfuscation by simplification" phenomenon where models consistently reduce rather than increase cyclomatic complexity. This study provides a methodological framework for evaluating AI-driven obfuscation while highlighting promising directions for leveraging LLMs in software security.
format Preprint
id arxiv_https___arxiv_org_abs_2504_14024
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Simplicity by Obfuscation: Evaluating LLM-Driven Code Transformation with Semantic Elasticity
De Tomasi, Lorenzo
Di Sipio, Claudio
Di Marco, Antinisca
Nguyen, Phuong T.
Software Engineering
Code obfuscation is the conversion of original source code into a functionally equivalent but less readable form, aiming to prevent reverse engineering and intellectual property theft. This is a challenging task since it is crucial to maintain functional correctness of the code while substantially disguising the input code. The recent development of large language models (LLMs) paves the way for practical applications in different domains, including software engineering. This work performs an empirical study on the ability of LLMs to obfuscate Python source code and introduces a metric (i.e., semantic elasticity) to measure the quality degree of obfuscated code. We experimented with 3 leading LLMs, i.e., Claude-3.5-Sonnet, Gemini-1.5, GPT-4-Turbo across 30 Python functions from diverse computational domains. Our findings reveal GPT-4-Turbo's remarkable effectiveness with few-shot prompting (81% pass rate versus 29% standard prompting), significantly outperforming both Gemini-1.5 (39%) and Claude-3.5-Sonnet (30%). Notably, we discovered a counter-intuitive "obfuscation by simplification" phenomenon where models consistently reduce rather than increase cyclomatic complexity. This study provides a methodological framework for evaluating AI-driven obfuscation while highlighting promising directions for leveraging LLMs in software security.
title Simplicity by Obfuscation: Evaluating LLM-Driven Code Transformation with Semantic Elasticity
topic Software Engineering
url https://arxiv.org/abs/2504.14024