Skip to content

Commit

Permalink
Deploying to gh-pages from @ 42f3f0b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Apr 4, 2024
1 parent 0232bb9 commit 9e4f5c7
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 162 deletions.
4 changes: 2 additions & 2 deletions globals.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<li>__attribute__()
: <a class="el" href="xzre_8h.html#ab898071398b359603a35c202e9c65f3b">xzre.h</a>
</li>
<li>elf_contains_segment()
: <a class="el" href="xzre_8h.html#a484c7f2d91a4774ef5c9de803c9fcfa5">xzre.h</a>
<li>elf_contains_vaddr()
: <a class="el" href="xzre_8h.html#a2a09d15b1c506e0f29ee9433771ad8db">xzre.h</a>
</li>
<li>elf_get_code_segment()
: <a class="el" href="xzre_8h.html#af3f0d23e5fece210bdf4945c65e3a10a">xzre.h</a>
Expand Down
4 changes: 2 additions & 2 deletions globals_func.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<li>__attribute__()
: <a class="el" href="xzre_8h.html#ab898071398b359603a35c202e9c65f3b">xzre.h</a>
</li>
<li>elf_contains_segment()
: <a class="el" href="xzre_8h.html#a484c7f2d91a4774ef5c9de803c9fcfa5">xzre.h</a>
<li>elf_contains_vaddr()
: <a class="el" href="xzre_8h.html#a2a09d15b1c506e0f29ee9433771ad8db">xzre.h</a>
</li>
<li>elf_get_code_segment()
: <a class="el" href="xzre_8h.html#af3f0d23e5fece210bdf4945c65e3a10a">xzre.h</a>
Expand Down
2 changes: 1 addition & 1 deletion search/all_2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var searchData=
[
['elf_5fcontains_5fsegment_3',['elf_contains_segment',['../xzre_8h.html#a484c7f2d91a4774ef5c9de803c9fcfa5',1,'xzre.h']]],
['elf_5fcontains_5fvaddr_3',['elf_contains_vaddr',['../xzre_8h.html#a2a09d15b1c506e0f29ee9433771ad8db',1,'xzre.h']]],
['elf_5fget_5fcode_5fsegment_4',['elf_get_code_segment',['../xzre_8h.html#af3f0d23e5fece210bdf4945c65e3a10a',1,'xzre.h']]],
['elf_5fparse_5',['elf_parse',['../xzre_8h.html#a049328971f4e99ce954d5e0346fee6d7',1,'xzre.h']]],
['elf_5fsymbol_5fget_6',['elf_symbol_get',['../xzre_8h.html#ac0a43ada7f303cb88b9c4b48a17b5154',1,'xzre.h']]],
Expand Down
2 changes: 1 addition & 1 deletion search/functions_1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var searchData=
[
['elf_5fcontains_5fsegment_24',['elf_contains_segment',['../xzre_8h.html#a484c7f2d91a4774ef5c9de803c9fcfa5',1,'xzre.h']]],
['elf_5fcontains_5fvaddr_24',['elf_contains_vaddr',['../xzre_8h.html#a2a09d15b1c506e0f29ee9433771ad8db',1,'xzre.h']]],
['elf_5fget_5fcode_5fsegment_25',['elf_get_code_segment',['../xzre_8h.html#af3f0d23e5fece210bdf4945c65e3a10a',1,'xzre.h']]],
['elf_5fparse_26',['elf_parse',['../xzre_8h.html#a049328971f4e99ce954d5e0346fee6d7',1,'xzre.h']]],
['elf_5fsymbol_5fget_27',['elf_symbol_get',['../xzre_8h.html#ac0a43ada7f303cb88b9c4b48a17b5154',1,'xzre.h']]],
Expand Down
34 changes: 19 additions & 15 deletions xzre_8h.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@
<tr class="memitem:ac4c84e3eaafa66db192ff467575c07ef"><td class="memItemLeft" align="right" valign="top"><a id="ac4c84e3eaafa66db192ff467575c07ef"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>assert_offset</b> (imported_funcs_t, RSA_public_decrypt, 0)</td></tr>
<tr class="separator:ac4c84e3eaafa66db192ff467575c07ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad7615b76f76544beead47d64ef914859"><td class="memItemLeft" align="right" valign="top"><a id="ad7615b76f76544beead47d64ef914859"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>assert_offset</b> (imported_funcs_t, EVP_sha256, 0x58)</td></tr>
<tr class="separator:ad7615b76f76544beead47d64ef914859"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaace0e1ca20316181905ff732b2eb0fb"><td class="memItemLeft" align="right" valign="top"><a id="aaace0e1ca20316181905ff732b2eb0fb"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>assert_offset</b> (imported_funcs_t, RSA_get0_key, 0x60)</td></tr>
<tr class="separator:aaace0e1ca20316181905ff732b2eb0fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
Expand Down Expand Up @@ -434,9 +437,9 @@
<tr class="memitem:a5b09699385091684d71bf8a278e0372d"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xzre_8h.html#a5b09699385091684d71bf8a278e0372d">find_function_prologue_ex</a> (u8 *code_start, u8 *func_start_0, u8 *func_start_1, u8 *search_base, u8 *code_end, FuncFindType find_mode)</td></tr>
<tr class="memdesc:a5b09699385091684d71bf8a278e0372d"><td class="mdescLeft">&#160;</td><td class="mdescRight">locates the function prologue. it will try to backtrack and synchronize the code stream, calling <a class="el" href="xzre_8h.html#a81a6f3d01ea6057c942052321b92c533">find_function_prologue</a> for each iteration <a href="xzre_8h.html#a5b09699385091684d71bf8a278e0372d">More...</a><br /></td></tr>
<tr class="separator:a5b09699385091684d71bf8a278e0372d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a484c7f2d91a4774ef5c9de803c9fcfa5"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xzre_8h.html#a484c7f2d91a4774ef5c9de803c9fcfa5">elf_contains_segment</a> (elf_info_t *elf_info, u64 vaddr, u64 size, u32 p_flags)</td></tr>
<tr class="memdesc:a484c7f2d91a4774ef5c9de803c9fcfa5"><td class="mdescLeft">&#160;</td><td class="mdescRight">checks if given ELF file contains an elf segment with the given parameters <a href="xzre_8h.html#a484c7f2d91a4774ef5c9de803c9fcfa5">More...</a><br /></td></tr>
<tr class="separator:a484c7f2d91a4774ef5c9de803c9fcfa5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a09d15b1c506e0f29ee9433771ad8db"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xzre_8h.html#a2a09d15b1c506e0f29ee9433771ad8db">elf_contains_vaddr</a> (elf_info_t *elf_info, u64 vaddr, u64 size, u32 p_flags)</td></tr>
<tr class="memdesc:a2a09d15b1c506e0f29ee9433771ad8db"><td class="mdescLeft">&#160;</td><td class="mdescRight">checks if given ELF file contains the range [vaddr, vaddr+size) in a segment with the specified memory protection flags <a href="xzre_8h.html#a2a09d15b1c506e0f29ee9433771ad8db">More...</a><br /></td></tr>
<tr class="separator:a2a09d15b1c506e0f29ee9433771ad8db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a049328971f4e99ce954d5e0346fee6d7"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xzre_8h.html#a049328971f4e99ce954d5e0346fee6d7">elf_parse</a> (Elf64_Ehdr *ehdr, elf_info_t *elf_info)</td></tr>
<tr class="memdesc:a049328971f4e99ce954d5e0346fee6d7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parses the given in-memory ELF file into elf_info. <a href="xzre_8h.html#a049328971f4e99ce954d5e0346fee6d7">More...</a><br /></td></tr>
<tr class="separator:a049328971f4e99ce954d5e0346fee6d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
Expand All @@ -450,7 +453,7 @@
<tr class="memdesc:af3f0d23e5fece210bdf4945c65e3a10a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtains the address and size of the first executable page in the given ELF file. <a href="xzre_8h.html#af3f0d23e5fece210bdf4945c65e3a10a">More...</a><br /></td></tr>
<tr class="separator:af3f0d23e5fece210bdf4945c65e3a10a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc618a02e31b94194ce03b0c4a2b3597"><td class="memItemLeft" align="right" valign="top">lzma_allocator *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xzre_8h.html#abc618a02e31b94194ce03b0c4a2b3597">get_lzma_allocator</a> ()</td></tr>
<tr class="memdesc:abc618a02e31b94194ce03b0c4a2b3597"><td class="mdescLeft">&#160;</td><td class="mdescRight">gets the fake LZMA allocator, used for imports resolution <a href="xzre_8h.html#abc618a02e31b94194ce03b0c4a2b3597">More...</a><br /></td></tr>
<tr class="memdesc:abc618a02e31b94194ce03b0c4a2b3597"><td class="mdescLeft">&#160;</td><td class="mdescRight">gets the fake LZMA allocator, used for imports resolution the "opaque" field of the structure holds a pointer to <a href="xzre_8h.html#abc618a02e31b94194ce03b0c4a2b3597">More...</a><br /></td></tr>
<tr class="separator:abc618a02e31b94194ce03b0c4a2b3597"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad21c1f0b4b9127ea1234d46dbadc3e8b"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xzre_8h.html#ad21c1f0b4b9127ea1234d46dbadc3e8b">secret_data_append_if_flags</a> (<a class="el" href="unionsecret__data__shift__cursor.html">secret_data_shift_cursor</a> shift_cursor, unsigned operation_index, unsigned reg2reg_instruction_count, int flags, u8 *code)</td></tr>
<tr class="memdesc:ad21c1f0b4b9127ea1234d46dbadc3e8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calls <a class="el" href="xzre_8h.html#a36a945c9790681a50af0a1a0cd72a269">secret_data_append_singleton</a>, if <code>flags</code> are non-zero. <a href="xzre_8h.html#ad21c1f0b4b9127ea1234d46dbadc3e8b">More...</a><br /></td></tr>
Expand Down Expand Up @@ -524,14 +527,14 @@ <h2 class="memtitle"><span class="permalink"><a href="#ab898071398b359603a35c202

</div>
</div>
<a id="a484c7f2d91a4774ef5c9de803c9fcfa5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a484c7f2d91a4774ef5c9de803c9fcfa5">&#9670;&nbsp;</a></span>elf_contains_segment()</h2>
<a id="a2a09d15b1c506e0f29ee9433771ad8db"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2a09d15b1c506e0f29ee9433771ad8db">&#9670;&nbsp;</a></span>elf_contains_vaddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">BOOL elf_contains_segment </td>
<td class="memname">BOOL elf_contains_vaddr </td>
<td>(</td>
<td class="paramtype">elf_info_t *&#160;</td>
<td class="paramname"><em>elf_info</em>, </td>
Expand Down Expand Up @@ -562,13 +565,13 @@ <h2 class="memtitle"><span class="permalink"><a href="#a484c7f2d91a4774ef5c9de80
</table>
</div><div class="memdoc">

<p>checks if given ELF file contains an elf segment with the given parameters </p>
<p>checks if given ELF file contains the range [vaddr, vaddr+size) in a segment with the specified memory protection flags </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">elf_info</td><td>elf context </td></tr>
<tr><td class="paramname">vaddr</td><td>the starting virtual address of the segment </td></tr>
<tr><td class="paramname">size</td><td>the size of the segment </td></tr>
<tr><td class="paramname">p_flags</td><td>the segment protection flags (PF_*) </td></tr>
<tr><td class="paramname">vaddr</td><td>starting memory address </td></tr>
<tr><td class="paramname">size</td><td>memory size </td></tr>
<tr><td class="paramname">p_flags</td><td>the expected segment protection flags (PF_*) </td></tr>
</table>
</dd>
</dl>
Expand Down Expand Up @@ -1018,7 +1021,8 @@ <h2 class="memtitle"><span class="permalink"><a href="#abc618a02e31b94194ce03b0c
</table>
</div><div class="memdoc">

<p>gets the fake LZMA allocator, used for imports resolution </p>
<p>gets the fake LZMA allocator, used for imports resolution the "opaque" field of the structure holds a pointer to </p>
<dl class="section see"><dt>See also</dt><dd>elf_info_t</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>lzma_allocator* </dd></dl>

</div>
Expand Down Expand Up @@ -1129,8 +1133,8 @@ <h2 class="memtitle"><span class="permalink"><a href="#a36a945c9790681a50af0a1a0
<p>Shifts data in the secret data store, after validation of <code>code</code>. this function is intended to be invoked only once for each <code>operation_index</code> value. <code>operation_index</code> will be used as an index into a global array of flags, so that multiple calls with the same value will be a NO-OP. </p>
<p>the <code>code</code> will be verified to check if the shift operation should be allowed or not. the algorithm will:</p><ul>
<li>locate the beginning of the function, by scanning for the <code>endbr64</code> instruction and making sure that the code lies between a pre-defined code range (TODO: figure out where the range is set)</li>
<li>search for <code>reg2reg_instruction_count</code> number of "reg2reg" functions (explained below)</li>
<li>for each instruction, shift a '1' in the data register, and increment the shift cursor to the next bit index if, at any given point, a non reg2reg instruction is encountered, the whole loop will stop.</li>
<li>search for <code>reg2reg_instruction_count</code> number of "reg2reg" instructions (explained below)</li>
<li>for each instruction, shift a '1' in the data register, and increment the shift cursor to the next bit index if, at any given point, a non reg2reg instruction is encountered, the whole loop will stop and FALSE will be returned.</li>
</ul>
<p>a reg2reg instruction is an x64 instruction with one of the following characteristics:</p><ul>
<li>primary opcode of 0x89 (MOV) or 0x3B (CMP) or, alternatively, an opcode that passes the following validation opcode_check = opcode - 0x83; if ( opcode_check &gt; 0x2E || ((0x410100000101 &gt;&gt; opcode_value) &amp; 1) == 0 )</li>
Expand All @@ -1150,7 +1154,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a36a945c9790681a50af0a1a0
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>BOOL </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>BOOL TRUE if validation was successful and data was added, FALSE otherwise </dd></dl>

</div>
</div>
Expand Down
Loading

0 comments on commit 9e4f5c7

Please sign in to comment.