WCU / Cybersecurity
~/CSC 471/Class 04/KP 06
Class 04 · KP 06 / 20

RVA vs File Offset

on disk (file offset)PointerToRawDataraw bytesin memory (RVA)VirtualAddressmapped bytesfileOffset = RVA − VirtualAddress + PointerToRawData
RVA-to-offset: the section table maps a memory address back to the file.

Two different address spaces describe the same file:

  • File offset (a.k.a. raw / physical offset): position of a byte on disk, from the start of the file.
  • RVA (Relative Virtual Address): offset from ImageBase once the file is loaded into memory.
  • VA (Virtual Address) = ImageBase + RVA.

They differ because SectionAlignment (memory) and

FileAlignment (disk) are usually different, so sections sit at

different positions on disk vs in memory.

Why analysts convert constantly

A directory entry gives you an RVA, but to read that data from the

file on disk you need the corresponding file offset.