<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>binary analysis - Hard Wired</title>
	<atom:link href="https://www.hardwired.dev/tag/binary-analysis/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.hardwired.dev</link>
	<description></description>
	<lastBuildDate>Sun, 28 Dec 2025 05:17:51 +0000</lastBuildDate>
	<language>cs</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.hardwired.dev/wp-content/uploads/2022/10/android-chrome-256x256-1-150x150.png</url>
	<title>binary analysis - Hard Wired</title>
	<link>https://www.hardwired.dev</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Portable Executable (PE) Format</title>
		<link>https://www.hardwired.dev/2025/12/01/portable-executable/</link>
		
		<dc:creator><![CDATA[Whizit]]></dc:creator>
		<pubDate>Mon, 01 Dec 2025 17:00:42 +0000</pubDate>
				<category><![CDATA[Cyber Security]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Různé]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[binary analysis]]></category>
		<category><![CDATA[code analysis]]></category>
		<category><![CDATA[COFF]]></category>
		<category><![CDATA[cybersecurity]]></category>
		<category><![CDATA[digital forensics]]></category>
		<category><![CDATA[dll files]]></category>
		<category><![CDATA[DOS header]]></category>
		<category><![CDATA[exe files]]></category>
		<category><![CDATA[executable files]]></category>
		<category><![CDATA[file headers]]></category>
		<category><![CDATA[file structure]]></category>
		<category><![CDATA[malware analysis]]></category>
		<category><![CDATA[Malware Development Essentials]]></category>
		<category><![CDATA[NT headers]]></category>
		<category><![CDATA[PE format]]></category>
		<category><![CDATA[PE-bear]]></category>
		<category><![CDATA[Portable Executable]]></category>
		<category><![CDATA[reverse engineering]]></category>
		<category><![CDATA[security-research]]></category>
		<category><![CDATA[threat analysis]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Windows OS]]></category>
		<guid isPermaLink="false">https://www.hardwired.dev/?p=2890</guid>

					<description><![CDATA[<p>Portable Executable is file format which is used in Windows OS for executable files like .exe, .dll, .cpl etc. It &#62;&#62;&#62;</p>
<p>The post <a href="https://www.hardwired.dev/2025/12/01/portable-executable/">Portable Executable (PE) Format</a> first appeared on <a href="https://www.hardwired.dev">Hard Wired</a>.</p>]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p><strong>Portable Executable</strong> is file format which is used in Windows OS for executable files like <em>.exe, .dll, .cpl etc</em>. It is based on <strong>COFF</strong> (<strong>Common Object File Format</strong>).</p>
<p>A PE file is a data structure that holds information necessary for OS loader to load that executable into memory and execute it.</p>
<p>This article serves as basic overview of PE structure, understanding of which is useful for reverse engineering and understanding not just malware binaries.</p>
<h2>Note</h2>
<p>Examples provided in this article will be taken from random executable file, opened using analytics tool named <a href="https://github.com/hasherezade/pe-bear/releases" title="PE-bear">PE-bear</a>.</p>
<p>Code examples are from winnt.h WinAPI file. You can download these files as part of Visual Studio.</p>
<h2>Structure</h2>
<p><img decoding="async" src="https://www.hardwired.dev/wp-content/uploads/2025/11/PEStructure-207x300.avif" alt="" /></p>
<h3>DOS Header</h3>
<p>Is represented by first 64 bytes of every PE file. Following parts are the most important:<br />
<strong>e_magic</strong> - Every PE File starts with 2 byte magic number <em>0x5A4D</em>. It is used to verify if it is valid executable. The value can be seen in reverse order in screenshot below, due to <em>Windows using little endian encoding</em><br />
<strong>e_lfanew</strong> - These 4 bytes contain the offset of PE header. When the program needs to be loaded by Windows loader, it looks for this value to skip the DOS Stub and go directly to NT headers.</p>
<p><img decoding="async" src="https://www.hardwired.dev/wp-content/uploads/2025/12/DOSHeader-300x87.avif" alt="" /></p>
<p><img decoding="async" src="https://www.hardwired.dev/wp-content/uploads/2025/12/DOSHeader_WinApi-PNG-300x176.avif" alt="" /></p>
<h3>DOS Stub</h3>
<p>Usually contains message <strong>&quot;This program cannot be run in DOS mode&quot;</strong>. It is used as fallback for older DOS systems that cannot process PE files.<br />
<img decoding="async" src="https://www.hardwired.dev/wp-content/uploads/2025/12/DOSStub-300x39.avif" alt="" /></p>
<h3>NT Headers</h3>
<p>Are accesssed from address in <em>e_lfanew</em></p>
<p><strong>Signature</strong> - Serves for checking validity of the structure, has value of <em>Ox4550</em> (PE)<br />
<strong>File Headers</strong> - Contains information about structure of the whole file, such as the machine type of the executable code, a time stamp, a pointer to symbol table and various flags. Value in machine type can help you determine whether the executable is 32(value 0x4c) or 64 bit (value 0x64)<br />
<strong>Optional Headers</strong> - Unlike name suggests, this header is not actually optional. It contains additional important information to <em>File Headers</em>, another magic number that determines whether file is 32/64bit, information about running subsystem, Preffered base address and security flags. Another important part is import,export, resource tables etc. which contain used APIs, imported functions, string and other static resources.<br />
<img decoding="async" src="https://www.hardwired.dev/wp-content/uploads/2025/12/32bitSignature-300x79.avif" alt="" /></p>
<h3>Section Header</h3>
<p>Is an array that contains memory locations for each section.</p>
<h3>Sections</h3>
<p><strong>.text</strong> - Contains the executable code. This section includes all compiled instructions that the processor will execute. The section is typically marked as executable and read-only for security purposes.</p>
<p><strong>.data</strong> - Contains initialized global data. This includes variables with initial values that the program requires during execution. The section is marked as readable and writable.</p>
<p><strong>.rdata</strong> - Contains read-only data, including import and export tables. It stores constant data, string literals, and critical tables that support dynamic linking functionality.</p>
<p><strong>.rsrc</strong> - Contains resources such as icons, images, and strings. This section organizes resources in a hierarchical structure that applications can access during runtime.</p>
<p><strong>.reloc</strong> - Contains relocation table that is used by loader for recalculating addresses in case the executable is not loaded at base address.</p>
<p><strong>.tls</strong>(Thread Local Storage)- is a special storage  class that contains thread specific data.</p>
<p><em>This list of sections is not exhaustive, just explains the most common ones.</em></p>
<p>When analyzing PE file, <em>malicious executables can have unusually small or large headers or sections</em>. Unusually large header can be a <em>sign of obfuscation</em> and for example small or empty import table can be sign of <em>dynamic loading</em> of libraries which is common for malware.</p>

<div class="twitter-share"><a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.hardwired.dev%2F2025%2F12%2F01%2Fportable-executable%2F&#038;via=hessevalentino" class="twitter-share-button">Tweet</a></div><p>The post <a href="https://www.hardwired.dev/2025/12/01/portable-executable/">Portable Executable (PE) Format</a> first appeared on <a href="https://www.hardwired.dev">Hard Wired</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
