Skip to content

Commit 99d32ba

Browse files
committed
empty commit
1 parent c3d9083 commit 99d32ba

2 files changed

Lines changed: 130 additions & 2 deletions

File tree

content/posts/tuxedos.md

Lines changed: 129 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,135 @@ hideComments = false
1515

1616
# Background
1717

18-
First windows now it's time for the penguin! Unlike windows, Linux has a more direct approach for doing things like manipulating memory or linking libraries or you don't need to call 3+ api functions to do something like process injection.
18+
First windows now it's time for the penguin! Unlike windows, Linux has a more direct approach for doing things like manipulating memory or linking libraries or you don't need to call 3+ API functions to do something like process injection.
19+
20+
# Fundamentals
21+
22+
## Memory
23+
24+
Everyone knows things like RAM but what about the other memory in the system?
25+
26+
### Primary
27+
28+
* Your RAM and ROM (read only memory)
29+
* Disposable/wiped after a reboot.
30+
* Fast readily available for programs
31+
32+
#### ROM
33+
34+
* Read only.
35+
* BIOS level.
36+
* Smaller chip.
37+
* Provides all boot instructions and firmware.
38+
39+
----------------------
40+
41+
#### Register memory
42+
43+
* storage locations on the CPU that store temporary data.
44+
* Faster than RAM.
45+
* Important instructions
46+
* each register typically holds between 32 and 64 bits of data.
47+
* THIS IS NOT CACHE MEMORY!!
48+
49+
##### Data Register
50+
51+
* 16 bit register that holds variables.
52+
* Temporary holding place for data.
53+
54+
##### Program Counter Register (PC Register)
55+
56+
* Memory address for next set of instructions in the program.
57+
* Keeps proper sequence in the program.
58+
59+
##### Instruction Register
60+
61+
* 16 bit register that contains the current instruction code from the main memory (RAM).
62+
* This is what the CPU actually executes.
63+
64+
##### Address Register
65+
66+
* 12 bit register for address location.
67+
* CPU fetches and handles instructions from this.
68+
69+
##### I/O Address Register
70+
71+
* unique address with an input or output device like a keyboard or audio.
72+
* CPU uses this to interact with other devices.
73+
74+
##### I/O Buffer Register
75+
76+
* temporary buffer for the I/O Address Register to exchange and hold data.
77+
* Deals with before and after processing.
78+
79+
----------------------
80+
81+
#### Cache Memory
82+
83+
* Fast but small.
84+
* Typically old memory.
85+
* CPU checks the cache first (a cache hit) before reading the RAM (a cache miss if not in cache).
86+
87+
##### L1 (Level 1 Cache)
88+
89+
* First level in the CPU.
90+
* Ranges from 2KB to 64KB in size.
91+
* Every core has this.
92+
93+
##### L2 (Level 2 Cache)
94+
95+
* Might not be present in the CPU.
96+
* 2 cores may share it.
97+
* 256KB to 512KB in size.
98+
99+
##### L3 (Level 3 Cache)
100+
101+
* Shared by all cores and present outside of the CPU.
102+
* Ranges from 1MB to 8MB in size.
103+
104+
----------------------
105+
106+
### Secondary
107+
108+
* Optical Disks
109+
* Flash memory
110+
* Slower than primary
111+
* Persistent
112+
113+
### Sources
114+
115+
* <https://www.geeksforgeeks.org/computer-organization-architecture/introduction-to-memory-and-memory-units/>
116+
* <https://www.geeksforgeeks.org/computer-organization-architecture/memory-hierarchy-design-and-its-characteristics/>
117+
* <https://www.geeksforgeeks.org/computer-science-fundamentals/cache-memory/>
118+
119+
## Assembly
120+
121+
Just kidding lol, I won't have notes on assembly, resources bellow already did it.
122+
123+
### Sources
124+
125+
* <https://c9x.me/articles/gthreads/mach.html>
126+
* <https://cs4157.github.io/www/2024-1/lect/13-x86-assembly.html>
127+
128+
## Memory Management in Linux
129+
130+
### Virtual Memory
131+
132+
* A technique that allows for Linux to use more memory than physically available.
133+
* Uses disk storage as an extension.
134+
* Allows for multitasking and memory isolation between processes.
135+
136+
#### Virtual address space
137+
138+
* text segment: contains actual code for a program.
139+
* Data segment: stores variables.
140+
* Heap: dynamically allocated memory region that can grow.
141+
* Stack: all function call frames, local variables, and control flow data.
142+
The flow of the virtual address space goes downwards meaning the stack interacts with the heap then data, then code.
143+
144+
### Sources
145+
146+
* <https://infosecbytes.io/linux-internals-a-deep-dive-into-memory-management/>
19147

