Is it possible to list files with MySQL's Load_file()? Is there any meta file that would contain the file names or so? Thanks

link|improve this question

50% accept rate
1  
Can you please clarify what you are attempting to achieve. – Iain Feb 6 at 17:50
@Iain little and less, I'd just like to know. As I clarified below, mentioning load_file is misleading. I wonder if a readable file reflecting the file tree exists. – Mikulas Dite Feb 6 at 20:40
feedback

1 Answer

You mean by reading the directory entry data? In general, it would work, but obviously an implementation would inevitably be platform- and filesystem-specific. If you need it for a feature and not as a security consideration, don't do it.

link|improve this answer
Well, basically I am asking whether it's possible out of the box, without external utilities or scripts that would generate such a file prior to an attack. – Mikulas Dite Feb 6 at 15:59
@MikulasDite Threat analysis is best discussed at security.stackexchange.com. But even there you would need some more details. File prior to attack sounds like a hosted web environment which you missed to mention in your original question. You would need to comprehensively state what exactly you have in order to get an advice for possible directions to look. – syneticon-dj Feb 6 at 17:14
@MikulasDite BTW, I believe you have not understood the implications - the referenced Perl script is just something to interpret the output of load_file targeted at a directory. It does not have to reside on the MySQL server, it just has to be somewhere an adversary can get the output of the load_file call to. – syneticon-dj Feb 6 at 17:43
@synecticon-dj I was merely curious, without a specific setup at hand. The idea itself with Load_file is quite misleading, I should have asked whether there is a file with file structure in general. Nix systems in general, no more, no less. – Mikulas Dite Feb 6 at 18:14
@MikulasDite No, there is no stored directory structure abstraction structure with Unix or Linux. The binary contents of a retrieved directory would have to be interpreted appropriately depending on the file system used to store the directory. – syneticon-dj May 10 at 12:31
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.