Bugtraq mailing list archives
Re: Applets listening on Sockets in Java
From: wright () QUCIS QUEENSU CA (Tim Wright)
Date: Mon, 15 Feb 1999 13:16:05 -0500
On Sat, 13 Feb 1999, Lincoln Stein wrote:
Tim Wright writes: > <alx () acm org> and I recently explored the "security hole" in Java > where an applet can listen on a port, and accept connections from any > machine, rather than just the machine from which the applet was > down-loaded. > > The code which was posted to BugTraq does appear to exhibit this > behavior. However, on closer inspection the posted code only created a > class to listen on a socket, and did not call the method to accept > connections from that socket. It turns out that the SecurityException is > (correctly) thrown during the accept method call. That's with connection-oriented sockets. What about UDP sockets?
just tested, code attached. UDP sockets throw an IOException rather than a SecurityExecption, but they do exhibit correct behaviour in that incoming packets from unauthorized places are not accepted. Tim http://stl.qucis.queensu.ca/~wright No society has lasted forever, so why do we assume that our society will? // Server code import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; /** * This type was created in VisualAge. */ public class SocketListener extends Applet { /** * This method was created in VisualAge. */ public void init() { DatagramSocket ss; try { ss = new DatagramSocket(7000); } catch (IOException ioe) { System.err.println("error, cannot create socket"); return; } System.err.println("created server socket"); while (true) { try { System.err.println("waiting for connection"); DatagramPacket s=new DatagramPacket(" ".getBytes(),10); ss.receive(s); System.err.println("accepted connection from "+s.getAddress()); System.err.println("read:"+ s.getData()); } catch (IOException ioe) { System.err.println("IO exception thrown"); } } } } // Client Code import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; /** * This type was created in VisualAge. */ public class SocketConnector { public SocketConnector() { super(); } public static void main(java.lang.String[] args) { try { String message="hi there"; DatagramPacket dp=new DatagramPacket(message.getBytes(),message.length()); dp.setPort(7000); dp.setAddress(InetAddress.getAllByName(args[0])[0]); (new DatagramSocket()).send(dp); } catch (Exception e) { System.err.println("exception occured"); e.printStackTrace(); } } }
Current thread:
- Re: Microsoft Access 97 Stores Database Password as Plaintext, (continued)
- Re: Microsoft Access 97 Stores Database Password as Plaintext Jim Paris (Feb 09)
- SECURITY: new wu-ftpd packages available (fwd) RHS Linux User (Feb 09)
- Re: SECURITY: new wu-ftpd packages available (fwd) Ronald Wahl (Feb 10)
- Pro/wuFTPD DoS (Was: Re: SECURITY: new wu-ftpd packages available Ken Williams (Feb 11)
- Re: Microsoft Access 97 Stores Database Password as Plaintext Nick Lamb (Feb 08)
- Re: Microsoft Access 97 Stores Database Password as Plaintext Ian Smith (Feb 10)
- Re: Microsoft Access 97 Stores Database Password as Plaintext Billy Naylor (Feb 12)
- Re: Microsoft Access 97 Stores Database Password as Plaintext Ian Smith (Feb 12)
- Applets listening on Sockets in Java Tim Wright (Feb 12)
- Applets listening on Sockets in Java Lincoln Stein (Feb 13)
- Re: Applets listening on Sockets in Java Tim Wright (Feb 15)
- palmetto.ftpd vulnerability clarification. Jordan Ritter (Feb 12)
- Microsoft Security Bulletin (MS99-005) aleph1 () UNDERGROUND ORG (Feb 12)
- Re: Microsoft Access 97 Stores Database Password as Plaintext Michael Nelson (Feb 12)