20148
# Process Injection
21149

public/index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<link>//localhost:1313/posts/tuxedos/</link>
1414
<pubDate>Sat, 24 Jan 2026 00:08:40 -0700</pubDate>
1515
<guid>//localhost:1313/posts/tuxedos/</guid>
16-
<description>&lt;h1 id=&#34;background&#34;&gt;Background&lt;/h1&gt;&#xA;&lt;p&gt;First windows now it&amp;rsquo;s time for the penguin! Unlike windows, Linux has a more direct approach for doing things like manipulating memory or linking libraries or you don&amp;rsquo;t need to call 3+ api functions to do something like process injection.&lt;/p&gt;&#xA;&lt;h1 id=&#34;process-injection&#34;&gt;Process Injection&lt;/h1&gt;&#xA;&lt;h2 id=&#34;background-and-important&#34;&gt;Background and important&lt;/h2&gt;&#xA;&lt;p&gt;In Linux there&amp;rsquo;s no possible way to allocate more memory to a process meaning if the original process isn&amp;rsquo;t restored it&amp;rsquo;ll crash.&lt;/p&gt;&#xA;&lt;h2 id=&#34;system-calls-and-methods&#34;&gt;System Calls and Methods&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;ptrace&lt;/code&gt;: debugs a remote process meaning memory on that process can be changed and inspected.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;procfs&lt;/code&gt;: a filesystem that shows the interfaces for running processes (literally in &lt;code&gt;/proc&lt;/code&gt; on Linux).&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Processes are typically directories represented by their PIDs.&lt;/li&gt;&#xA;&lt;li&gt;Inside of the PIDs is the mem file that shows the memory address and space for that process.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;process_vm_writev&lt;/code&gt;: allows for modifying data space of the remote process.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This syscall receives a pointer and copies it to the specified location in the remote process.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-elephant-in-the-room&#34;&gt;The Elephant In The Room&lt;/h3&gt;&#xA;&lt;p&gt;All this is neat and all but how do things like the &lt;code&gt;ps&lt;/code&gt; command get all of the processes and memory in Linux? Well it actually reads them from the &lt;code&gt;/proc&lt;/code&gt; directory on the Linux filesystem!&lt;/p&gt;</description>
16+
<description>&lt;h1 id=&#34;background&#34;&gt;Background&lt;/h1&gt;&#xA;&lt;p&gt;First windows now it&amp;rsquo;s time for the penguin! Unlike windows, Linux has a more direct approach for doing things like manipulating memory or linking libraries or you don&amp;rsquo;t need to call 3+ API functions to do something like process injection.&lt;/p&gt;&#xA;&lt;h1 id=&#34;fundamentals&#34;&gt;Fundamentals&lt;/h1&gt;&#xA;&lt;h2 id=&#34;memory&#34;&gt;Memory&lt;/h2&gt;&#xA;&lt;p&gt;Everyone knows things like RAM but what about the other memory in the system?&lt;/p&gt;&#xA;&lt;h3 id=&#34;primary&#34;&gt;Primary&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Your RAM and ROM (read only memory)&lt;/li&gt;&#xA;&lt;li&gt;Disposable/wiped after a reboot.&lt;/li&gt;&#xA;&lt;li&gt;Fast readily available for programs&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;rom&#34;&gt;ROM&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Read only.&lt;/li&gt;&#xA;&lt;li&gt;BIOS level.&lt;/li&gt;&#xA;&lt;li&gt;Smaller chip.&lt;/li&gt;&#xA;&lt;li&gt;Provides all boot instructions and firmware.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h4 id=&#34;register-memory&#34;&gt;Register memory&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;storage locations on the CPU that store temporary data.&lt;/li&gt;&#xA;&lt;li&gt;Faster than RAM.&lt;/li&gt;&#xA;&lt;li&gt;Important instructions&lt;/li&gt;&#xA;&lt;li&gt;each register typically holds between 32 and 64 bits of data.&lt;/li&gt;&#xA;&lt;li&gt;THIS IS NOT CACHE MEMORY!!&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;data-register&#34;&gt;Data Register&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;16 bit register that holds variables.&lt;/li&gt;&#xA;&lt;li&gt;Temporary holding place for data.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;program-counter-register-pc-register&#34;&gt;Program Counter Register (PC Register)&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Memory address for next set of instructions in the program.&lt;/li&gt;&#xA;&lt;li&gt;Keeps proper sequence in the program.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;instruction-register&#34;&gt;Instruction Register&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;16 bit register that contains the current instruction code from the main memory (RAM).&lt;/li&gt;&#xA;&lt;li&gt;This is what the CPU actually executes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;address-register&#34;&gt;Address Register&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;12 bit register for address location.&lt;/li&gt;&#xA;&lt;li&gt;CPU fetches and handles instructions from this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;io-address-register&#34;&gt;I/O Address Register&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;unique address with an input or output device like a keyboard or audio.&lt;/li&gt;&#xA;&lt;li&gt;CPU uses this to interact with other devices.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;io-buffer-register&#34;&gt;I/O Buffer Register&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;temporary buffer for the I/O Address Register to exchange and hold data.&lt;/li&gt;&#xA;&lt;li&gt;Deals with before and after processing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h4 id=&#34;cache-memory&#34;&gt;Cache Memory&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Fast but small.&lt;/li&gt;&#xA;&lt;li&gt;Typically old memory.&lt;/li&gt;&#xA;&lt;li&gt;CPU checks the cache first (a cache hit) before reading the RAM (a cache miss if not in cache).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;l1-level-1-cache&#34;&gt;L1 (Level 1 Cache)&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;First level in the CPU.&lt;/li&gt;&#xA;&lt;li&gt;Ranges from 2KB to 64KB in size.&lt;/li&gt;&#xA;&lt;li&gt;Every core has this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;l2-level-2-cache&#34;&gt;L2 (Level 2 Cache)&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Might not be present in the CPU.&lt;/li&gt;&#xA;&lt;li&gt;2 cores may share it.&lt;/li&gt;&#xA;&lt;li&gt;256KB to 512KB in size.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h5 id=&#34;l3-level-3-cache&#34;&gt;L3 (Level 3 Cache)&lt;/h5&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Shared by all cores and present outside of the CPU.&lt;/li&gt;&#xA;&lt;li&gt;Ranges from 1MB to 8MB in size.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h3 id=&#34;secondary&#34;&gt;Secondary&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Optical Disks&lt;/li&gt;&#xA;&lt;li&gt;Flash memory&lt;/li&gt;&#xA;&lt;li&gt;Slower than primary&lt;/li&gt;&#xA;&lt;li&gt;Persistent&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;sources&#34;&gt;Sources&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.geeksforgeeks.org/computer-organization-architecture/introduction-to-memory-and-memory-units/&#34;&gt;https://www.geeksforgeeks.org/computer-organization-architecture/introduction-to-memory-and-memory-units/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.geeksforgeeks.org/computer-organization-architecture/memory-hierarchy-design-and-its-characteristics/&#34;&gt;https://www.geeksforgeeks.org/computer-organization-architecture/memory-hierarchy-design-and-its-characteristics/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.geeksforgeeks.org/computer-science-fundamentals/cache-memory/&#34;&gt;https://www.geeksforgeeks.org/computer-science-fundamentals/cache-memory/&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;assembly&#34;&gt;Assembly&lt;/h2&gt;&#xA;&lt;p&gt;Just kidding lol, I won&amp;rsquo;t have notes on assembly, resources bellow already did it.&lt;/p&gt;</description>
1717
</item>
1818
<item>
1919
<title>Malware101</title>

0 commit comments

Comments
 (0)