---
id: 5119
title: "Guide to P-code Injection: Changing the intermediate representation of code on the fly in Ghidra"
source_domain: swarm.ptsecurity.com
source_url: "https://swarm.ptsecurity.com/guide-to-p-code-injection/"
published_at: "2021-06-02T14:37:12Z"
tags: ["reverse-engineering", "ghidra", "research", "tooling"]
phying_url: "https://phying.com/item/5119"
lang: en
---

# Guide to P-code Injection: Changing the intermediate representation of code on the fly in Ghidra

## Summary

A guide to Ghidra's p-code injection mechanism: for opcodes that are impractical to express in SLEIGH, Java callbacks can generate p-code dynamically at analysis time — illustrated by implementing V8's variable-argument CallRuntime opcode in the ghidra_nodejs plugin.

## Intelligence Metadata

- **Sources:** swarm.ptsecurity.com
- **Published:** 2021-06-02T14:37:12Z
- **Original:** https://swarm.ptsecurity.com/guide-to-p-code-injection/
- **Phying News:** https://phying.com/item/5119
