Description Summary The referer field in HTTP requests can be easily modified and,
as such, is not a valid means of message integrity
checking.
Example 1 (Bad Code) C and C++ sock= socket(AF_INET, SOCK_STREAM, 0); ... bind(sock, (struct sockaddr *)&server, len) ... while (1) newsock=accept(sock, (struct sockaddr *)&from,
&fromlen); pid=fork(); if (pid==0) { n = read(newsock,buffer,BUFSIZE);
...
if (buffer+...==Referer: http://www.foo.org/dsaf.html) //do
stuff
(Bad Code) Java public class httpd extends Thread { Socket cli;
public httpd(Socket serv) {
cli=serv;
start();
}
public static void main(String[] a) {
...
ServerSocket
serv=new ServerSocket(8181);
for(;;) {
new h(serv.accept());
...
public void run() {
try {
BufferedReader reader = new BufferedReader(new
InputStreamReader(cli.getInputStream())); //if i
contains a the proper referer.
DataOutputStream o= new
DataOutputStream(c.getOutputStream());
...
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Page Last Updated:
October 29, 2009
|
|
CWE is a Software Assurance strategic initiative sponsored by the National Cyber Security Division of the U.S. Department of Homeland Security. This Web site is hosted by The MITRE Corporation. Contact cwe@mitre.org for more information. |
|||
