Skip to content

Path traversal in GET requests #1

Description

@ihawp

In http.c:

int send_stream_file(
	int *client_fd,
	HTTPRequest *http_request,
	HTTPResponse *http_response
) {
	if (strcmp(http_request->path, "/") == 0) {
		strcpy(http_request->path, "index.html");
	}

	...
	char public_path[PATH_SIZE];
	snprintf(public_path, PATH_SIZE, "public/%s", http_request->path); <-- Printing the path directly 
															  without checks for '../' or './' or '<n>../../'
	...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions