Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix arbitrary file upload vulnerability with httpServerEnabled #3982

Merged
merged 3 commits into from
Jun 19, 2023

Conversation

Shawyeok
Copy link
Contributor

Motivation

There is a potential arbitrary file upload vulnerability with httpServerEnabled=true, it's caused by BodyHandler.create() which returns a BodyHandler that automatically processes file upload requests.

This simple command will upload a file into the file-uploads directory under the bookkeeper server process CWD.

$ curl -i --request POST \
  --url http://localhost:8000/api/v1/bookie/info \
  --header 'Content-Type: multipart/form-data' \
  --form file=@<a-path-of-the-file>

$ ls
LICENSE  NOTICE  README.md  bin  conf  deps  file-uploads  lib  logs  scripts
$ ls file-uploads
758801ba-ea1e-49e3-85d6-e510f539ea0d

Changes

Create the BodyHandler with handleFileUploads disabled (BodyHandler.create(false)).

@Shawyeok Shawyeok changed the title Fix vertx httpserver arbitrary file upload vulnerability Fix arbitrary file upload vulnerability with httpServerEnabled Jun 11, 2023
Copy link
Member

@wenbingshen wenbingshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change make sense to me.

@zymap
Copy link
Member

zymap commented Jun 12, 2023

@Shawyeok Please fix the checkstyle issue in your code.

@Shawyeok
Copy link
Contributor Author

Shawyeok commented Jun 12, 2023

@Shawyeok Please fix the checkstyle issue in your code.

Fixed, PTAL

@zymap zymap added this to the 4.17.0 milestone Jun 12, 2023
@hangc0276 hangc0276 merged commit 1809e69 into apache:master Jun 19, 2023
16 checks passed
zymap pushed a commit that referenced this pull request Jun 19, 2023
### Motivation

There is a potential arbitrary file upload vulnerability with `httpServerEnabled=true`, it's caused by `BodyHandler.create()` which returns a BodyHandler that automatically processes file upload requests.
https://github.com/apache/bookkeeper/blob/7f64246ad38981126cc8dd929ff448805a738b8f/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java#L82

This simple command will upload a file into the `file-uploads` directory under the bookkeeper server process `CWD`.
```shell
$ curl -i --request POST \
  --url http://localhost:8000/api/v1/bookie/info \
  --header 'Content-Type: multipart/form-data' \
  --form file=@<a-path-of-the-file>

$ ls
LICENSE  NOTICE  README.md  bin  conf  deps  file-uploads  lib  logs  scripts
$ ls file-uploads
758801ba-ea1e-49e3-85d6-e510f539ea0d
```

### Changes

Create the `BodyHandler` with handleFileUploads disabled (`BodyHandler.create(false)`).

(cherry picked from commit 1809e69)
hangc0276 pushed a commit to hangc0276/bookkeeper that referenced this pull request Jun 26, 2023
…e#3982)

### Motivation

There is a potential arbitrary file upload vulnerability with `httpServerEnabled=true`, it's caused by `BodyHandler.create()` which returns a BodyHandler that automatically processes file upload requests.
https://github.com/apache/bookkeeper/blob/7f64246ad38981126cc8dd929ff448805a738b8f/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java#L82

This simple command will upload a file into the `file-uploads` directory under the bookkeeper server process `CWD`.
```shell
$ curl -i --request POST \
  --url http://localhost:8000/api/v1/bookie/info \
  --header 'Content-Type: multipart/form-data' \
  --form file=@<a-path-of-the-file>

$ ls
LICENSE  NOTICE  README.md  bin  conf  deps  file-uploads  lib  logs  scripts
$ ls file-uploads
758801ba-ea1e-49e3-85d6-e510f539ea0d
```

### Changes

Create the `BodyHandler` with handleFileUploads disabled (`BodyHandler.create(false)`).

(cherry picked from commit 1809e69)
zymap pushed a commit that referenced this pull request Dec 7, 2023
### Motivation

There is a potential arbitrary file upload vulnerability with `httpServerEnabled=true`, it's caused by `BodyHandler.create()` which returns a BodyHandler that automatically processes file upload requests.
https://github.com/apache/bookkeeper/blob/7f64246ad38981126cc8dd929ff448805a738b8f/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java#L82

This simple command will upload a file into the `file-uploads` directory under the bookkeeper server process `CWD`.
```shell
$ curl -i --request POST \
  --url http://localhost:8000/api/v1/bookie/info \
  --header 'Content-Type: multipart/form-data' \
  --form file=@<a-path-of-the-file>

$ ls
LICENSE  NOTICE  README.md  bin  conf  deps  file-uploads  lib  logs  scripts
$ ls file-uploads
758801ba-ea1e-49e3-85d6-e510f539ea0d
```

### Changes

Create the `BodyHandler` with handleFileUploads disabled (`BodyHandler.create(false)`).

(cherry picked from commit 1809e69)
Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
…e#3982)

### Motivation

There is a potential arbitrary file upload vulnerability with `httpServerEnabled=true`, it's caused by `BodyHandler.create()` which returns a BodyHandler that automatically processes file upload requests.
https://github.com/apache/bookkeeper/blob/7f64246ad38981126cc8dd929ff448805a738b8f/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java#L82

This simple command will upload a file into the `file-uploads` directory under the bookkeeper server process `CWD`.
```shell
$ curl -i --request POST \
  --url http://localhost:8000/api/v1/bookie/info \
  --header 'Content-Type: multipart/form-data' \
  --form file=@<a-path-of-the-file>

$ ls
LICENSE  NOTICE  README.md  bin  conf  deps  file-uploads  lib  logs  scripts
$ ls file-uploads
758801ba-ea1e-49e3-85d6-e510f539ea0d
```

### Changes

Create the `BodyHandler` with handleFileUploads disabled (`BodyHandler.create(false)`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants