|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CWE-293: Using Referer Field for Authentication
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) Example Languages: 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) Example
Language: 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:
September 12, 2011
|
|
CWE is a Software Assurance strategic initiative co-sponsored by the National Cyber Security Division of the U.S. Department of Homeland Security. This Web site is sponsored and managed by The MITRE Corporation to enable stakeholder collaboration. Copyright © 2006-2012, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation. Contact cwe@mitre.org for more information. |
|||



