Skip to content

Commit 7322649

Browse files
Create Vulnerable.s
1 parent fa8fa21 commit 7322649

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Vulnerable.s

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; filename: vulnerable.s | Written by an AI called OpenAI
2+
3+
.section .data
4+
5+
buf: .space 100 ; define a 100-byte buffer
6+
7+
.section .text
8+
9+
.globl _start
10+
11+
_start:
12+
movl $buf, %esi ; move the address of buf into %esi
13+
movl $0, %edi ; move 0 into %edi (to clear the buffer)
14+
movl $100, %ecx ; move the size of the buffer into %ecx
15+
rep stosl ; clear the buffer with zeros
16+
movl $4, %eax ; move 4 into %eax (to use the read syscall)
17+
movl $0, %ebx ; move 0 into %ebx (to read from stdin)
18+
movl $buf, %ecx ; move the address of buf into %ecx
19+
movl $100, %edx ; move the size of the buffer into %edx
20+
int $0x80 ; call the read syscall
21+
movl $1, %eax ; move 1 into %eax (to use the write syscall)
22+
movl $1, %ebx ; move 1 into %ebx (to write to stdout)
23+
movl $buf, %ecx ; move the address of buf into %ecx
24+
movl $100, %edx ; move the size of the buffer into %edx
25+
int $0x80 ; call the write syscall
26+
movl $1, %eax ; move 1 into %eax (to use the exit syscall)
27+
xorl %ebx, %ebx ; clear %ebx
28+
int $0x80 ; call the exit syscall
29+

0 commit comments

Comments
 (0)