Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
49 changes: 23 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
FROM debian:latest

RUN apt-get update && apt-get install -y gcc \
make \
vim \
gdb \
bison flex \
man \
ftp
COPY . /wu-ftpd
RUN apt-get update && \
apt-get install -y bison \
flex \
ftp \
gcc \
gdb \
make \
man \
vim

WORKDIR /wu-ftpd/wu-ftpd-2.6.0/
RUN ./configure
RUN mkdir /usr/man/
RUN mkdir /usr/man/man8 && cp ./doc/ftpd.8 /usr/man/man8
RUN mkdir /usr/man/man1 && cp ./doc/ftpcount.1 /usr/man/man1
RUN mkdir /usr/man/man5 && cp ./doc/ftpaccess.5 /usr/man/man5
RUN sed -i 's/\t=\t{/\t{/g' src/ftpcmd.y
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@neverrend can you provide a reference for this fix?

Copy link
Owner

Choose a reason for hiding this comment

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

Reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, for where you got this fix. Or at least a comment for what it does.

Copy link
Owner

Choose a reason for hiding this comment

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

Oooh ok I got it right here, they didnt explicitly say use that sed line I wrote but that's the best way I could come up with based on the conversation:
https://lists.gnu.org/archive/html/help-bison/2004-04/msg00006.html

RUN make && make install
RUN cp ../configs/* /etc/
COPY configs/* /etc/
COPY wu-ftpd-2.6.0 /usr/src/wu-ftpd
WORKDIR /usr/src/wu-ftpd/

RUN echo "ftp:*:400:400:Anonymous FTP:/home/ftp:/bin/tru" >> /etc/passwd
RUN echo "ftp:x:400:" >> /etc/group
RUN mkdir /home/ftp
RUN chmod 555 /home/ftp
RUN chown root:ftp /home/ftp
RUN mkdir /home/ftp/bin/
RUN chmod 111 /home/ftp/bin/

WORKDIR bin/
RUN ./configure --mandir="/usr/share/man" && \
sed -i 's/\t=\t{/\t{/g' src/ftpcmd.y && \
make && make install && \
echo "ftp:*:400:400:Anonymous FTP:/home/ftp:/bin/tru" >> /etc/passwd && \
echo "ftp:x:400:" >> /etc/group && \
mkdir -p /home/ftp/bin && \
chmod 555 /home/ftp && \
chown root:ftp /home/ftp && \
chmod 111 /home/ftp/bin

ENTRYPOINT ["/usr/src/wu-ftpd/bin/ftpd"]
CMD ["-S"]
57 changes: 46 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
# wu-ftp_Exploit_Test
Docker build of wu-ftp to allow for easy exploitation.

_Dockerized wu-ftp for easy exploitation_

## Build Instructions
`docker build -t wu-ftpd:v1 .`

### Docker Compose

```sh
docker-compose build
```

### Docker

```sh
docker build -t neverrend/wu-ftpd:v1 .
```

## Run Instructions
`docker run -p 21:21 -it wu-ftpd`

From the container run to start the FTPD service:
`# ./ftpd -S`
Note: these commands assume they are being run directly from the repository.

### Docker Compose

```sh
docker-compose up -d
```

### Docker

```sh
docker run -v "$(pwd)/exploits:/tmp/exploits" -p 21:21 -d neverrend/wu-ftpd:v1
```

## Connecting Instructions
On the host machine connect with ftp:
`ftp localhost`

Use the username anonymous and pass foo.
On the host machine connect via `ftp`:

```sh
ftp localhost
```

The username is `anonymous` and the password is `foo`.

Alternatively, one can also access the service via `curl`:

## Misc
THIS IS FOR TESTING EXPLOITS DO NOT USE THIS AS A REAL FTP SERVER!!!!
```sh
curl -u anonymous:foo ftp://localhost
```

## WARNING

**THIS IS FOR TESTING EXPLOITS DO NOT USE THIS AS A REAL FTP SERVER!!!!**

## TODO
Add code highlight the exploits

- Add code highlight the exploits

9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"
services:
ftp:
build: .
image: neverrend/wu-ftpd:v1
ports:
- 21:21
volumes:
- ./exploits:/tmp/exploits