In YARA 3.8.1, bytecode in a specially crafted compiled rule is exposed to information about its environment, in libyara/exec.c. This is a consequence of the design of the YARA virtual machine.
https://github.com/bnbdr/swisscheese/
https://github.com/VirusTotal/yara/issues/999