Suppose I have a website which has SQL injection vulnerability and I got the database schema etc. Is there any means by which I can get the operating system username or the SSH username?
Asking from hardening purpose
Information Security Stack Exchange is a question and answer site for information security professionals. It only takes a minute to sign up.Sign up to join this community
Depends on the permissions given to the database user who you are acting as. If they have command execution privileges, it would be possible to use those to run a command such as
id. Without that privilege, though, it is not supposed to be possible, but could be if the MySQL user was also a valid system user. In that case, it is possible to obtain the MySQL user through the
user() function, which could then be used on the system, although these would not be the same entity (e.g. they could have distinct passwords)