-
Notifications
You must be signed in to change notification settings - Fork 162
evhtp_parse_query_wflags SIGSEGV: address access protected #118
Comments
|
Sorry, this took so long to circle back to, here is a backtrace. Currently on libevent version 2.1.11 and libevhtp version 1.2.16. |
I've finally determined the root cause of this, however, I'm still trying to determine why it is happening. At [1] memory is allocated to a buffer or the heap depending on the EVHTP_HAS_C99 flag. I'm still not sure how to determine the max buffer size, but in this particular case, the buffer isn't large enough for the data which is causing a buffer overflow. Compiling with -DEVHTP_HAS_C99=false fixes the error because it will allocate using the heap instead. haiwen/seafile#1928 also reported this bug quite awhile ago. [1] https://github.com/criticalstack/libevhtp/blob/1.2.16/evhtp.c#L3502 |
libevhtp allocates a stack based on data length when C99 is detected at compile time. There are no checks to verify that the stack is big enough which can cause a stack overflow. Adding EVHTP_HAS_C99=false at compile time changes this behavior by allocate to a buffer which has proper checks in place. More information about this bug can be found at: Yellow-Camper/libevhtp#118 haiwen/seafile#1928 MFH: 2019Q3 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@510747 35697150-7ecd-e111-bb59-0022644237b5
libevhtp allocates a stack based on data length when C99 is detected at compile time. There are no checks to verify that the stack is big enough which can cause a stack overflow. Adding EVHTP_HAS_C99=false at compile time changes this behavior by allocate to a buffer which has proper checks in place. More information about this bug can be found at: Yellow-Camper/libevhtp#118 haiwen/seafile#1928 MFH: 2019Q3 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@510747 35697150-7ecd-e111-bb59-0022644237b5
libevhtp allocates a stack based on data length when C99 is detected at compile time. There are no checks to verify that the stack is big enough which can cause a stack overflow. Adding EVHTP_HAS_C99=false at compile time changes this behavior by allocate to a buffer which has proper checks in place. More information about this bug can be found at: Yellow-Camper/libevhtp#118 haiwen/seafile#1928 MFH: 2019Q3
Fix stack overflow that can occur in libevhtp libevhtp allocates a stack based on data length when C99 is detected at compile time. There are no checks to verify that the stack is big enough which can cause a stack overflow. Adding EVHTP_HAS_C99=false at compile time changes this behavior by allocate to a buffer which has proper checks in place. More information about this bug can be found at: Yellow-Camper/libevhtp#118 haiwen/seafile#1928 Approved by: ports-secteam (joneum)
Fix stack overflow that can occur in libevhtp libevhtp allocates a stack based on data length when C99 is detected at compile time. There are no checks to verify that the stack is big enough which can cause a stack overflow. Adding EVHTP_HAS_C99=false at compile time changes this behavior by allocate to a buffer which has proper checks in place. More information about this bug can be found at: Yellow-Camper/libevhtp#118 haiwen/seafile#1928 Approved by: ports-secteam (joneum)
Details
I'm experiencing an out-of-bounds write attempt during evhtp_parse_query_wflags. I believe this issue is probably a memory allocation limit but I'm not exactly positive.
Steps or code to reproduce the problem.
Not sure if it is specific data that is currently on my server, more testing to reproduce need to be done. Installing the port seahub on FreeBSD and generate some syncs with seafile-client. In the logs there will be "Seafile kernel: pid 91446 (seaf-server), uid 900: exited on signal 11".
Further debugging I found that this will occur when len is at a higher value like len=1048660
0x7fffdf5f98e0)
frame #0: 0x0000000800dac8da libevhtp.so.0`evhtp_parse_query_wflags(query="846adf988582db791bbedce08b99706b5e94c917", len=1048660, flags=0) at evhtp.c:3531
Version
FreeBSD: 11.2
Seafile-server: 6.3.4
Libevhtp: 1.2.16
Let me know if there is anything else that may help with debugging this.
The text was updated successfully, but these errors were encountered: