This article is from the Firewalls FAQ, by Matt Curtin cmcurtin@interhack.net and Marcus J. Ranum mjr@nfr.com with numerous contributions by others.
ALL.
No, wait, NONE.
No, wait, uuhhh... I've heard that all ports above 1024 are safe since
they're only dynamic??
No. Really. You CANNOT tell what ports are safe simply by looking at its
number, simply because that is really all it is. A number. You can't mount
an attack through a 16-bit number.
The security of a ``port'' depends on what application you'll reach through
that port.
A common misconception is that ports 25 (SMTP) and 80 (HTTP) are safe to
pass through a firewall. *meep* WRONG. Just because everyone is doing it
doesn't mean that it is safe.
Again, the security of a port depends on what application you'll reach
through that port.
If you're running a well-written web server, that is designed from the
ground up to be secure, you can probably feel reasonably assured that it's
safe to let outside people access it through port 80. Otherwise, you CAN'T.
The problem here is not in the network layer. It's in how the application
processes the data that it receives. This data may be received through port
80, port 666, a serial line, floppy or through singing telegram. If the
application is not safe, it does not matter how the data gets to it. The
application data is where the real danger lies.
If you are interested in the security of your application, go
subscribe to bugtraq <URL:http://www.securityfocus.com> or try
searching their archives.
This is more of an application security issue rather than a firewall
security issue. One could argue that a firewall should stop all possible
attacks, but with the number of new network protocols, NOT designed with
security in mind, and networked applications, neither designed with security
in mind, it becomes impossible for a firewall to protect against all
data-driven attacks.
 
Continue to: