Skip to content

Commit 75caf29

Browse files
committed
Better explaination of line pprofile
1 parent e34fdc1 commit 75caf29

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

ctf/line-2021-pprofile/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ Commands:
5353

5454
I tried at first some heap exploitation stuff but it didn't work.
5555
The easier thing to do is to use the READ operation to write inside the address of
56-
`modprobe_path` a different binary to execute. To write the value you use
57-
the pid of the process.
56+
`modprobe_path` a different string (which is the name of the program to be executed
57+
when a binary format file is not recognized). To write the value you use
58+
the pid of the process. From my understanding this works because the module uses
59+
`copy_user_generic_unrolled` instead of `copy_to_user` to copy the value.
5860

5961
I tried to set instead of `/tmp/a` `~/aa`, but `modprobe_path` doesn't seem to understand
6062
the `~` (in this way it could be possible to write two consecutive write without looping
6163
through all the possible pid three times)
6264

63-
At the moment the exploit is without `KASLR`.
65+
At the moment the exploit works without `KASLR`.

ctf/line-2021-pprofile/pprofile-reversed.c

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ struct len_pid {
1010
}
1111

1212
struct string *storages[16]; // global
13+
14+
__int64 __fastcall put_user_size(__int64 a1, __int64 a2)
15+
{
16+
int v3; // [rsp+0h] [rbp-Ch] BYREF
17+
unsigned __int64 v4; // [rsp+4h] [rbp-8h]
18+
19+
_fentry__(a1, a2);
20+
v3 = a1;
21+
v4 = __readgsqword(0x28u);
22+
return copy_user_generic_unrolled(a2, &v3);
23+
}
24+
1325
__int64 __fastcall pprofile_ioctl(__int64 a1, __int64 a2)
1426
{
1527
__int64 v2; // rdx

0 commit comments

Comments
 (0)