Smart contracts are like small applications that manage money on blockchains. But sometimes they have security issues, especially in access management. Traditional methods use syntax trees or flow graphs, but they can't always capture logic and meaning well. Knowledge graphs are different: they represent entities and relationships in a structured way, making it easier to understand code. A new tool called CKG-LLM uses large language models to turn natural language descriptions of vulnerabilities into executable queries on these graphs. This allows automatically finding risky code parts. Experiments show that CKG-LLM works better than old systems. In the future it could be used for other types of smart contracts.
Knowledge graphs offer a promising alternative to traditional representations such as abstract syntax trees (AST), control flow graphs (CFG), and static single assignment form (SSA). While these structures capture syntactic or flow aspects, knowledge graphs integrate semantics and logical structure, enabling complex queries through dedicated languages. CKG-LLM leverages the reasoning and code generation capabilities of Large Language Models (LLMs) to convert vulnerability patterns expressed in natural language into executable queries on smart contract knowledge graphs. This hybrid approach combines the semantic interpretation of LLMs with the precision of graph queries, improving the identification of vulnerable code elements. Experimental evaluations indicate superior performance compared to existing tools, opening new possibilities for automated security analysis.
