1

I'm trying to load a /etc/flag file using mysql LOAD_FILE function, but it returns null. I've created this file by copying passwd file like this cp /etc/passwd /etc/flag, then I've given it permissions that are exactly the same as the permissions of passwd file chmod 644 /etc/flag.

-rw-r--r-- 1 root root 1806 Dec 15 18:29 /etc/flag
-rw-r--r-- 1 root root 1806 Dec 15 18:04 /etc/passwd

The result of SELECT LOAD_FILE('/etc/passwd') is the contents of the passwd file.

The result of SELECT LOAD_FILE('/etc/flag') is NULL

What can be the other difference between /etc/passwd and /etc/flag that one loads and the other does not?

My MySQL version is mysql Ver 8.0.27-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

Łukasz W.
  • 9,538
  • 5
  • 38
  • 63
  • Does [this](https://stackoverflow.com/q/24459149/6843158) help ? – Kate Dec 15 '21 at 19:30
  • Yeap, that was it. Strangely I thought that turning the AppArmor service using `service apparmor stop` would do the same, but it didn't. Thank you. – Łukasz W. Dec 15 '21 at 20:34

0 Answers0