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

Incomplete fix for CVE-2022-38223 #268

Closed
iskindar opened this issue Jun 12, 2023 · 8 comments
Closed

Incomplete fix for CVE-2022-38223 #268

iskindar opened this issue Jun 12, 2023 · 8 comments

Comments

@iskindar
Copy link

iskindar commented Jun 12, 2023

Hi,
I think the fix for CVE-2022-38223 in 419ca82 is not complete and it is still possible to trigger the same bug with a different poc in tats/w3m#242. The bug is an out of bound write in checkType, etc.c:478.

Version

w3m latest commit 93ad5ee

./w3m --version
w3m version w3m/0.5.3+git20230129, options lang=en,m17n,image,color,ansi-color,mouse,menu,cookie,external-uri-loader,w3mmailer,nntp,gopher,ipv6,alarm,mark

How to reproduce

export CC="gcc -fsanitize=address -g"  && ./configure && make -j
./w3m -dump $POC

ubuntu 20.04 dockerized reproduce steps

docker pull ubuntu:20.04 && docker run -it ubuntu:20.04 bash
## now step into the container
apt update && apt install wget git unzip gcc g++ make libgc-dev libtinfo-dev -y
git clone https://github.com/tats/w3m && pushd w3m
export CC="gcc -fsanitize=address -g" && ./configure && make -j
wget https://github.com/tats/w3m/files/11966800/poc0.zip && unzip poc0.zip
./w3m -dump ./poc0

Debian 11 dockerized reproduce steps

docker pull debian:11 && docker run -it debian:11 bash
## now step into the container
apt update && apt install wget git unzip gcc g++ make libgc-dev libtinfo-dev -y
git clone https://github.com/tats/w3m && pushd w3m
export CC="gcc -fsanitize=address -g" && ./configure && make -j
wget https://github.com/tats/w3m/files/11967522/poc0_debian.zip && unzip poc0_debian.zip
./w3m -dump ./poc0

ASAN log

AddressSanitizer:DEADLYSIGNAL
=================================================================
==5589==ERROR: AddressSanitizer: SEGV on unknown address 0x55e29237fe3c (pc 0x55e37f25f7d5 bp 0x55e29237fe3c sp 0x7fffda0d3220 T0)
==5589==The signal is caused by a WRITE memory access.
    #0 0x55e37f25f7d4 in checkType /benchmark/w3m/etc.c:478
    #1 0x55e37f225e8f in loadBuffer /benchmark/w3m/file.c:7727
    #2 0x55e37f24ac5b in loadSomething /benchmark/w3m/file.c:232
    #3 0x55e37f24ac5b in loadGeneralFile /benchmark/w3m/file.c:2288
    #4 0x55e37f1e8807 in main /benchmark/w3m/main.c:1061
    #5 0x7f216f6dd082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
    #6 0x55e37f1ec56d in _start (/benchmark/w3m/w3m+0xb256d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /benchmark/w3m/etc.c:478 in checkType
==5589==ABORTING

Platform

  • OS: ubuntu 20.04.5 LTS
  • gcc 9.4.0
    or
  • OS : Debian GNU/Linux 11
  • gcc 10.2.1

The bug was found by my fuzzer on Ubuntu 20.04.5. In addition, the bug can also be reproduced on Debian 11 with the default version of gcc.

PoC

ubuntu poc0.zip
debian poc0.zip

PS: The poc is different from that of tats/w3m#242 .

@iskindar
Copy link
Author

iskindar commented Jul 6, 2023

Affected version :

  • 0.5.3+git20230129
  • 0.5.3+git20230121-1
  • 0.5.3+git20230121-2

Not Affected version: < 0.5.3+git20220429-1

@rkta
Copy link
Contributor

rkta commented Jul 10, 2023 via email

@rkta
Copy link
Contributor

rkta commented Jul 12, 2023 via email

@tats
Copy link
Owner

tats commented Jul 12, 2023

@rkta
Could you please create a pull request?

@rkta
Copy link
Contributor

rkta commented Jul 13, 2023 via email

@tats
Copy link
Owner

tats commented Jul 18, 2023

Fixed with #273

@tats tats closed this as completed Jul 18, 2023
@carnil
Copy link

carnil commented Dec 22, 2023

This has recieved a separate CVE: CVE-2023-4255

@rkta
Copy link
Contributor

rkta commented Dec 28, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants