LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 05-04-2006, 03:57 AM   #1
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Rep: Reputation: 15
banner grabing


Is it possible to change for example ssh banner

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 3.8.1p1 Debian-8.sarge.4 (protocol 2.0)

-output from nmap.

Can i tweak ssh to show some my string.
Can i do that for apache also?
 
Old 05-04-2006, 04:50 AM   #2
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 38
I don't get you, sorry Please give a better example cause i think then i can help you.
 
Old 05-04-2006, 04:54 AM   #3
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Rep: Reputation: 30
The sshd banner is /etc/issue.net file as in the /etc/sshd/sshd.conf comment out the Banner /etc/issue.net.
 
Old 05-04-2006, 05:52 AM   #4
hareeshvv
Registered User
 
Registered: Apr 2006
Location: India
Distribution: RedHat
Posts: 6

Rep: Reputation: 0
did you mean welcome note ?
 
Old 05-05-2006, 03:23 AM   #5
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
no no i know for sshd banner.
I dont want to some kiddi with nmap get my ssh server version.
with nmap i get this
22/tcp open ssh OpenSSH 3.8.1p1 Debian-8.sarge.4 (protocol 2.0)

can i tweak something to be:

22/tcp open ssh OpenSSH KIDDI get out of here!
 
Old 05-05-2006, 03:35 AM   #6
lurker79
Member
 
Registered: Jan 2005
Location: UK
Posts: 55

Rep: Reputation: 16
Usually this kind of tweak you need to make in the source code for the application itself.
It is a server identification string, some servers (e.g. apache) have config options that allow you to modify the amount of information you show is this string.
 
Old 05-05-2006, 06:49 AM   #7
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
i see that soooo i must compile sshd by hand no apt

where is in apache that config?
 
Old 05-05-2006, 06:54 AM   #8
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
i see that soooo i must compile sshd by hand no apt

where is in apache that config?
 
Old 05-05-2006, 07:27 AM   #9
lurker79
Member
 
Registered: Jan 2005
Location: UK
Posts: 55

Rep: Reputation: 16
For apache you want to look at the ServerTokens directive http://httpd.apache.org/docs/2.2/mod...l#servertokens
for more control over the server string again you would have to edit the source code
 
Old 05-05-2006, 09:31 AM   #10
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
Originally Posted by unkn0wn
i see that soooo i must compile sshd by hand no apt
Or modify directly the binary:
Code:
sed -i 's/OpenSSH_4.2p1 Debian/AwayAwayAwayAwayAway/' /usr/sbin/sshd
 
Old 05-07-2006, 08:47 AM   #11
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
i modiy and get segmentation fault
what now
 
Old 05-09-2006, 02:32 AM   #12
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Quote:
Originally Posted by unkn0wn
i modiy and get segmentation fault
what now

Did you make a copy of the old sshd?
And you have put your version?

There is a mistake in the above line, should be:
Code:
sed -i 's/OpenSSH_4\.2p1 Debian/AwayAwayAwayAwayAway/' /usr/sbin/sshd
Take a new binary, launch strings on sshd
strings `which sshd` | grep -i debian

and do the operation as above, replacing . by \.

Worked on my sshd, the cleanest would be to recompile.
I don't think its really usefull to hide your version. Better tighten your security than hiding.

Last edited by nx5000; 05-09-2006 at 02:35 AM.
 
Old 05-12-2006, 01:10 AM   #13
unkn0wn
Member
 
Registered: Mar 2006
Posts: 60

Original Poster
Rep: Reputation: 15
i menage it
recompile and edit version.h
tnx
 
Old 05-12-2006, 01:42 AM   #14
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Rep: Reputation: 30
i have done sed -i 's/OpenSSH_4\.2p1 Debian/AwayAwayAwayAwayAway/' /usr/sbin/sshd but ....

root@argo:~# nmap -sV 192.168.0.2 -p 666

Starting nmap 3.81 ( http://www.insecure.org/nmap/ ) at 2006-05-12 08:41 CEST
Interesting ports on argo.ath.cx (192.168.0.2):
PORT STATE SERVICE VERSION
666/tcp open ssh OpenSSH 3.8.1p1 Debian-8.sarge.4 (protocol 1.99)

Nmap finished: 1 IP address (1 host up) scanned in 0.149 seconds
 
Old 05-15-2006, 04:07 AM   #15
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
What I gave was an example. I'm not sure you really understand the command sed
sed replaces something with something else
I was running OpenSSH_4.2p1 so I replaced OpenSSH_4.2p1 by some junk. For you its something else!

To get the correct string, type this:

(1)
Code:
strings `which sshd` | grep -i debian
then to get the number of chars to replace do this

(2)
Code:
strings `which sshd` | grep -i debian | wc -c
Then issue:

sed -i 's/your version/Junk/'

WHERE
  • "your version" is the result of (1) after having replaced . by \.
  • "Junk" has to be a text of your choice of length [result of (2) - 1 ] So if (2) gave 21, then you have to put a text of length 20: AwayAwayAwayAwayAway in my case.

then restart sshd and check

If you are wrong, you've corrupted your ssh, so keep a backup

Last edited by nx5000; 05-15-2006 at 04:08 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Annoying banner ad lordshipmayhem LQ Suggestions & Feedback 5 09-14-2007 11:28 AM
LQ Banner bongenheimer LQ Suggestions & Feedback 12 10-31-2005 11:14 AM
grabing info and putting it in a file gurkburk Linux - Newbie 7 05-14-2004 10:36 AM
banner printing vital4ik Linux - Software 0 05-13-2004 11:25 PM
MS Banner Ad on LQ?!?!?! fragglehorn LQ Suggestions & Feedback 12 11-06-2002 12:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration