Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

fwrite()


ghost's Avatar
0 0

Is it possible to fwrite() on a server to a different server? If so, could some one give me an example, please?


ghost's Avatar
0 0

Hey I have benn wondering about this thing too. Suppose an admin has 777 enabled on a directory. Can we use the PUT method to create our own files on the server?

Thomas


ghost's Avatar
0 0

no its impossible for the way fwrite works. but i do beleave there is another way to mess with a file that is 777 on a server. ill research it in a minute and post my finds.


ghost's Avatar
0 0

fwrite() is usually used for local files, but depends. If you're talking about straight ansi C using stdio.h, then no, probably not. You could if you mapped a NFS share or something like that, but if you already have that type of access remotely, then I'm sure there's an easier way to do whatever it is you're trying to do. There's numerous c libs that support remote fwrites over various protocols, such as cURL and GASS.

Most scriptable languages have a friendlier approach to fwrite, particularly php. It support numerous types of remote connections to a server that could accomodate this, but again you'd need some type of pre existing link to the server (ftp, nfs, etc, or something along those lines, but again, probably an easier way to do whatever it is you're trying to do).

As for the PUT comment, I assume you mean an HTTP PUT, and yes that can work, but the server would have to be configured to support PUTs to begin with. Most don't (nor should they). Various httpd's have weaknesses in this regard, particularly older ones, but you can read about proper HTTP PUT's from head to toe at here for apache and here for IIS.

HTH