cve_id
stringlengths
13
16
obtain_all_privilege
stringclasses
3 values
obtain_user_privilege
stringclasses
2 values
obtain_other_privilege
stringclasses
2 values
user_interaction_required
stringclasses
3 values
cvss2_vector_string
stringclasses
106 values
cvss2_access_vector
stringclasses
4 values
cvss2_access_complexity
stringclasses
4 values
cvss2_authentication
stringclasses
3 values
cvss2_confidentiality_impact
stringclasses
4 values
cvss2_integrity_impact
stringclasses
4 values
cvss2_availability_impact
stringclasses
4 values
cvss2_base_score
stringclasses
50 values
cvss3_vector_string
stringclasses
226 values
cvss3_attack_vector
stringclasses
5 values
cvss3_attack_complexity
stringclasses
3 values
cvss3_privileges_required
stringclasses
4 values
cvss3_user_interaction
stringclasses
3 values
cvss3_scope
stringclasses
3 values
cvss3_confidentiality_impact
stringclasses
4 values
cvss3_integrity_impact
stringclasses
4 values
cvss3_availability_impact
stringclasses
4 values
cvss3_base_score
stringclasses
55 values
cvss3_base_severity
stringclasses
5 values
exploitability_score
stringclasses
22 values
impact_score
stringclasses
15 values
ac_insuf_info
stringclasses
3 values
reference_json
stringlengths
221
23.3k
problemtype_json
stringclasses
200 values
severity
stringclasses
4 values
cve_nodes
stringlengths
2
33.1k
cve_description
stringlengths
64
1.99k
cve_last_modified_date
stringlengths
17
17
cve_published_date
stringlengths
17
17
cwe_name
stringclasses
125 values
cwe_description
stringclasses
124 values
cwe_extended_description
stringclasses
95 values
cwe_url
stringclasses
124 values
cwe_is_category
int64
0
1
commit_author
stringlengths
0
34
commit_author_date
stringlengths
25
25
commit_msg
stringlengths
0
13.3k
commit_hash
stringlengths
40
40
commit_is_merge
stringclasses
1 value
repo_name
stringclasses
467 values
repo_description
stringclasses
459 values
repo_date_created
stringclasses
467 values
repo_date_last_push
stringclasses
467 values
repo_homepage
stringclasses
294 values
repo_owner
stringclasses
470 values
repo_stars
stringclasses
406 values
repo_forks
stringclasses
352 values
function_name
stringlengths
3
120
function_signature
stringlengths
6
640
function_parameters
stringlengths
2
302
function
stringlengths
12
114k
function_token_count
stringlengths
1
5
function_before_change
stringclasses
1 value
labels
int64
1
1
CVE-2019-11934
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://www.facebook.com/security/advisories/cve-2019-11934', 'name': 'https://www.facebook.com/security/advisories/cve-2019-11934', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/facebook/folly/commit/c321eb588909646c15aefde035fd3133ba32cdee', 'name': 'https://github.com/facebook/folly/commit/c321eb588909646c15aefde035fd3133ba32cdee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:folly:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2019.11.04.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Improper handling of close_notify alerts can result in an out-of-bounds read in AsyncSSLSocket. This issue affects folly prior to v2019.11.04.00.'}]
2019-12-13T19:28Z
2019-12-04T17:16Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Kyle Nekritz
2019-10-28 15:47:35-07:00
Handle close_notify as standard writeErr in AsyncSSLSocket. Summary: Fixes CVE-2019-11934 Reviewed By: mingtaoy Differential Revision: D18020613 fbshipit-source-id: db82bb250e53f0d225f1280bd67bc74abd417836
c321eb588909646c15aefde035fd3133ba32cdee
False
facebook/folly
An open-source C++ library developed and used at Facebook.
2012-06-01 20:49:04
2022-08-27 13:38:56
https://groups.google.com/forum/?fromgroups#!forum/facebook-folly
facebook
23010.0
4804.0
folly::AsyncSSLSocket::performWrite
folly::AsyncSSLSocket::performWrite( const iovec * vec , uint32_t count , WriteFlags flags , uint32_t * countWritten , uint32_t * partialWritten)
['vec', 'count', 'flags', 'countWritten', 'partialWritten']
AsyncSocket::WriteResult AsyncSSLSocket::performWrite( const iovec* vec, uint32_t count, WriteFlags flags, uint32_t* countWritten, uint32_t* partialWritten) { if (sslState_ == STATE_UNENCRYPTED) { return AsyncSocket::performWrite( vec, count, flags, countWritten, partialWritten); } if (sslState_ != STATE_ESTABLISHED) { LOG(ERROR) << "AsyncSSLSocket(fd=" << fd_ << ", state=" << int(state_) << ", sslState=" << sslState_ << ", events=" << eventFlags_ << "): " << "TODO: AsyncSSLSocket currently does not support calling " << "write() before the handshake has fully completed"; return WriteResult( WRITE_ERROR, std::make_unique<SSLException>(SSLError::EARLY_WRITE)); } // Declare a buffer used to hold small write requests. It could point to a // memory block either on stack or on heap. If it is on heap, we release it // manually when scope exits char* combinedBuf{nullptr}; SCOPE_EXIT { // Note, always keep this check consistent with what we do below if (combinedBuf != nullptr && minWriteSize_ > MAX_STACK_BUF_SIZE) { delete[] combinedBuf; } }; *countWritten = 0; *partialWritten = 0; ssize_t totalWritten = 0; size_t bytesStolenFromNextBuffer = 0; for (uint32_t i = 0; i < count; i++) { const iovec* v = vec + i; size_t offset = bytesStolenFromNextBuffer; bytesStolenFromNextBuffer = 0; size_t len = v->iov_len - offset; const void* buf; if (len == 0) { (*countWritten)++; continue; } buf = ((const char*)v->iov_base) + offset; ssize_t bytes; uint32_t buffersStolen = 0; auto sslWriteBuf = buf; if ((len < minWriteSize_) && ((i + 1) < count)) { // Combine this buffer with part or all of the next buffers in // order to avoid really small-grained calls to SSL_write(). // Each call to SSL_write() produces a separate record in // the egress SSL stream, and we've found that some low-end // mobile clients can't handle receiving an HTTP response // header and the first part of the response body in two // separate SSL records (even if those two records are in // the same TCP packet). if (combinedBuf == nullptr) { if (minWriteSize_ > MAX_STACK_BUF_SIZE) { // Allocate the buffer on heap combinedBuf = new char[minWriteSize_]; } else { // Allocate the buffer on stack combinedBuf = (char*)alloca(minWriteSize_); } } assert(combinedBuf != nullptr); sslWriteBuf = combinedBuf; memcpy(combinedBuf, buf, len); do { // INVARIANT: i + buffersStolen == complete chunks serialized uint32_t nextIndex = i + buffersStolen + 1; bytesStolenFromNextBuffer = std::min(vec[nextIndex].iov_len, minWriteSize_ - len); if (bytesStolenFromNextBuffer > 0) { assert(vec[nextIndex].iov_base != nullptr); ::memcpy( combinedBuf + len, vec[nextIndex].iov_base, bytesStolenFromNextBuffer); } len += bytesStolenFromNextBuffer; if (bytesStolenFromNextBuffer < vec[nextIndex].iov_len) { // couldn't steal the whole buffer break; } else { bytesStolenFromNextBuffer = 0; buffersStolen++; } } while ((i + buffersStolen + 1) < count && (len < minWriteSize_)); } // Advance any empty buffers immediately after. if (bytesStolenFromNextBuffer == 0) { while ((i + buffersStolen + 1) < count && vec[i + buffersStolen + 1].iov_len == 0) { buffersStolen++; } } // cork the current write if the original flags included CORK or if there // are remaining iovec to write corkCurrentWrite_ = isSet(flags, WriteFlags::CORK) || (i + buffersStolen + 1 < count); // track the EoR if: // (1) there are write flags that require EoR tracking (EOR / TIMESTAMP_TX) // (2) if the buffer includes the EOR byte appEorByteWriteFlags_ = flags & kEorRelevantWriteFlags; bool trackEor = appEorByteWriteFlags_ != folly::WriteFlags::NONE && (i + buffersStolen + 1 == count); bytes = eorAwareSSLWrite(ssl_, sslWriteBuf, int(len), trackEor); if (bytes <= 0) { int error = SSL_get_error(ssl_.get(), int(bytes)); if (error == SSL_ERROR_WANT_WRITE) { // The caller will register for write event if not already. *partialWritten = uint32_t(offset); return WriteResult(totalWritten); } auto writeResult = interpretSSLError(int(bytes), error); if (writeResult.writeReturn < 0) { return writeResult; } // else fall through to below to correctly record totalWritten } totalWritten += bytes; if (bytes == (ssize_t)len) { // The full iovec is written. (*countWritten) += 1 + buffersStolen; i += buffersStolen; // continue } else { bytes += offset; // adjust bytes to account for all of v while (bytes >= (ssize_t)v->iov_len) { // We combined this buf with part or all of the next one, and // we managed to write all of this buf but not all of the bytes // from the next one that we'd hoped to write. bytes -= v->iov_len; (*countWritten)++; v = &(vec[++i]); } *partialWritten = uint32_t(bytes); return WriteResult(totalWritten); } } return WriteResult(totalWritten); }
715
True
1
CVE-2019-11934
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://www.facebook.com/security/advisories/cve-2019-11934', 'name': 'https://www.facebook.com/security/advisories/cve-2019-11934', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/facebook/folly/commit/c321eb588909646c15aefde035fd3133ba32cdee', 'name': 'https://github.com/facebook/folly/commit/c321eb588909646c15aefde035fd3133ba32cdee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:folly:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2019.11.04.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Improper handling of close_notify alerts can result in an out-of-bounds read in AsyncSSLSocket. This issue affects folly prior to v2019.11.04.00.'}]
2019-12-13T19:28Z
2019-12-04T17:16Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Kyle Nekritz
2019-10-28 15:47:35-07:00
Handle close_notify as standard writeErr in AsyncSSLSocket. Summary: Fixes CVE-2019-11934 Reviewed By: mingtaoy Differential Revision: D18020613 fbshipit-source-id: db82bb250e53f0d225f1280bd67bc74abd417836
c321eb588909646c15aefde035fd3133ba32cdee
False
facebook/folly
An open-source C++ library developed and used at Facebook.
2012-06-01 20:49:04
2022-08-27 13:38:56
https://groups.google.com/forum/?fromgroups#!forum/facebook-folly
facebook
23010.0
4804.0
folly::ReadCallback::readDataAvailable
folly::ReadCallback::readDataAvailable( size_t len)
['len']
void readDataAvailable(size_t len) noexcept override { std::cerr << "readDataAvailable, len " << len << std::endl; currentBuffer.length = len; wcb_->setSocket(socket_); // Write back the same data. socket_->write(wcb_, currentBuffer.buffer, len, writeFlags); buffers.push_back(currentBuffer); currentBuffer.reset(); state = STATE_SUCCEEDED; }
69
True
1
CVE-2021-24036
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://hhvm.com/blog/2021/07/20/security-update.html', 'name': 'https://hhvm.com/blog/2021/07/20/security-update.html', 'refsource': 'CONFIRM', 'tags': ['Product', 'Vendor Advisory']}, {'url': 'https://github.com/facebook/folly/commit/4f304af1411e68851bdd00ef6140e9de4616f7d3', 'name': 'https://github.com/facebook/folly/commit/4f304af1411e68851bdd00ef6140e9de4616f7d3', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://www.facebook.com/security/advisories/cve-2021-24036', 'name': 'https://www.facebook.com/security/advisories/cve-2021-24036', 'refsource': 'CONFIRM', 'tags': ['Vendor Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:*:*:*:*:*:*:*:*', 'versionStartIncluding': '4.81.0', 'versionEndIncluding': '4.102.1', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:4.115.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:4.116.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:4.117.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:*:*:*:*:*:*:*:*', 'versionEndExcluding': '4.80.5', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:*:*:*:*:*:*:*:*', 'versionStartIncluding': '4.103.0', 'versionEndIncluding': '4.113.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:4.114.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:4.118.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:hhvm:4.118.1:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:folly:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2021.07.22.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Passing an attacker controlled size when creating an IOBuf could cause integer overflow, leading to an out of bounds write on the heap with the possibility of remote code execution. This issue affects versions of folly prior to v2021.07.22.00. This issue affects HHVM versions prior to 4.80.5, all versions between 4.81.0 and 4.102.1, all versions between 4.103.0 and 4.113.0, and versions 4.114.0, 4.115.0, 4.116.0, 4.117.0, 4.118.0 and 4.118.1.'}]
2021-08-04T17:38Z
2021-07-23T01:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Orvid
2021-07-20 09:06:10-07:00
[folly] Add additional overflow checks to IOBuf - CVE-2021-24036 Summary: As per title CVE-2021-24036 Reviewed By: jan Differential Revision: D27938605 fbshipit-source-id: 7481c54ae6fbb7b67b15b3631d5357c2f7043f9c
4f304af1411e68851bdd00ef6140e9de4616f7d3
False
facebook/folly
An open-source C++ library developed and used at Facebook.
2012-06-01 20:49:04
2022-08-27 13:38:56
https://groups.google.com/forum/?fromgroups#!forum/facebook-folly
facebook
23010.0
4804.0
folly::IOBuf::reserveSlow
folly::IOBuf::reserveSlow( std :: size_t minHeadroom , std :: size_t minTailroom)
['minHeadroom', 'minTailroom']
void IOBuf::reserveSlow(std::size_t minHeadroom, std::size_t minTailroom) { size_t newCapacity = (size_t)length_ + minHeadroom + minTailroom; DCHECK_LT(newCapacity, UINT32_MAX); // reserveSlow() is dangerous if anyone else is sharing the buffer, as we may // reallocate and free the original buffer. It should only ever be called if // we are the only user of the buffer. DCHECK(!isSharedOne()); // We'll need to reallocate the buffer. // There are a few options. // - If we have enough total room, move the data around in the buffer // and adjust the data_ pointer. // - If we're using an internal buffer, we'll switch to an external // buffer with enough headroom and tailroom. // - If we have enough headroom (headroom() >= minHeadroom) but not too much // (so we don't waste memory), we can try one of two things, depending on // whether we use jemalloc or not: // - If using jemalloc, we can try to expand in place, avoiding a memcpy() // - If not using jemalloc and we don't have too much to copy, // we'll use realloc() (note that realloc might have to copy // headroom + data + tailroom, see smartRealloc in folly/memory/Malloc.h) // - Otherwise, bite the bullet and reallocate. if (headroom() + tailroom() >= minHeadroom + minTailroom) { uint8_t* newData = writableBuffer() + minHeadroom; memmove(newData, data_, length_); data_ = newData; return; } size_t newAllocatedCapacity = 0; uint8_t* newBuffer = nullptr; std::size_t newHeadroom = 0; std::size_t oldHeadroom = headroom(); // If we have a buffer allocated with malloc and we just need more tailroom, // try to use realloc()/xallocx() to grow the buffer in place. SharedInfo* info = sharedInfo(); bool useHeapFullStorage = info && info->useHeapFullStorage; if (info && (info->freeFn == nullptr) && length_ != 0 && oldHeadroom >= minHeadroom) { size_t headSlack = oldHeadroom - minHeadroom; newAllocatedCapacity = goodExtBufferSize(newCapacity + headSlack); if (usingJEMalloc()) { // We assume that tailroom is more useful and more important than // headroom (not least because realloc / xallocx allow us to grow the // buffer at the tail, but not at the head) So, if we have more headroom // than we need, we consider that "wasted". We arbitrarily define "too // much" headroom to be 25% of the capacity. if (headSlack * 4 <= newCapacity) { size_t allocatedCapacity = capacity() + sizeof(SharedInfo); void* p = buf_; if (allocatedCapacity >= jemallocMinInPlaceExpandable) { if (xallocx(p, newAllocatedCapacity, 0, 0) == newAllocatedCapacity) { if (io_buf_free_cb) { io_buf_free_cb(p, reinterpret_cast<size_t>(info->userData)); } newBuffer = static_cast<uint8_t*>(p); newHeadroom = oldHeadroom; // update the userData info->userData = reinterpret_cast<void*>(newAllocatedCapacity); if (io_buf_alloc_cb) { io_buf_alloc_cb(newBuffer, newAllocatedCapacity); } } // if xallocx failed, do nothing, fall back to malloc/memcpy/free } } } else { // Not using jemalloc size_t copySlack = capacity() - length_; if (copySlack * 2 <= length_) { void* p = realloc(buf_, newAllocatedCapacity); if (UNLIKELY(p == nullptr)) { throw_exception<std::bad_alloc>(); } newBuffer = static_cast<uint8_t*>(p); newHeadroom = oldHeadroom; } } } // None of the previous reallocation strategies worked (or we're using // an internal buffer). malloc/copy/free. if (newBuffer == nullptr) { newAllocatedCapacity = goodExtBufferSize(newCapacity); newBuffer = static_cast<uint8_t*>(checkedMalloc(newAllocatedCapacity)); if (length_ > 0) { assert(data_ != nullptr); memcpy(newBuffer + minHeadroom, data_, length_); } if (sharedInfo()) { freeExtBuffer(); } newHeadroom = minHeadroom; } std::size_t cap; initExtBuffer(newBuffer, newAllocatedCapacity, &info, &cap); if (flags() & kFlagFreeSharedInfo) { delete sharedInfo(); } else { if (useHeapFullStorage) { SharedInfo::releaseStorage(sharedInfo()); } } setFlagsAndSharedInfo(0, info); capacity_ = cap; buf_ = newBuffer; data_ = newBuffer + newHeadroom; // length_ is unchanged }
500
True
1
CVE-2019-11940
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://www.facebook.com/security/advisories/cve-2019-11940', 'name': 'https://www.facebook.com/security/advisories/cve-2019-11940', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/facebook/proxygen/commit/f43b134cc5c19d8532e7fb670a1c02e85f7a8d4f', 'name': 'https://github.com/facebook/proxygen/commit/f43b134cc5c19d8532e7fb670a1c02e85f7a8d4f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-416'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:proxygen:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.29.0', 'versionEndIncluding': '2017.04.03.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In the course of decompressing HPACK inside the HTTP2 protocol, an unexpected sequence of header table resize operations can place the header table into a corrupted state, leading to a use-after-free condition and undefined behavior. This issue affects Proxygen from v0.29.0 until v2017.04.03.00.'}]
2019-12-17T20:18Z
2019-12-04T17:16Z
Use After Free
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.
The use of previously-freed memory can have any number of adverse consequences, ranging from the corruption of valid data to the execution of arbitrary code, depending on the instantiation and timing of the flaw. The simplest way data corruption may occur involves the system's reuse of the freed memory. Use-after-free errors have two common and sometimes overlapping causes: Error conditions and other exceptional circumstances. Confusion over which part of the program is responsible for freeing the memory. In this scenario, the memory in question is allocated to another pointer validly at some point after it has been freed. The original pointer to the freed memory is used again and points to somewhere within the new allocation. As the data is changed, it corrupts the validly used memory; this induces undefined behavior in the process. If the newly allocated data chances to hold a class, in C++ for example, various function pointers may be scattered within the heap data. If one of these function pointers is overwritten with an address to valid shellcode, execution of arbitrary code can be achieved.
https://cwe.mitre.org/data/definitions/416.html
0
Darrin D'Mello
2017-03-30 15:10:47-07:00
Fixing HPACK header table resize issue Summary: On resizing the header table down and then up again, a resize can be called against the underlying vector that actually sizes it down. This causes a lot of things to break as the code that does the resizing assumes the underlying vector is only ever resized up. Reviewed By: afrind Differential Revision: D4613681 fbshipit-source-id: 35b61cab53d5bc097424d6c779f90b7fdea42002
f43b134cc5c19d8532e7fb670a1c02e85f7a8d4f
False
facebook/proxygen
A collection of C++ HTTP libraries including an easy to use HTTP server.
2014-10-03 23:18:42
2022-08-27 06:59:38
null
facebook
7593.0
1450.0
proxygen::HeaderTable::setCapacity
proxygen::HeaderTable::setCapacity( uint32_t capacity)
['capacity']
void HeaderTable::setCapacity(uint32_t capacity) { auto oldCapacity = capacity_; capacity_ = capacity; if (capacity_ <= oldCapacity) { evict(0); } else { auto oldTail = tail(); auto oldLength = table_.size(); uint32_t newLength = (capacity_ >> 5) + 1; table_.resize(newLength); if (size_ > 0 && oldTail > head_) { // the list wrapped around, need to move oldTail..oldLength to the end of // the now-larger table_ std::copy(table_.begin() + oldTail, table_.begin() + oldLength, table_.begin() + newLength - (oldLength - oldTail)); // Update the names indecies that pointed to the old range for (auto& names_it: names_) { for (auto& idx: names_it.second) { if (idx >= oldTail) { DCHECK_LT(idx + (table_.size() - oldLength), table_.size()); idx += (table_.size() - oldLength); } else { // remaining indecies in the list were smaller than oldTail, so // should be indexed from 0 break; } } } } } }
184
True
1
CVE-2019-11940
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://www.facebook.com/security/advisories/cve-2019-11940', 'name': 'https://www.facebook.com/security/advisories/cve-2019-11940', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/facebook/proxygen/commit/f43b134cc5c19d8532e7fb670a1c02e85f7a8d4f', 'name': 'https://github.com/facebook/proxygen/commit/f43b134cc5c19d8532e7fb670a1c02e85f7a8d4f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-416'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:proxygen:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.29.0', 'versionEndIncluding': '2017.04.03.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In the course of decompressing HPACK inside the HTTP2 protocol, an unexpected sequence of header table resize operations can place the header table into a corrupted state, leading to a use-after-free condition and undefined behavior. This issue affects Proxygen from v0.29.0 until v2017.04.03.00.'}]
2019-12-17T20:18Z
2019-12-04T17:16Z
Use After Free
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.
The use of previously-freed memory can have any number of adverse consequences, ranging from the corruption of valid data to the execution of arbitrary code, depending on the instantiation and timing of the flaw. The simplest way data corruption may occur involves the system's reuse of the freed memory. Use-after-free errors have two common and sometimes overlapping causes: Error conditions and other exceptional circumstances. Confusion over which part of the program is responsible for freeing the memory. In this scenario, the memory in question is allocated to another pointer validly at some point after it has been freed. The original pointer to the freed memory is used again and points to somewhere within the new allocation. As the data is changed, it corrupts the validly used memory; this induces undefined behavior in the process. If the newly allocated data chances to hold a class, in C++ for example, various function pointers may be scattered within the heap data. If one of these function pointers is overwritten with an address to valid shellcode, execution of arbitrary code can be achieved.
https://cwe.mitre.org/data/definitions/416.html
0
Darrin D'Mello
2017-03-30 15:10:47-07:00
Fixing HPACK header table resize issue Summary: On resizing the header table down and then up again, a resize can be called against the underlying vector that actually sizes it down. This causes a lot of things to break as the code that does the resizing assumes the underlying vector is only ever resized up. Reviewed By: afrind Differential Revision: D4613681 fbshipit-source-id: 35b61cab53d5bc097424d6c779f90b7fdea42002
f43b134cc5c19d8532e7fb670a1c02e85f7a8d4f
False
facebook/proxygen
A collection of C++ HTTP libraries including an easy to use HTTP server.
2014-10-03 23:18:42
2022-08-27 06:59:38
null
facebook
7593.0
1450.0
proxygen::TEST_F
proxygen::TEST_F( HeaderTableTests , set_capacity)
['HeaderTableTests', 'set_capacity']
TEST_F(HeaderTableTests, set_capacity) { HPACKHeader accept("accept-encoding", "gzip"); uint32_t max = 10; uint32_t capacity = accept.bytes() * max; HeaderTable table(capacity); // fill the table for (size_t i = 0; i < max; i++) { EXPECT_EQ(table.add(accept), true); } // change capacity table.setCapacity(capacity / 2); EXPECT_EQ(table.size(), max / 2); EXPECT_EQ(table.bytes(), capacity / 2); }
101
True
1
CVE-2019-11921
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://www.facebook.com/security/advisories/cve-2019-11921', 'name': 'https://www.facebook.com/security/advisories/cve-2019-11921', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/facebook/proxygen/commit/2f07985bef9fbae124cc63e5c0272e32da4fdaec', 'name': 'https://github.com/facebook/proxygen/commit/2f07985bef9fbae124cc63e5c0272e32da4fdaec', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:proxygen:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2019.07.22.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'An out of bounds write is possible via a specially crafted packet in certain configurations of Proxygen due to improper handling of Base64 when parsing malformed binary content in Structured HTTP Headers. This issue affects versions of proxygen prior to v2019.07.22.00.'}]
2019-08-02T20:43Z
2019-07-25T21:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Aman Sharma
2019-07-19 16:38:48-07:00
Fix SEGV in StructuredHeaders::decodeBase64 Summary: The existing code can potentially cause a SEGV due to an out of bounds write. This fixes CVE-2019-11921. Reviewed By: knekritz Differential Revision: D12983120 fbshipit-source-id: 1d48063595c8d518fd8afcbc941de260af7e37fd
2f07985bef9fbae124cc63e5c0272e32da4fdaec
False
facebook/proxygen
A collection of C++ HTTP libraries including an easy to use HTTP server.
2014-10-03 23:18:42
2022-08-27 06:59:38
null
facebook
7593.0
1450.0
proxygen::StructuredHeaders::decodeBase64
proxygen::StructuredHeaders::decodeBase64( const std :: string & encoded)
['encoded']
std::string decodeBase64( const std::string& encoded) { if (encoded.size() == 0) { // special case, to prevent an integer overflow down below. return ""; } using namespace boost::archive::iterators; using b64it = transform_width<binary_from_base64<std::string::const_iterator>, 8, 6>; std::string decoded = std::string(b64it(std::begin(encoded)), b64it(std::end(encoded))); uint32_t numPadding = std::count(encoded.begin(), encoded.end(), '='); decoded.erase(decoded.end() - numPadding, decoded.end()); return decoded; }
127
True
1
CVE-2019-11921
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://www.facebook.com/security/advisories/cve-2019-11921', 'name': 'https://www.facebook.com/security/advisories/cve-2019-11921', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/facebook/proxygen/commit/2f07985bef9fbae124cc63e5c0272e32da4fdaec', 'name': 'https://github.com/facebook/proxygen/commit/2f07985bef9fbae124cc63e5c0272e32da4fdaec', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:facebook:proxygen:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2019.07.22.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'An out of bounds write is possible via a specially crafted packet in certain configurations of Proxygen due to improper handling of Base64 when parsing malformed binary content in Structured HTTP Headers. This issue affects versions of proxygen prior to v2019.07.22.00.'}]
2019-08-02T20:43Z
2019-07-25T21:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Aman Sharma
2019-07-19 16:38:48-07:00
Fix SEGV in StructuredHeaders::decodeBase64 Summary: The existing code can potentially cause a SEGV due to an out of bounds write. This fixes CVE-2019-11921. Reviewed By: knekritz Differential Revision: D12983120 fbshipit-source-id: 1d48063595c8d518fd8afcbc941de260af7e37fd
2f07985bef9fbae124cc63e5c0272e32da4fdaec
False
facebook/proxygen
A collection of C++ HTTP libraries including an easy to use HTTP server.
2014-10-03 23:18:42
2022-08-27 06:59:38
null
facebook
7593.0
1450.0
proxygen::StructuredHeaders::encodeBase64
proxygen::StructuredHeaders::encodeBase64( const std :: string & input)
['input']
std::string encodeBase64(const std::string& input) { using namespace boost::archive::iterators; using b64it = base64_from_binary<transform_width<const char*, 6, 8>>; auto data = input.data(); std::string encoded(b64it(data), b64it(data + (input.length()))); encoded.append((3 - (input.length() % 3)) % 3, '='); return encoded; }
95
True
1
CVE-2018-6346
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/facebook/proxygen/commit/52cf331743ebd74194d6343a6c2ec52bb917c982', 'name': 'https://github.com/facebook/proxygen/commit/52cf331743ebd74194d6343a6c2ec52bb917c982', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-388'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:proxygen_project:proxygen:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2018.12.31.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'A potential denial-of-service issue in the Proxygen handling of invalid HTTP2 priority settings (specifically a circular dependency). This affects Proxygen prior to v2018.12.31.00.'}]
2019-10-09T23:41Z
2018-12-31T22:29Z
7PK - Errors
This category represents one of the phyla in the Seven Pernicious Kingdoms vulnerability classification. It includes weaknesses that occur when an application does not properly handle errors that occur during processing. According to the authors of the Seven Pernicious Kingdoms, "Errors and error handling represent a class of API. Errors related to error handling are so common that they deserve a special kingdom of their own. As with 'API Abuse,' there are two ways to introduce an error-related security vulnerability: the most common one is handling errors poorly (or not at all). The second is producing errors that either give out too much information (to possible attackers) or are difficult to handle."
https://cwe.mitre.org/data/definitions/388.html
1
Jorge Lopez Silva
2018-12-27 12:44:29-08:00
Fix h2 codec state after bad priority header. Summary: It's possible for the http2 codec to enter an invalid state after processing a http2 header with invalid priorities. CVE-2018-6346 Reviewed By: maxgeorg Differential Revision: D13510025 fbshipit-source-id: 7c4e42daf1cd2b912454d13a66ab8488d1863263
52cf331743ebd74194d6343a6c2ec52bb917c982
False
facebook/proxygen
A collection of C++ HTTP libraries including an easy to use HTTP server.
2014-10-03 23:18:42
2022-08-27 06:59:38
null
facebook
7593.0
1450.0
proxygen::HTTP2Codec::parseHeadersDecodeFrames
proxygen::HTTP2Codec::parseHeadersDecodeFrames( const folly :: Optional<http2::PriorityUpdate> & priority , const folly :: Optional<uint32_t> & promisedStream , const folly :: Optional<ExAttributes> & exAttributes , std :: unique_ptr<HTTPMessage> & msg)
['priority', 'promisedStream', 'exAttributes', 'msg']
folly::Optional<ErrorCode> HTTP2Codec::parseHeadersDecodeFrames( const folly::Optional<http2::PriorityUpdate>& priority, const folly::Optional<uint32_t>& promisedStream, const folly::Optional<ExAttributes>& exAttributes, std::unique_ptr<HTTPMessage>& msg) { // decompress headers Cursor headerCursor(curHeaderBlock_.front()); bool isReq = false; if (promisedStream) { isReq = true; } else if (exAttributes) { isReq = isRequest(curHeader_.stream); } else { isReq = transportDirection_ == TransportDirection::DOWNSTREAM; } decodeInfo_.init(isReq, parsingDownstreamTrailers_); if (priority) { if (curHeader_.stream == priority->streamDependency) { streamError(folly::to<string>("Circular dependency for txn=", curHeader_.stream), ErrorCode::PROTOCOL_ERROR, curHeader_.type == http2::FrameType::HEADERS); return ErrorCode::NO_ERROR; } decodeInfo_.msg->setHTTP2Priority( std::make_tuple(priority->streamDependency, priority->exclusive, priority->weight)); } headerCodec_.decodeStreaming( headerCursor, curHeaderBlock_.chainLength(), this); msg = std::move(decodeInfo_.msg); // Saving this in case we need to log it on error auto g = folly::makeGuard([this] { curHeaderBlock_.move(); }); // Check decoding error if (decodeInfo_.decodeError != HPACK::DecodeError::NONE) { static const std::string decodeErrorMessage = "Failed decoding header block for stream="; // Avoid logging header blocks that have failed decoding due to being // excessively large. if (decodeInfo_.decodeError != HPACK::DecodeError::HEADERS_TOO_LARGE) { LOG(ERROR) << decodeErrorMessage << curHeader_.stream << " header block="; VLOG(3) << IOBufPrinter::printHexFolly(curHeaderBlock_.front(), true); } else { LOG(ERROR) << decodeErrorMessage << curHeader_.stream; } if (msg) { // print the partial message msg->dumpMessage(3); } return ErrorCode::COMPRESSION_ERROR; } // Check parsing error if (decodeInfo_.parsingError != "") { LOG(ERROR) << "Failed parsing header list for stream=" << curHeader_.stream << ", error=" << decodeInfo_.parsingError << ", header block="; VLOG(3) << IOBufPrinter::printHexFolly(curHeaderBlock_.front(), true); HTTPException err(HTTPException::Direction::INGRESS, folly::to<std::string>("HTTP2Codec stream error: ", "stream=", curHeader_.stream, " status=", 400, " error: ", decodeInfo_.parsingError)); err.setHttpStatusCode(400); callback_->onError(curHeader_.stream, err, true); return ErrorCode::NO_ERROR; } return folly::Optional<ErrorCode>(); }
464
True
1
CVE-2018-6347
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/facebook/proxygen/commit/223e0aa6bc7590e86af1e917185a2e0efe160711', 'name': 'https://github.com/facebook/proxygen/commit/223e0aa6bc7590e86af1e917185a2e0efe160711', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-20'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:proxygen_project:proxygen:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2018.12.31.00', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'An issue in the Proxygen handling of HTTP2 parsing of headers/trailers can lead to a denial-of-service attack. This affects Proxygen prior to v2018.12.31.00.'}]
2019-10-09T23:41Z
2018-12-31T22:29Z
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
Input validation is a frequently-used technique for checking potentially dangerous inputs in order to ensure that the inputs are safe for processing within the code, or when communicating with other components. When software does not validate input properly, an attacker is able to craft the input in a form that is not expected by the rest of the application. This will lead to parts of the system receiving unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution. Input validation is not the only technique for processing input, however. Other techniques attempt to transform potentially-dangerous input into something safe, such as filtering (CWE-790) - which attempts to remove dangerous inputs - or encoding/escaping (CWE-116), which attempts to ensure that the input is not misinterpreted when it is included in output to another component. Other techniques exist as well (see CWE-138 for more examples.) Input validation can be applied to: raw data - strings, numbers, parameters, file contents, etc. metadata - information about the raw data, such as headers or size Data can be simple or structured. Structured data can be composed of many nested layers, composed of combinations of metadata and raw data, with other simple or structured data. Many properties of raw data or metadata may need to be validated upon entry into the code, such as: specified quantities such as size, length, frequency, price, rate, number of operations, time, etc. implied or derived quantities, such as the actual size of a file instead of a specified size indexes, offsets, or positions into more complex data structures symbolic keys or other elements into hash tables, associative arrays, etc. well-formedness, i.e. syntactic correctness - compliance with expected syntax lexical token correctness - compliance with rules for what is treated as a token specified or derived type - the actual type of the input (or what the input appears to be) consistency - between individual data elements, between raw data and metadata, between references, etc. conformance to domain-specific rules, e.g. business logic equivalence - ensuring that equivalent inputs are treated the same authenticity, ownership, or other attestations about the input, e.g. a cryptographic signature to prove the source of the data Implied or derived properties of data must often be calculated or inferred by the code itself. Errors in deriving properties may be considered a contributing factor to improper input validation. Note that "input validation" has very different meanings to different people, or within different classification schemes. Caution must be used when referencing this CWE entry or mapping to it. For example, some weaknesses might involve inadvertently giving control to an attacker over an input when they should not be able to provide an input at all, but sometimes this is referred to as input validation. Finally, it is important to emphasize that the distinctions between input validation and output escaping are often blurred, and developers must be careful to understand the difference, including how input validation is not always sufficient to prevent vulnerabilities, especially when less stringent data types must be supported, such as free-form text. Consider a SQL injection scenario in which a person's last name is inserted into a query. The name "O'Reilly" would likely pass the validation step since it is a common last name in the English language. However, this valid name cannot be directly inserted into the database because it contains the "'" apostrophe character, which would need to be escaped or otherwise transformed. In this case, removing the apostrophe might reduce the risk of SQL injection, but it would produce incorrect behavior because the wrong name would be recorded.
https://cwe.mitre.org/data/definitions/20.html
0
Alan Frindell
2018-12-27 16:11:46-08:00
Don't lower lastStreamID_ Summary: This could throw off the logic about what is headers/trailers CVE-2018-6347 Reviewed By: avasylev, bolekk Differential Revision: D13521704 fbshipit-source-id: ed436ff13f191bf04764494973fcb73b35ed1256
223e0aa6bc7590e86af1e917185a2e0efe160711
False
facebook/proxygen
A collection of C++ HTTP libraries including an easy to use HTTP server.
2014-10-03 23:18:42
2022-08-27 06:59:38
null
facebook
7593.0
1450.0
proxygen::HTTP2Codec::checkNewStream
proxygen::HTTP2Codec::checkNewStream( uint32_t streamId , bool trailersAllowed)
['streamId', 'trailersAllowed']
ErrorCode HTTP2Codec::checkNewStream(uint32_t streamId, bool trailersAllowed) { if (streamId == 0) { goawayErrorMessage_ = folly::to<string>( "GOAWAY error: received streamID=", streamId, " as invalid new stream for lastStreamID_=", lastStreamID_); VLOG(4) << goawayErrorMessage_; return ErrorCode::PROTOCOL_ERROR; } parsingDownstreamTrailers_ = trailersAllowed && (streamId <= lastStreamID_); if (parsingDownstreamTrailers_) { VLOG(4) << "Parsing downstream trailers streamId=" << streamId; } if (sessionClosing_ != ClosingState::CLOSED) { lastStreamID_ = streamId; } if (isInitiatedStream(streamId)) { // this stream should be initiated by us, not by peer goawayErrorMessage_ = folly::to<string>( "GOAWAY error: invalid new stream received with streamID=", streamId); VLOG(4) << goawayErrorMessage_; return ErrorCode::PROTOCOL_ERROR; } else { return ErrorCode::NO_ERROR; } }
136
True
1
CVE-2021-30145
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
7.8
HIGH
1.8
5.9
False
[{'url': 'https://devel0pment.de/?p=2217', 'name': 'https://devel0pment.de/?p=2217', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/mpv-player/mpv/releases/tag/v0.33.1', 'name': 'https://github.com/mpv-player/mpv/releases/tag/v0.33.1', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://mpv.io', 'name': 'https://mpv.io', 'refsource': 'MISC', 'tags': ['Product', 'Vendor Advisory']}, {'url': 'https://github.com/mpv-player/mpv/commit/d0c530919d8cd4d7a774e38ab064e0fabdae34e6', 'name': 'https://github.com/mpv-player/mpv/commit/d0c530919d8cd4d7a774e38ab064e0fabdae34e6', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202107-46', 'name': 'GLSA-202107-46', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-134'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:mpv:mpv:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.33.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'A format string vulnerability in mpv through 0.33.0 allows user-assisted remote attackers to achieve code execution via a crafted m3u playlist file.'}]
2022-05-20T20:45Z
2021-05-18T14:15Z
Use of Externally-Controlled Format String
The software uses a function that accepts a format string as an argument, but the format string originates from an external source.
When an attacker can modify an externally-controlled format string, this can lead to buffer overflows, denial of service, or data representation problems. It should be noted that in some circumstances, such as internationalization, the set of format strings is externally controlled by design. If the source of these format strings is trusted (e.g. only contained in library files that are only modifiable by the system administrator), then the external control might not itself pose a vulnerability.
https://cwe.mitre.org/data/definitions/134.html
0
Avi Halachmi (:avih)
2021-04-04 14:11:15+03:00
demux_mf: improve format string processing Before this commit, the user could specify a printf format string which wasn't verified, and could result in: - Undefined behavior due to missing or non-matching arguments. - Buffer overflow due to untested result length. The offending code was added at commit 103a9609 (2002, mplayer svn): git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4566 b3059339-0415-0410-9bf9-f77b7e298cf2 It moved around but was not modified meaningfully until now. Now we reject all conversion specifiers at the format except %% and a simple subset of the valid specifiers. Also, we now use snprintf to avoid buffer overflow. The format string is provided by the user as part of mf:// URI. Report and initial patch by Stefan Schiller. Patch reviewed by @jeeb, @sfan5, Stefan Schiller.
d0c530919d8cd4d7a774e38ab064e0fabdae34e6
False
mpv-player/mpv
🎥 Command line video player
2012-10-13 08:08:44
2022-08-27 17:53:05
https://mpv.io
mpv-player
19815.0
2380.0
open_mf_pattern
open_mf_pattern( void * talloc_ctx , struct demuxer * d , char * filename)
['talloc_ctx', 'd', 'filename']
static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename) { struct mp_log *log = d->log; int error_count = 0; int count = 0; mf_t *mf = talloc_zero(talloc_ctx, mf_t); mf->log = log; if (filename[0] == '@') { struct stream *s = stream_create(filename + 1, d->stream_origin | STREAM_READ, d->cancel, d->global); if (s) { while (1) { char buf[512]; int len = stream_read_peek(s, buf, sizeof(buf)); if (!len) break; bstr data = (bstr){buf, len}; int pos = bstrchr(data, '\n'); data = bstr_splice(data, 0, pos < 0 ? data.len : pos + 1); bstr fname = bstr_strip(data); if (fname.len) { if (bstrchr(fname, '\0') >= 0) { mp_err(log, "invalid filename\n"); break; } char *entry = bstrto0(mf, fname); if (!mp_path_exists(entry)) { mp_verbose(log, "file not found: '%s'\n", entry); } else { MP_TARRAY_APPEND(mf, mf->names, mf->nr_of_files, entry); } } stream_seek_skip(s, stream_tell(s) + data.len); } free_stream(s); mp_info(log, "number of files: %d\n", mf->nr_of_files); goto exit_mf; } mp_info(log, "%s is not indirect filelist\n", filename + 1); } if (strchr(filename, ',')) { mp_info(log, "filelist: %s\n", filename); bstr bfilename = bstr0(filename); while (bfilename.len) { bstr bfname; bstr_split_tok(bfilename, ",", &bfname, &bfilename); char *fname2 = bstrdup0(mf, bfname); if (!mp_path_exists(fname2)) mp_verbose(log, "file not found: '%s'\n", fname2); else { mf_add(mf, fname2); } talloc_free(fname2); } mp_info(log, "number of files: %d\n", mf->nr_of_files); goto exit_mf; } char *fname = talloc_size(mf, strlen(filename) + 32); #if HAVE_GLOB if (!strchr(filename, '%')) { strcpy(fname, filename); if (!strchr(filename, '*')) strcat(fname, "*"); mp_info(log, "search expr: %s\n", fname); glob_t gg; if (glob(fname, 0, NULL, &gg)) { talloc_free(mf); return NULL; } for (int i = 0; i < gg.gl_pathc; i++) { if (mp_path_isdir(gg.gl_pathv[i])) continue; mf_add(mf, gg.gl_pathv[i]); } mp_info(log, "number of files: %d\n", mf->nr_of_files); globfree(&gg); goto exit_mf; } #endif mp_info(log, "search expr: %s\n", filename); while (error_count < 5) { sprintf(fname, filename, count++); if (!mp_path_exists(fname)) { error_count++; mp_verbose(log, "file not found: '%s'\n", fname); } else { mf_add(mf, fname); } } mp_info(log, "number of files: %d\n", mf->nr_of_files); exit_mf: return mf; }
639
True
1
CVE-2021-21261
False
False
False
False
AV:L/AC:L/Au:N/C:C/I:C/A:C
LOCAL
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
7.2
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
LOCAL
LOW
LOW
NONE
CHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.0
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/releases/tag/1.8.5', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.8.5', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2021/dsa-4830', 'name': 'DSA-4830', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba', 'name': 'https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486', 'name': 'https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4', 'name': 'https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b', 'name': 'https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202101-21', 'name': 'GLSA-202101-21', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-74'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.9.1', 'versionEndExcluding': '1.10.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.11.4', 'versionEndExcluding': '1.8.5', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. A bug was discovered in the `flatpak-portal` service that can allow sandboxed applications to execute arbitrary code on the host system (a sandbox escape). This sandbox-escape bug is present in versions from 0.11.4 and before fixed versions 1.8.5 and 1.10.0. The Flatpak portal D-Bus service (`flatpak-portal`, also known by its D-Bus service name `org.freedesktop.portal.Flatpak`) allows apps in a Flatpak sandbox to launch their own subprocesses in a new sandbox instance, either with the same security settings as the caller or with more restrictive security settings. For example, this is used in Flatpak-packaged web browsers such as Chromium to launch subprocesses that will process untrusted web content, and give those subprocesses a more restrictive sandbox than the browser itself. In vulnerable versions, the Flatpak portal service passes caller-specified environment variables to non-sandboxed processes on the host system, and in particular to the `flatpak run` command that is used to launch the new sandbox instance. A malicious or compromised Flatpak app could set environment variables that are trusted by the `flatpak run` command, and use them to execute arbitrary code that is not in a sandbox. As a workaround, this vulnerability can be mitigated by preventing the `flatpak-portal` service from starting, but that mitigation will prevent many Flatpak apps from working correctly. This is fixed in versions 1.8.5 and 1.10.0.'}]
2021-01-27T19:34Z
2021-01-14T20:15Z
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
Software has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
https://cwe.mitre.org/data/definitions/74.html
0
Simon McVittie
2021-01-10 16:11:28+00:00
run: Convert all environment variables into bwrap arguments This avoids some of them being filtered out by a setuid bwrap. It also means that if they came from an untrusted source, they cannot be used to inject arbitrary code into a non-setuid bwrap via mechanisms like LD_PRELOAD. Because they get bundled into a memfd or temporary file, they do not actually appear in argv, ensuring that they remain inaccessible to processes running under a different uid (which is important if their values are tokens or other secrets). Signed-off-by: Simon McVittie <[email protected]> Part-of: https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2
6d1773d2a54dde9b099043f07a2094a4f1c2f486
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_run_add_environment_args
flatpak_run_add_environment_args( FlatpakBwrap * bwrap , const char * app_info_path , FlatpakRunFlags flags , const char * app_id , FlatpakContext * context , GFile * app_id_dir , GPtrArray * previous_app_id_dirs , FlatpakExports ** exports_out , GCancellable * cancellable , GError ** error)
['bwrap', 'app_info_path', 'flags', 'app_id', 'context', 'app_id_dir', 'previous_app_id_dirs', 'exports_out', 'cancellable', 'error']
flatpak_run_add_environment_args (FlatpakBwrap *bwrap, const char *app_info_path, FlatpakRunFlags flags, const char *app_id, FlatpakContext *context, GFile *app_id_dir, GPtrArray *previous_app_id_dirs, FlatpakExports **exports_out, GCancellable *cancellable, GError **error) { g_autoptr(GError) my_error = NULL; g_autoptr(FlatpakExports) exports = NULL; g_autoptr(FlatpakBwrap) proxy_arg_bwrap = flatpak_bwrap_new (flatpak_bwrap_empty_env); gboolean has_wayland = FALSE; gboolean allow_x11 = FALSE; if ((context->shares & FLATPAK_CONTEXT_SHARED_IPC) == 0) { g_debug ("Disallowing ipc access"); flatpak_bwrap_add_args (bwrap, "--unshare-ipc", NULL); } if ((context->shares & FLATPAK_CONTEXT_SHARED_NETWORK) == 0) { g_debug ("Disallowing network access"); flatpak_bwrap_add_args (bwrap, "--unshare-net", NULL); } if (context->devices & FLATPAK_CONTEXT_DEVICE_ALL) { flatpak_bwrap_add_args (bwrap, "--dev-bind", "/dev", "/dev", NULL); /* Don't expose the host /dev/shm, just the device nodes, unless explicitly allowed */ if (g_file_test ("/dev/shm", G_FILE_TEST_IS_DIR)) { if ((context->devices & FLATPAK_CONTEXT_DEVICE_SHM) == 0) flatpak_bwrap_add_args (bwrap, "--tmpfs", "/dev/shm", NULL); } else if (g_file_test ("/dev/shm", G_FILE_TEST_IS_SYMLINK)) { g_autofree char *link = flatpak_readlink ("/dev/shm", NULL); /* On debian (with sysv init) the host /dev/shm is a symlink to /run/shm, so we can't mount on top of it. */ if (g_strcmp0 (link, "/run/shm") == 0) { if (context->devices & FLATPAK_CONTEXT_DEVICE_SHM && g_file_test ("/run/shm", G_FILE_TEST_IS_DIR)) flatpak_bwrap_add_args (bwrap, "--bind", "/run/shm", "/run/shm", NULL); else flatpak_bwrap_add_args (bwrap, "--dir", "/run/shm", NULL); } else g_warning ("Unexpected /dev/shm symlink %s", link); } } else { flatpak_bwrap_add_args (bwrap, "--dev", "/dev", NULL); if (context->devices & FLATPAK_CONTEXT_DEVICE_DRI) { g_debug ("Allowing dri access"); int i; char *dri_devices[] = { "/dev/dri", /* mali */ "/dev/mali", "/dev/mali0", "/dev/umplock", /* nvidia */ "/dev/nvidiactl", "/dev/nvidia-modeset", /* nvidia OpenCL/CUDA */ "/dev/nvidia-uvm", "/dev/nvidia-uvm-tools", }; for (i = 0; i < G_N_ELEMENTS (dri_devices); i++) { if (g_file_test (dri_devices[i], G_FILE_TEST_EXISTS)) flatpak_bwrap_add_args (bwrap, "--dev-bind", dri_devices[i], dri_devices[i], NULL); } /* Each Nvidia card gets its own device. This is a fairly arbitrary limit but ASUS sells mining boards supporting 20 in theory. */ char nvidia_dev[14]; /* /dev/nvidia plus up to 2 digits */ for (i = 0; i < 20; i++) { g_snprintf (nvidia_dev, sizeof (nvidia_dev), "/dev/nvidia%d", i); if (g_file_test (nvidia_dev, G_FILE_TEST_EXISTS)) flatpak_bwrap_add_args (bwrap, "--dev-bind", nvidia_dev, nvidia_dev, NULL); } } if (context->devices & FLATPAK_CONTEXT_DEVICE_KVM) { g_debug ("Allowing kvm access"); if (g_file_test ("/dev/kvm", G_FILE_TEST_EXISTS)) flatpak_bwrap_add_args (bwrap, "--dev-bind", "/dev/kvm", "/dev/kvm", NULL); } if (context->devices & FLATPAK_CONTEXT_DEVICE_SHM) { /* This is a symlink to /run/shm on debian, so bind to real target */ g_autofree char *real_dev_shm = realpath ("/dev/shm", NULL); g_debug ("Allowing /dev/shm access (as %s)", real_dev_shm); if (real_dev_shm != NULL) flatpak_bwrap_add_args (bwrap, "--bind", real_dev_shm, "/dev/shm", NULL); } } flatpak_context_append_bwrap_filesystem (context, bwrap, app_id, app_id_dir, previous_app_id_dirs, &exports); if (context->sockets & FLATPAK_CONTEXT_SOCKET_WAYLAND) { g_debug ("Allowing wayland access"); has_wayland = flatpak_run_add_wayland_args (bwrap); } if ((context->sockets & FLATPAK_CONTEXT_SOCKET_FALLBACK_X11) != 0) allow_x11 = !has_wayland; else allow_x11 = (context->sockets & FLATPAK_CONTEXT_SOCKET_X11) != 0; flatpak_run_add_x11_args (bwrap, allow_x11); if (context->sockets & FLATPAK_CONTEXT_SOCKET_SSH_AUTH) { flatpak_run_add_ssh_args (bwrap); } if (context->sockets & FLATPAK_CONTEXT_SOCKET_PULSEAUDIO) { g_debug ("Allowing pulseaudio access"); flatpak_run_add_pulseaudio_args (bwrap); } if (context->sockets & FLATPAK_CONTEXT_SOCKET_PCSC) { flatpak_run_add_pcsc_args (bwrap); } if (context->sockets & FLATPAK_CONTEXT_SOCKET_CUPS) { flatpak_run_add_cups_args (bwrap); } flatpak_run_add_session_dbus_args (bwrap, proxy_arg_bwrap, context, flags, app_id); flatpak_run_add_system_dbus_args (bwrap, proxy_arg_bwrap, context, flags); flatpak_run_add_a11y_dbus_args (bwrap, proxy_arg_bwrap, context, flags); if (g_environ_getenv (bwrap->envp, "LD_LIBRARY_PATH") != NULL) { /* LD_LIBRARY_PATH is overridden for setuid helper, so pass it as cmdline arg */ flatpak_bwrap_add_args (bwrap, "--setenv", "LD_LIBRARY_PATH", g_environ_getenv (bwrap->envp, "LD_LIBRARY_PATH"), NULL); flatpak_bwrap_unset_env (bwrap, "LD_LIBRARY_PATH"); } if (g_environ_getenv (bwrap->envp, "TMPDIR") != NULL) { /* TMPDIR is overridden for setuid helper, so pass it as cmdline arg */ flatpak_bwrap_add_args (bwrap, "--setenv", "TMPDIR", g_environ_getenv (bwrap->envp, "TMPDIR"), NULL); flatpak_bwrap_unset_env (bwrap, "TMPDIR"); } /* Must run this before spawning the dbus proxy, to ensure it ends up in the app cgroup */ if (!flatpak_run_in_transient_unit (app_id, &my_error)) { /* We still run along even if we don't get a cgroup, as nothing really depends on it. Its just nice to have */ g_debug ("Failed to run in transient scope: %s", my_error->message); g_clear_error (&my_error); } if (!flatpak_bwrap_is_empty (proxy_arg_bwrap) && !start_dbus_proxy (bwrap, proxy_arg_bwrap, app_info_path, error)) return FALSE; if (exports_out) *exports_out = g_steal_pointer (&exports); return TRUE; }
854
True
1
CVE-2021-21261
False
False
False
False
AV:L/AC:L/Au:N/C:C/I:C/A:C
LOCAL
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
7.2
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
LOCAL
LOW
LOW
NONE
CHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.0
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/releases/tag/1.8.5', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.8.5', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2021/dsa-4830', 'name': 'DSA-4830', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba', 'name': 'https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486', 'name': 'https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4', 'name': 'https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b', 'name': 'https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202101-21', 'name': 'GLSA-202101-21', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-74'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.9.1', 'versionEndExcluding': '1.10.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.11.4', 'versionEndExcluding': '1.8.5', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. A bug was discovered in the `flatpak-portal` service that can allow sandboxed applications to execute arbitrary code on the host system (a sandbox escape). This sandbox-escape bug is present in versions from 0.11.4 and before fixed versions 1.8.5 and 1.10.0. The Flatpak portal D-Bus service (`flatpak-portal`, also known by its D-Bus service name `org.freedesktop.portal.Flatpak`) allows apps in a Flatpak sandbox to launch their own subprocesses in a new sandbox instance, either with the same security settings as the caller or with more restrictive security settings. For example, this is used in Flatpak-packaged web browsers such as Chromium to launch subprocesses that will process untrusted web content, and give those subprocesses a more restrictive sandbox than the browser itself. In vulnerable versions, the Flatpak portal service passes caller-specified environment variables to non-sandboxed processes on the host system, and in particular to the `flatpak run` command that is used to launch the new sandbox instance. A malicious or compromised Flatpak app could set environment variables that are trusted by the `flatpak run` command, and use them to execute arbitrary code that is not in a sandbox. As a workaround, this vulnerability can be mitigated by preventing the `flatpak-portal` service from starting, but that mitigation will prevent many Flatpak apps from working correctly. This is fixed in versions 1.8.5 and 1.10.0.'}]
2021-01-27T19:34Z
2021-01-14T20:15Z
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
Software has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
https://cwe.mitre.org/data/definitions/74.html
0
Simon McVittie
2021-01-12 10:11:51+00:00
portal: Convert --env in extra-args into --env-fd This hides overridden variables from the command-line, which means processes running under other uids can't see them in /proc/*/cmdline, which might be important if they contain secrets. Signed-off-by: Simon McVittie <[email protected]> Part-of: https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2
aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
handle_spawn
handle_spawn( PortalFlatpak * object , GDBusMethodInvocation * invocation , GUnixFDList * fd_list , const gchar * arg_cwd_path , const gchar * const * arg_argv , GVariant * arg_fds , GVariant * arg_envs , guint arg_flags , GVariant * arg_options)
['object', 'invocation', 'fd_list', 'arg_cwd_path', 'arg_argv', 'arg_fds', 'arg_envs', 'arg_flags', 'arg_options']
handle_spawn (PortalFlatpak *object, GDBusMethodInvocation *invocation, GUnixFDList *fd_list, const gchar *arg_cwd_path, const gchar *const *arg_argv, GVariant *arg_fds, GVariant *arg_envs, guint arg_flags, GVariant *arg_options) { g_autoptr(GError) error = NULL; ChildSetupData child_setup_data = { NULL }; GPid pid; PidData *pid_data; InstanceIdReadData *instance_id_read_data = NULL; gsize i, j, n_fds, n_envs; const gint *fds = NULL; gint fds_len = 0; g_autofree FdMapEntry *fd_map = NULL; gchar **env; gint32 max_fd; GKeyFile *app_info; g_autoptr(GPtrArray) flatpak_argv = g_ptr_array_new_with_free_func (g_free); g_autofree char *app_id = NULL; g_autofree char *branch = NULL; g_autofree char *arch = NULL; g_autofree char *app_commit = NULL; g_autofree char *runtime_ref = NULL; g_auto(GStrv) runtime_parts = NULL; g_autofree char *runtime_commit = NULL; g_autofree char *instance_path = NULL; g_auto(GStrv) extra_args = NULL; g_auto(GStrv) shares = NULL; g_auto(GStrv) sockets = NULL; g_auto(GStrv) devices = NULL; g_auto(GStrv) sandbox_expose = NULL; g_auto(GStrv) sandbox_expose_ro = NULL; g_autoptr(GVariant) sandbox_expose_fd = NULL; g_autoptr(GVariant) sandbox_expose_fd_ro = NULL; g_autoptr(GOutputStream) instance_id_out_stream = NULL; guint sandbox_flags = 0; gboolean sandboxed; gboolean expose_pids; gboolean share_pids; gboolean notify_start; gboolean devel; child_setup_data.instance_id_fd = -1; if (fd_list != NULL) fds = g_unix_fd_list_peek_fds (fd_list, &fds_len); app_info = g_object_get_data (G_OBJECT (invocation), "app-info"); g_assert (app_info != NULL); app_id = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_NAME, NULL); g_assert (app_id != NULL); g_debug ("spawn() called from app: '%s'", app_id); if (*app_id == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "org.freedesktop.portal.Flatpak.Spawn only works in a flatpak"); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (*arg_cwd_path == 0) arg_cwd_path = NULL; if (arg_argv == NULL || *arg_argv == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No command given"); return G_DBUS_METHOD_INVOCATION_HANDLED; } if ((arg_flags & ~FLATPAK_SPAWN_FLAGS_ALL) != 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Unsupported flags enabled: 0x%x", arg_flags & ~FLATPAK_SPAWN_FLAGS_ALL); return G_DBUS_METHOD_INVOCATION_HANDLED; } runtime_ref = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_RUNTIME, NULL); if (runtime_ref == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No runtime found"); return G_DBUS_METHOD_INVOCATION_HANDLED; } runtime_parts = g_strsplit (runtime_ref, "/", -1); branch = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_BRANCH, NULL); instance_path = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_INSTANCE_PATH, NULL); arch = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_ARCH, NULL); extra_args = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_EXTRA_ARGS, NULL, NULL); app_commit = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_APP_COMMIT, NULL); runtime_commit = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_RUNTIME_COMMIT, NULL); shares = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SHARED, NULL, NULL); sockets = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SOCKETS, NULL, NULL); devices = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_DEVICES, NULL, NULL); devel = g_key_file_get_boolean (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_DEVEL, NULL); g_variant_lookup (arg_options, "sandbox-expose", "^as", &sandbox_expose); g_variant_lookup (arg_options, "sandbox-expose-ro", "^as", &sandbox_expose_ro); g_variant_lookup (arg_options, "sandbox-flags", "u", &sandbox_flags); sandbox_expose_fd = g_variant_lookup_value (arg_options, "sandbox-expose-fd", G_VARIANT_TYPE ("ah")); sandbox_expose_fd_ro = g_variant_lookup_value (arg_options, "sandbox-expose-fd-ro", G_VARIANT_TYPE ("ah")); if ((sandbox_flags & ~FLATPAK_SPAWN_SANDBOX_FLAGS_ALL) != 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Unsupported sandbox flags enabled: 0x%x", arg_flags & ~FLATPAK_SPAWN_SANDBOX_FLAGS_ALL); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (instance_path == NULL && ((sandbox_expose != NULL && sandbox_expose[0] != NULL) || (sandbox_expose_ro != NULL && sandbox_expose_ro[0] != NULL))) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Invalid sandbox expose, caller has no instance path"); return G_DBUS_METHOD_INVOCATION_HANDLED; } for (i = 0; sandbox_expose != NULL && sandbox_expose[i] != NULL; i++) { const char *expose = sandbox_expose[i]; g_debug ("exposing %s", expose); if (!is_valid_expose (expose, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } } for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) { const char *expose = sandbox_expose_ro[i]; g_debug ("exposing %s", expose); if (!is_valid_expose (expose, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } } g_debug ("Running spawn command %s", arg_argv[0]); n_fds = 0; if (fds != NULL) n_fds = g_variant_n_children (arg_fds); fd_map = g_new0 (FdMapEntry, n_fds); child_setup_data.fd_map = fd_map; child_setup_data.fd_map_len = n_fds; max_fd = -1; for (i = 0; i < n_fds; i++) { gint32 handle, dest_fd; int handle_fd; g_variant_get_child (arg_fds, i, "{uh}", &dest_fd, &handle); if (handle >= fds_len || handle < 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No file descriptor for handle %d", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } handle_fd = fds[handle]; fd_map[i].to = dest_fd; fd_map[i].from = handle_fd; fd_map[i].final = fd_map[i].to; /* If stdin/out/err is a tty we try to set it as the controlling tty for the app, this way we can use this to run in a terminal. */ if ((dest_fd == 0 || dest_fd == 1 || dest_fd == 2) && !child_setup_data.set_tty && isatty (handle_fd)) { child_setup_data.set_tty = TRUE; child_setup_data.tty = handle_fd; } max_fd = MAX (max_fd, fd_map[i].to); max_fd = MAX (max_fd, fd_map[i].from); } /* We make a second pass over the fds to find if any "to" fd index overlaps an already in use fd (i.e. one in the "from" category that are allocated randomly). If a fd overlaps "to" fd then its a caller issue and not our fault, so we ignore that. */ for (i = 0; i < n_fds; i++) { int to_fd = fd_map[i].to; gboolean conflict = FALSE; /* At this point we're fine with using "from" values for this value (because we handle to==from in the code), or values that are before "i" in the fd_map (because those will be closed at this point when dup:ing). However, we can't reuse a fd that is in "from" for j > i. */ for (j = i + 1; j < n_fds; j++) { int from_fd = fd_map[j].from; if (from_fd == to_fd) { conflict = TRUE; break; } } if (conflict) fd_map[i].to = ++max_fd; } if (arg_flags & FLATPAK_SPAWN_FLAGS_CLEAR_ENV) { char *empty[] = { NULL }; env = g_strdupv (empty); } else env = g_get_environ (); n_envs = g_variant_n_children (arg_envs); for (i = 0; i < n_envs; i++) { const char *var = NULL; const char *val = NULL; g_variant_get_child (arg_envs, i, "{&s&s}", &var, &val); env = g_environ_setenv (env, var, val, TRUE); } g_ptr_array_add (flatpak_argv, g_strdup ("flatpak")); g_ptr_array_add (flatpak_argv, g_strdup ("run")); sandboxed = (arg_flags & FLATPAK_SPAWN_FLAGS_SANDBOX) != 0; if (sandboxed) { g_ptr_array_add (flatpak_argv, g_strdup ("--sandbox")); if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_DISPLAY) { if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "wayland")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=wayland")); if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "fallback-x11")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=fallback-x11")); if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "x11")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=x11")); if (shares != NULL && g_strv_contains ((const char * const *) shares, "ipc") && sockets != NULL && (g_strv_contains ((const char * const *) sockets, "fallback-x11") || g_strv_contains ((const char * const *) sockets, "x11"))) g_ptr_array_add (flatpak_argv, g_strdup ("--share=ipc")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_SOUND) { if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "pulseaudio")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=pulseaudio")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_GPU) { if (devices != NULL && (g_strv_contains ((const char * const *) devices, "dri") || g_strv_contains ((const char * const *) devices, "all"))) g_ptr_array_add (flatpak_argv, g_strdup ("--device=dri")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_ALLOW_DBUS) g_ptr_array_add (flatpak_argv, g_strdup ("--session-bus")); if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_ALLOW_A11Y) g_ptr_array_add (flatpak_argv, g_strdup ("--a11y-bus")); } else { for (i = 0; extra_args != NULL && extra_args[i] != NULL; i++) g_ptr_array_add (flatpak_argv, g_strdup (extra_args[i])); } expose_pids = (arg_flags & FLATPAK_SPAWN_FLAGS_EXPOSE_PIDS) != 0; share_pids = (arg_flags & FLATPAK_SPAWN_FLAGS_SHARE_PIDS) != 0; if (expose_pids || share_pids) { g_autofree char *instance_id = NULL; int sender_pid1 = 0; if (!(supports & FLATPAK_SPAWN_SUPPORT_FLAGS_EXPOSE_PIDS)) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "Expose pids not supported with setuid bwrap"); return G_DBUS_METHOD_INVOCATION_HANDLED; } instance_id = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_INSTANCE_ID, NULL); if (instance_id) { g_autoptr(FlatpakInstance) instance = flatpak_instance_new_for_id (instance_id); sender_pid1 = flatpak_instance_get_child_pid (instance); } if (sender_pid1 == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Could not find requesting pid"); return G_DBUS_METHOD_INVOCATION_HANDLED; } g_ptr_array_add (flatpak_argv, g_strdup_printf ("--parent-pid=%d", sender_pid1)); if (share_pids) g_ptr_array_add (flatpak_argv, g_strdup ("--parent-share-pids")); else g_ptr_array_add (flatpak_argv, g_strdup ("--parent-expose-pids")); } notify_start = (arg_flags & FLATPAK_SPAWN_FLAGS_NOTIFY_START) != 0; if (notify_start) { int pipe_fds[2]; if (pipe (pipe_fds) == -1) { int errsv = errno; g_dbus_method_invocation_return_error (invocation, G_IO_ERROR, g_io_error_from_errno (errsv), "Failed to create instance ID pipe: %s", g_strerror (errsv)); return G_DBUS_METHOD_INVOCATION_HANDLED; } GInputStream *in_stream = G_INPUT_STREAM (g_unix_input_stream_new (pipe_fds[0], TRUE)); /* This is saved to ensure the portal's end gets closed after the exec. */ instance_id_out_stream = G_OUTPUT_STREAM (g_unix_output_stream_new (pipe_fds[1], TRUE)); instance_id_read_data = g_new0 (InstanceIdReadData, 1); g_input_stream_read_async (in_stream, instance_id_read_data->buffer, INSTANCE_ID_BUFFER_SIZE - 1, G_PRIORITY_DEFAULT, NULL, instance_id_read_finish, instance_id_read_data); g_ptr_array_add (flatpak_argv, g_strdup_printf ("--instance-id-fd=%d", pipe_fds[1])); child_setup_data.instance_id_fd = pipe_fds[1]; } if (devel) g_ptr_array_add (flatpak_argv, g_strdup ("--devel")); /* Inherit launcher network access from launcher, unless NO_NETWORK set. */ if (shares != NULL && g_strv_contains ((const char * const *) shares, "network") && !(arg_flags & FLATPAK_SPAWN_FLAGS_NO_NETWORK)) g_ptr_array_add (flatpak_argv, g_strdup ("--share=network")); else g_ptr_array_add (flatpak_argv, g_strdup ("--unshare=network")); if (instance_path) { for (i = 0; sandbox_expose != NULL && sandbox_expose[i] != NULL; i++) g_ptr_array_add (flatpak_argv, filesystem_sandbox_arg (instance_path, sandbox_expose[i], FALSE)); for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) g_ptr_array_add (flatpak_argv, filesystem_sandbox_arg (instance_path, sandbox_expose_ro[i], TRUE)); } for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) { const char *expose = sandbox_expose_ro[i]; g_debug ("exposing %s", expose); } if (sandbox_expose_fd != NULL) { gsize len = g_variant_n_children (sandbox_expose_fd); for (i = 0; i < len; i++) { gint32 handle; g_variant_get_child (sandbox_expose_fd, i, "h", &handle); if (handle >= 0 && handle < fds_len) { int handle_fd = fds[handle]; g_autofree char *path = NULL; gboolean writable = FALSE; path = get_path_for_fd (handle_fd, &writable, &error); if (path) { g_ptr_array_add (flatpak_argv, filesystem_arg (path, !writable)); } else { g_debug ("unable to get path for sandbox-exposed fd %d, ignoring: %s", handle_fd, error->message); g_clear_error (&error); } } else { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No file descriptor for handle %d", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } } } if (sandbox_expose_fd_ro != NULL) { gsize len = g_variant_n_children (sandbox_expose_fd_ro); for (i = 0; i < len; i++) { gint32 handle; g_variant_get_child (sandbox_expose_fd_ro, i, "h", &handle); if (handle >= 0 && handle < fds_len) { int handle_fd = fds[handle]; g_autofree char *path = NULL; gboolean writable = FALSE; path = get_path_for_fd (handle_fd, &writable, &error); if (path) { g_ptr_array_add (flatpak_argv, filesystem_arg (path, TRUE)); } else { g_debug ("unable to get path for sandbox-exposed fd %d, ignoring: %s", handle_fd, error->message); g_clear_error (&error); } } else { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No file descriptor for handle %d", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } } } g_ptr_array_add (flatpak_argv, g_strdup_printf ("--runtime=%s", runtime_parts[1])); g_ptr_array_add (flatpak_argv, g_strdup_printf ("--runtime-version=%s", runtime_parts[3])); if ((arg_flags & FLATPAK_SPAWN_FLAGS_LATEST_VERSION) == 0) { if (app_commit) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--commit=%s", app_commit)); if (runtime_commit) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--runtime-commit=%s", runtime_commit)); } if (arg_cwd_path != NULL) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--cwd=%s", arg_cwd_path)); if (arg_argv[0][0] != 0) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--command=%s", arg_argv[0])); g_ptr_array_add (flatpak_argv, g_strdup_printf ("%s/%s/%s", app_id, arch ? arch : "", branch ? branch : "")); for (i = 1; arg_argv[i] != NULL; i++) g_ptr_array_add (flatpak_argv, g_strdup (arg_argv[i])); g_ptr_array_add (flatpak_argv, NULL); if (opt_verbose) { g_autoptr(GString) cmd = g_string_new (""); for (i = 0; flatpak_argv->pdata[i] != NULL; i++) { if (i > 0) g_string_append (cmd, " "); g_string_append (cmd, flatpak_argv->pdata[i]); } g_debug ("Starting: %s\n", cmd->str); } /* We use LEAVE_DESCRIPTORS_OPEN to work around dead-lock, see flatpak_close_fds_workaround */ if (!g_spawn_async_with_pipes (NULL, (char **) flatpak_argv->pdata, env, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN, child_setup_func, &child_setup_data, &pid, NULL, NULL, NULL, &error)) { gint code = G_DBUS_ERROR_FAILED; if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_ACCES)) code = G_DBUS_ERROR_ACCESS_DENIED; else if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT)) code = G_DBUS_ERROR_FILE_NOT_FOUND; g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, code, "Failed to start command: %s", error->message); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (instance_id_read_data) instance_id_read_data->pid = pid; pid_data = g_new0 (PidData, 1); pid_data->pid = pid; pid_data->client = g_strdup (g_dbus_method_invocation_get_sender (invocation)); pid_data->watch_bus = (arg_flags & FLATPAK_SPAWN_FLAGS_WATCH_BUS) != 0; pid_data->expose_or_share_pids = (expose_pids || share_pids); pid_data->child_watch = g_child_watch_add_full (G_PRIORITY_DEFAULT, pid, child_watch_died, pid_data, NULL); g_debug ("Client Pid is %d", pid_data->pid); g_hash_table_replace (client_pid_data_hash, GUINT_TO_POINTER (pid_data->pid), pid_data); portal_flatpak_complete_spawn (object, invocation, NULL, pid); return G_DBUS_METHOD_INVOCATION_HANDLED; }
2904
True
1
CVE-2021-21261
False
False
False
False
AV:L/AC:L/Au:N/C:C/I:C/A:C
LOCAL
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
7.2
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
LOCAL
LOW
LOW
NONE
CHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.0
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/releases/tag/1.8.5', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.8.5', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2021/dsa-4830', 'name': 'DSA-4830', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba', 'name': 'https://github.com/flatpak/flatpak/commit/cc1401043c075268ecc652eac557ef8076b5eaba', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486', 'name': 'https://github.com/flatpak/flatpak/commit/6d1773d2a54dde9b099043f07a2094a4f1c2f486', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4', 'name': 'https://github.com/flatpak/flatpak/commit/aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b', 'name': 'https://github.com/flatpak/flatpak/commit/6e5ae7a109cdfa9735ea7ccbd8cb79f9e8d3ae8b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202101-21', 'name': 'GLSA-202101-21', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-74'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.9.1', 'versionEndExcluding': '1.10.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.11.4', 'versionEndExcluding': '1.8.5', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. A bug was discovered in the `flatpak-portal` service that can allow sandboxed applications to execute arbitrary code on the host system (a sandbox escape). This sandbox-escape bug is present in versions from 0.11.4 and before fixed versions 1.8.5 and 1.10.0. The Flatpak portal D-Bus service (`flatpak-portal`, also known by its D-Bus service name `org.freedesktop.portal.Flatpak`) allows apps in a Flatpak sandbox to launch their own subprocesses in a new sandbox instance, either with the same security settings as the caller or with more restrictive security settings. For example, this is used in Flatpak-packaged web browsers such as Chromium to launch subprocesses that will process untrusted web content, and give those subprocesses a more restrictive sandbox than the browser itself. In vulnerable versions, the Flatpak portal service passes caller-specified environment variables to non-sandboxed processes on the host system, and in particular to the `flatpak run` command that is used to launch the new sandbox instance. A malicious or compromised Flatpak app could set environment variables that are trusted by the `flatpak run` command, and use them to execute arbitrary code that is not in a sandbox. As a workaround, this vulnerability can be mitigated by preventing the `flatpak-portal` service from starting, but that mitigation will prevent many Flatpak apps from working correctly. This is fixed in versions 1.8.5 and 1.10.0.'}]
2021-01-27T19:34Z
2021-01-14T20:15Z
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
Software has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
https://cwe.mitre.org/data/definitions/74.html
0
Simon McVittie
2021-01-10 16:25:29+00:00
portal: Do not use caller-supplied variables in environment If the caller specifies a variable that can be used to inject arbitrary code into processes, we must not allow it to enter the environment block used to run `flatpak run`, which runs unsandboxed. This change requires the previous commit "context: Add --env-fd option", which adds infrastructure used here. To be secure, this change also requires the previous commit "run: Convert all environment variables into bwrap arguments", which protects a non-setuid bwrap(1) from the same attack. Signed-off-by: Simon McVittie <[email protected]> Part-of: https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2
cc1401043c075268ecc652eac557ef8076b5eaba
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
handle_spawn
handle_spawn( PortalFlatpak * object , GDBusMethodInvocation * invocation , GUnixFDList * fd_list , const gchar * arg_cwd_path , const gchar * const * arg_argv , GVariant * arg_fds , GVariant * arg_envs , guint arg_flags , GVariant * arg_options)
['object', 'invocation', 'fd_list', 'arg_cwd_path', 'arg_argv', 'arg_fds', 'arg_envs', 'arg_flags', 'arg_options']
handle_spawn (PortalFlatpak *object, GDBusMethodInvocation *invocation, GUnixFDList *fd_list, const gchar *arg_cwd_path, const gchar *const *arg_argv, GVariant *arg_fds, GVariant *arg_envs, guint arg_flags, GVariant *arg_options) { g_autoptr(GError) error = NULL; ChildSetupData child_setup_data = { NULL }; GPid pid; PidData *pid_data; InstanceIdReadData *instance_id_read_data = NULL; gsize i, j, n_fds, n_envs; const gint *fds = NULL; gint fds_len = 0; g_autofree FdMapEntry *fd_map = NULL; gchar **env; gint32 max_fd; GKeyFile *app_info; g_autoptr(GPtrArray) flatpak_argv = g_ptr_array_new_with_free_func (g_free); g_autofree char *app_id = NULL; g_autofree char *branch = NULL; g_autofree char *arch = NULL; g_autofree char *app_commit = NULL; g_autofree char *runtime_ref = NULL; g_auto(GStrv) runtime_parts = NULL; g_autofree char *runtime_commit = NULL; g_autofree char *instance_path = NULL; g_auto(GStrv) extra_args = NULL; g_auto(GStrv) shares = NULL; g_auto(GStrv) sockets = NULL; g_auto(GStrv) devices = NULL; g_auto(GStrv) sandbox_expose = NULL; g_auto(GStrv) sandbox_expose_ro = NULL; g_autoptr(GVariant) sandbox_expose_fd = NULL; g_autoptr(GVariant) sandbox_expose_fd_ro = NULL; g_autoptr(GOutputStream) instance_id_out_stream = NULL; guint sandbox_flags = 0; gboolean sandboxed; gboolean expose_pids; gboolean share_pids; gboolean notify_start; gboolean devel; g_autoptr(GString) env_string = g_string_new (""); child_setup_data.instance_id_fd = -1; child_setup_data.env_fd = -1; if (fd_list != NULL) fds = g_unix_fd_list_peek_fds (fd_list, &fds_len); app_info = g_object_get_data (G_OBJECT (invocation), "app-info"); g_assert (app_info != NULL); app_id = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_NAME, NULL); g_assert (app_id != NULL); g_debug ("spawn() called from app: '%s'", app_id); if (*app_id == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "org.freedesktop.portal.Flatpak.Spawn only works in a flatpak"); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (*arg_cwd_path == 0) arg_cwd_path = NULL; if (arg_argv == NULL || *arg_argv == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No command given"); return G_DBUS_METHOD_INVOCATION_HANDLED; } if ((arg_flags & ~FLATPAK_SPAWN_FLAGS_ALL) != 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Unsupported flags enabled: 0x%x", arg_flags & ~FLATPAK_SPAWN_FLAGS_ALL); return G_DBUS_METHOD_INVOCATION_HANDLED; } runtime_ref = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_APPLICATION, FLATPAK_METADATA_KEY_RUNTIME, NULL); if (runtime_ref == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No runtime found"); return G_DBUS_METHOD_INVOCATION_HANDLED; } runtime_parts = g_strsplit (runtime_ref, "/", -1); branch = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_BRANCH, NULL); instance_path = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_INSTANCE_PATH, NULL); arch = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_ARCH, NULL); extra_args = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_EXTRA_ARGS, NULL, NULL); app_commit = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_APP_COMMIT, NULL); runtime_commit = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_RUNTIME_COMMIT, NULL); shares = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SHARED, NULL, NULL); sockets = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_SOCKETS, NULL, NULL); devices = g_key_file_get_string_list (app_info, FLATPAK_METADATA_GROUP_CONTEXT, FLATPAK_METADATA_KEY_DEVICES, NULL, NULL); devel = g_key_file_get_boolean (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_DEVEL, NULL); g_variant_lookup (arg_options, "sandbox-expose", "^as", &sandbox_expose); g_variant_lookup (arg_options, "sandbox-expose-ro", "^as", &sandbox_expose_ro); g_variant_lookup (arg_options, "sandbox-flags", "u", &sandbox_flags); sandbox_expose_fd = g_variant_lookup_value (arg_options, "sandbox-expose-fd", G_VARIANT_TYPE ("ah")); sandbox_expose_fd_ro = g_variant_lookup_value (arg_options, "sandbox-expose-fd-ro", G_VARIANT_TYPE ("ah")); if ((sandbox_flags & ~FLATPAK_SPAWN_SANDBOX_FLAGS_ALL) != 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Unsupported sandbox flags enabled: 0x%x", arg_flags & ~FLATPAK_SPAWN_SANDBOX_FLAGS_ALL); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (instance_path == NULL && ((sandbox_expose != NULL && sandbox_expose[0] != NULL) || (sandbox_expose_ro != NULL && sandbox_expose_ro[0] != NULL))) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Invalid sandbox expose, caller has no instance path"); return G_DBUS_METHOD_INVOCATION_HANDLED; } for (i = 0; sandbox_expose != NULL && sandbox_expose[i] != NULL; i++) { const char *expose = sandbox_expose[i]; g_debug ("exposing %s", expose); if (!is_valid_expose (expose, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } } for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) { const char *expose = sandbox_expose_ro[i]; g_debug ("exposing %s", expose); if (!is_valid_expose (expose, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } } g_debug ("Running spawn command %s", arg_argv[0]); n_fds = 0; if (fds != NULL) n_fds = g_variant_n_children (arg_fds); fd_map = g_new0 (FdMapEntry, n_fds); child_setup_data.fd_map = fd_map; child_setup_data.fd_map_len = n_fds; max_fd = -1; for (i = 0; i < n_fds; i++) { gint32 handle, dest_fd; int handle_fd; g_variant_get_child (arg_fds, i, "{uh}", &dest_fd, &handle); if (handle >= fds_len || handle < 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No file descriptor for handle %d", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } handle_fd = fds[handle]; fd_map[i].to = dest_fd; fd_map[i].from = handle_fd; fd_map[i].final = fd_map[i].to; /* If stdin/out/err is a tty we try to set it as the controlling tty for the app, this way we can use this to run in a terminal. */ if ((dest_fd == 0 || dest_fd == 1 || dest_fd == 2) && !child_setup_data.set_tty && isatty (handle_fd)) { child_setup_data.set_tty = TRUE; child_setup_data.tty = handle_fd; } max_fd = MAX (max_fd, fd_map[i].to); max_fd = MAX (max_fd, fd_map[i].from); } /* We make a second pass over the fds to find if any "to" fd index overlaps an already in use fd (i.e. one in the "from" category that are allocated randomly). If a fd overlaps "to" fd then its a caller issue and not our fault, so we ignore that. */ for (i = 0; i < n_fds; i++) { int to_fd = fd_map[i].to; gboolean conflict = FALSE; /* At this point we're fine with using "from" values for this value (because we handle to==from in the code), or values that are before "i" in the fd_map (because those will be closed at this point when dup:ing). However, we can't reuse a fd that is in "from" for j > i. */ for (j = i + 1; j < n_fds; j++) { int from_fd = fd_map[j].from; if (from_fd == to_fd) { conflict = TRUE; break; } } if (conflict) fd_map[i].to = ++max_fd; } if (arg_flags & FLATPAK_SPAWN_FLAGS_CLEAR_ENV) { char *empty[] = { NULL }; env = g_strdupv (empty); } else env = g_get_environ (); n_envs = g_variant_n_children (arg_envs); for (i = 0; i < n_envs; i++) { const char *var = NULL; const char *val = NULL; g_variant_get_child (arg_envs, i, "{&s&s}", &var, &val); env = g_environ_setenv (env, var, val, TRUE); } g_ptr_array_add (flatpak_argv, g_strdup ("flatpak")); g_ptr_array_add (flatpak_argv, g_strdup ("run")); sandboxed = (arg_flags & FLATPAK_SPAWN_FLAGS_SANDBOX) != 0; if (sandboxed) { g_ptr_array_add (flatpak_argv, g_strdup ("--sandbox")); if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_DISPLAY) { if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "wayland")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=wayland")); if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "fallback-x11")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=fallback-x11")); if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "x11")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=x11")); if (shares != NULL && g_strv_contains ((const char * const *) shares, "ipc") && sockets != NULL && (g_strv_contains ((const char * const *) sockets, "fallback-x11") || g_strv_contains ((const char * const *) sockets, "x11"))) g_ptr_array_add (flatpak_argv, g_strdup ("--share=ipc")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_SOUND) { if (sockets != NULL && g_strv_contains ((const char * const *) sockets, "pulseaudio")) g_ptr_array_add (flatpak_argv, g_strdup ("--socket=pulseaudio")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_SHARE_GPU) { if (devices != NULL && (g_strv_contains ((const char * const *) devices, "dri") || g_strv_contains ((const char * const *) devices, "all"))) g_ptr_array_add (flatpak_argv, g_strdup ("--device=dri")); } if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_ALLOW_DBUS) g_ptr_array_add (flatpak_argv, g_strdup ("--session-bus")); if (sandbox_flags & FLATPAK_SPAWN_SANDBOX_FLAGS_ALLOW_A11Y) g_ptr_array_add (flatpak_argv, g_strdup ("--a11y-bus")); } else { for (i = 0; extra_args != NULL && extra_args[i] != NULL; i++) { if (g_str_has_prefix (extra_args[i], "--env=")) { const char *var_val = extra_args[i] + strlen ("--env="); if (var_val[0] == '\0' || var_val[0] == '=') { g_warning ("Environment variable in extra-args has empty name"); continue; } if (strchr (var_val, '=') == NULL) { g_warning ("Environment variable in extra-args has no value"); continue; } g_string_append (env_string, var_val); g_string_append_c (env_string, '\0'); } else { g_ptr_array_add (flatpak_argv, g_strdup (extra_args[i])); } } } if (env_string->len > 0) { g_auto(GLnxTmpfile) env_tmpf = { 0, }; if (!flatpak_buffer_to_sealed_memfd_or_tmpfile (&env_tmpf, "environ", env_string->str, env_string->len, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } child_setup_data.env_fd = glnx_steal_fd (&env_tmpf.fd); g_ptr_array_add (flatpak_argv, g_strdup_printf ("--env-fd=%d", child_setup_data.env_fd)); } expose_pids = (arg_flags & FLATPAK_SPAWN_FLAGS_EXPOSE_PIDS) != 0; share_pids = (arg_flags & FLATPAK_SPAWN_FLAGS_SHARE_PIDS) != 0; if (expose_pids || share_pids) { g_autofree char *instance_id = NULL; int sender_pid1 = 0; if (!(supports & FLATPAK_SPAWN_SUPPORT_FLAGS_EXPOSE_PIDS)) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "Expose pids not supported with setuid bwrap"); return G_DBUS_METHOD_INVOCATION_HANDLED; } instance_id = g_key_file_get_string (app_info, FLATPAK_METADATA_GROUP_INSTANCE, FLATPAK_METADATA_KEY_INSTANCE_ID, NULL); if (instance_id) { g_autoptr(FlatpakInstance) instance = flatpak_instance_new_for_id (instance_id); sender_pid1 = flatpak_instance_get_child_pid (instance); } if (sender_pid1 == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Could not find requesting pid"); return G_DBUS_METHOD_INVOCATION_HANDLED; } g_ptr_array_add (flatpak_argv, g_strdup_printf ("--parent-pid=%d", sender_pid1)); if (share_pids) g_ptr_array_add (flatpak_argv, g_strdup ("--parent-share-pids")); else g_ptr_array_add (flatpak_argv, g_strdup ("--parent-expose-pids")); } notify_start = (arg_flags & FLATPAK_SPAWN_FLAGS_NOTIFY_START) != 0; if (notify_start) { int pipe_fds[2]; if (pipe (pipe_fds) == -1) { int errsv = errno; g_dbus_method_invocation_return_error (invocation, G_IO_ERROR, g_io_error_from_errno (errsv), "Failed to create instance ID pipe: %s", g_strerror (errsv)); return G_DBUS_METHOD_INVOCATION_HANDLED; } GInputStream *in_stream = G_INPUT_STREAM (g_unix_input_stream_new (pipe_fds[0], TRUE)); /* This is saved to ensure the portal's end gets closed after the exec. */ instance_id_out_stream = G_OUTPUT_STREAM (g_unix_output_stream_new (pipe_fds[1], TRUE)); instance_id_read_data = g_new0 (InstanceIdReadData, 1); g_input_stream_read_async (in_stream, instance_id_read_data->buffer, INSTANCE_ID_BUFFER_SIZE - 1, G_PRIORITY_DEFAULT, NULL, instance_id_read_finish, instance_id_read_data); g_ptr_array_add (flatpak_argv, g_strdup_printf ("--instance-id-fd=%d", pipe_fds[1])); child_setup_data.instance_id_fd = pipe_fds[1]; } if (devel) g_ptr_array_add (flatpak_argv, g_strdup ("--devel")); /* Inherit launcher network access from launcher, unless NO_NETWORK set. */ if (shares != NULL && g_strv_contains ((const char * const *) shares, "network") && !(arg_flags & FLATPAK_SPAWN_FLAGS_NO_NETWORK)) g_ptr_array_add (flatpak_argv, g_strdup ("--share=network")); else g_ptr_array_add (flatpak_argv, g_strdup ("--unshare=network")); if (instance_path) { for (i = 0; sandbox_expose != NULL && sandbox_expose[i] != NULL; i++) g_ptr_array_add (flatpak_argv, filesystem_sandbox_arg (instance_path, sandbox_expose[i], FALSE)); for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) g_ptr_array_add (flatpak_argv, filesystem_sandbox_arg (instance_path, sandbox_expose_ro[i], TRUE)); } for (i = 0; sandbox_expose_ro != NULL && sandbox_expose_ro[i] != NULL; i++) { const char *expose = sandbox_expose_ro[i]; g_debug ("exposing %s", expose); } if (sandbox_expose_fd != NULL) { gsize len = g_variant_n_children (sandbox_expose_fd); for (i = 0; i < len; i++) { gint32 handle; g_variant_get_child (sandbox_expose_fd, i, "h", &handle); if (handle >= 0 && handle < fds_len) { int handle_fd = fds[handle]; g_autofree char *path = NULL; gboolean writable = FALSE; path = get_path_for_fd (handle_fd, &writable, &error); if (path) { g_ptr_array_add (flatpak_argv, filesystem_arg (path, !writable)); } else { g_debug ("unable to get path for sandbox-exposed fd %d, ignoring: %s", handle_fd, error->message); g_clear_error (&error); } } else { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No file descriptor for handle %d", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } } } if (sandbox_expose_fd_ro != NULL) { gsize len = g_variant_n_children (sandbox_expose_fd_ro); for (i = 0; i < len; i++) { gint32 handle; g_variant_get_child (sandbox_expose_fd_ro, i, "h", &handle); if (handle >= 0 && handle < fds_len) { int handle_fd = fds[handle]; g_autofree char *path = NULL; gboolean writable = FALSE; path = get_path_for_fd (handle_fd, &writable, &error); if (path) { g_ptr_array_add (flatpak_argv, filesystem_arg (path, TRUE)); } else { g_debug ("unable to get path for sandbox-exposed fd %d, ignoring: %s", handle_fd, error->message); g_clear_error (&error); } } else { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No file descriptor for handle %d", handle); return G_DBUS_METHOD_INVOCATION_HANDLED; } } } g_ptr_array_add (flatpak_argv, g_strdup_printf ("--runtime=%s", runtime_parts[1])); g_ptr_array_add (flatpak_argv, g_strdup_printf ("--runtime-version=%s", runtime_parts[3])); if ((arg_flags & FLATPAK_SPAWN_FLAGS_LATEST_VERSION) == 0) { if (app_commit) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--commit=%s", app_commit)); if (runtime_commit) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--runtime-commit=%s", runtime_commit)); } if (arg_cwd_path != NULL) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--cwd=%s", arg_cwd_path)); if (arg_argv[0][0] != 0) g_ptr_array_add (flatpak_argv, g_strdup_printf ("--command=%s", arg_argv[0])); g_ptr_array_add (flatpak_argv, g_strdup_printf ("%s/%s/%s", app_id, arch ? arch : "", branch ? branch : "")); for (i = 1; arg_argv[i] != NULL; i++) g_ptr_array_add (flatpak_argv, g_strdup (arg_argv[i])); g_ptr_array_add (flatpak_argv, NULL); if (opt_verbose) { g_autoptr(GString) cmd = g_string_new (""); for (i = 0; flatpak_argv->pdata[i] != NULL; i++) { if (i > 0) g_string_append (cmd, " "); g_string_append (cmd, flatpak_argv->pdata[i]); } g_debug ("Starting: %s\n", cmd->str); } /* We use LEAVE_DESCRIPTORS_OPEN to work around dead-lock, see flatpak_close_fds_workaround */ if (!g_spawn_async_with_pipes (NULL, (char **) flatpak_argv->pdata, env, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_LEAVE_DESCRIPTORS_OPEN, child_setup_func, &child_setup_data, &pid, NULL, NULL, NULL, &error)) { gint code = G_DBUS_ERROR_FAILED; if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_ACCES)) code = G_DBUS_ERROR_ACCESS_DENIED; else if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT)) code = G_DBUS_ERROR_FILE_NOT_FOUND; g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, code, "Failed to start command: %s", error->message); return G_DBUS_METHOD_INVOCATION_HANDLED; } if (instance_id_read_data) instance_id_read_data->pid = pid; pid_data = g_new0 (PidData, 1); pid_data->pid = pid; pid_data->client = g_strdup (g_dbus_method_invocation_get_sender (invocation)); pid_data->watch_bus = (arg_flags & FLATPAK_SPAWN_FLAGS_WATCH_BUS) != 0; pid_data->expose_or_share_pids = (expose_pids || share_pids); pid_data->child_watch = g_child_watch_add_full (G_PRIORITY_DEFAULT, pid, child_watch_died, pid_data, NULL); g_debug ("Client Pid is %d", pid_data->pid); g_hash_table_replace (client_pid_data_hash, GUINT_TO_POINTER (pid_data->pid), pid_data); portal_flatpak_complete_spawn (object, invocation, NULL, pid); return G_DBUS_METHOD_INVOCATION_HANDLED; }
3096
True
1
CVE-2021-21381
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:N
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
NONE
5.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
NONE
8.2
HIGH
1.8
5.8
False
[{'url': 'https://github.com/flatpak/flatpak/pull/4156', 'name': 'https://github.com/flatpak/flatpak/pull/4156', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/a7401e638bf0c03102039e216ab1081922f140ae', 'name': 'https://github.com/flatpak/flatpak/commit/a7401e638bf0c03102039e216ab1081922f140ae', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/8279c5818425b6812523e3805bbe242fb6a5d961', 'name': 'https://github.com/flatpak/flatpak/commit/8279c5818425b6812523e3805bbe242fb6a5d961', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.2', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.2', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-xgh4-387p-hqpp', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-xgh4-387p-hqpp', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/eb7946bb6248923d8c90fe9b84425fef97ae580d', 'name': 'https://github.com/flatpak/flatpak/commit/eb7946bb6248923d8c90fe9b84425fef97ae580d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://www.debian.org/security/2021/dsa-4868', 'name': 'DSA-4868', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/WXNVFOIB6ZP4DGOVKAM25T6OIEP3YLGV/', 'name': 'FEDORA-2021-26ad138ffa', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/2MXXLXC2DPJ45HSMTI5MZYHMYEGQN6AA/', 'name': 'FEDORA-2021-fe7decc595', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-74'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.9.4', 'versionEndExcluding': '1.10.2', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. In Flatpack since version 0.9.4 and before version 1.10.2 has a vulnerability in the "file forwarding" feature which can be used by an attacker to gain access to files that would not ordinarily be allowed by the app\'s permissions. By putting the special tokens `@@` and/or `@@u` in the Exec field of a Flatpak app\'s .desktop file, a malicious app publisher can trick flatpak into behaving as though the user had chosen to open a target file with their Flatpak app, which automatically makes that file available to the Flatpak app. This is fixed in version 1.10.2. A minimal solution is the first commit "`Disallow @@ and @@U usage in desktop files`". The follow-up commits "`dir: Reserve the whole @@ prefix`" and "`dir: Refuse to export .desktop files with suspicious uses of @@ tokens`" are recommended, but not strictly required. As a workaround, avoid installing Flatpak apps from untrusted sources, or check the contents of the exported `.desktop` files in `exports/share/applications/*.desktop` (typically `~/.local/share/flatpak/exports/share/applications/*.desktop` and `/var/lib/flatpak/exports/share/applications/*.desktop`) to make sure that literal filenames do not follow `@@` or `@@u`.'}]
2021-03-25T00:01Z
2021-03-11T17:15Z
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
Software has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
https://cwe.mitre.org/data/definitions/74.html
0
Simon McVittie
2021-03-05 13:49:36+00:00
dir: Reserve the whole @@ prefix If we add new features analogous to file forwarding later, we might find that we need a different magic token. Let's reserve the whole @@* namespace so we can call it @@something-else. Signed-off-by: Simon McVittie <[email protected]> (cherry picked from commit 1e7e8fdb24b51078f4c48e0711e24a14930ba1f0)
eb7946bb6248923d8c90fe9b84425fef97ae580d
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
export_desktop_file
export_desktop_file( const char * app , const char * branch , const char * arch , GKeyFile * metadata , const char * const * previous_ids , int parent_fd , const char * name , struct stat * stat_buf , char ** target , GCancellable * cancellable , GError ** error)
['app', 'branch', 'arch', 'metadata', 'previous_ids', 'parent_fd', 'name', 'stat_buf', 'target', 'cancellable', 'error']
export_desktop_file (const char *app, const char *branch, const char *arch, GKeyFile *metadata, const char * const *previous_ids, int parent_fd, const char *name, struct stat *stat_buf, char **target, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; glnx_autofd int desktop_fd = -1; g_autofree char *tmpfile_name = g_strdup_printf ("export-desktop-XXXXXX"); g_autoptr(GOutputStream) out_stream = NULL; g_autofree gchar *data = NULL; gsize data_len; g_autofree gchar *new_data = NULL; gsize new_data_len; g_autoptr(GKeyFile) keyfile = NULL; g_autofree gchar *old_exec = NULL; gint old_argc; g_auto(GStrv) old_argv = NULL; g_auto(GStrv) groups = NULL; GString *new_exec = NULL; g_autofree char *escaped_app = maybe_quote (app); g_autofree char *escaped_branch = maybe_quote (branch); g_autofree char *escaped_arch = maybe_quote (arch); int i; if (!flatpak_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error)) goto out; if (!read_fd (desktop_fd, stat_buf, &data, &data_len, error)) goto out; keyfile = g_key_file_new (); if (!g_key_file_load_from_data (keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, error)) goto out; if (g_str_has_suffix (name, ".service")) { g_autofree gchar *dbus_name = NULL; g_autofree gchar *expected_dbus_name = g_strndup (name, strlen (name) - strlen (".service")); dbus_name = g_key_file_get_string (keyfile, "D-BUS Service", "Name", NULL); if (dbus_name == NULL || strcmp (dbus_name, expected_dbus_name) != 0) { return flatpak_fail_error (error, FLATPAK_ERROR_EXPORT_FAILED, _("D-Bus service file '%s' has wrong name"), name); } } if (g_str_has_suffix (name, ".desktop")) { gsize length; g_auto(GStrv) tags = g_key_file_get_string_list (metadata, "Application", "tags", &length, NULL); if (tags != NULL) { g_key_file_set_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Flatpak-Tags", (const char * const *) tags, length); } /* Add a marker so consumers can easily find out that this launches a sandbox */ g_key_file_set_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Flatpak", app); /* If the app has been renamed, add its old .desktop filename to * X-Flatpak-RenamedFrom in the new .desktop file, taking care not to * introduce duplicates. */ if (previous_ids != NULL) { const char *X_FLATPAK_RENAMED_FROM = "X-Flatpak-RenamedFrom"; g_auto(GStrv) renamed_from = g_key_file_get_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, X_FLATPAK_RENAMED_FROM, NULL, NULL); g_autoptr(GPtrArray) merged = g_ptr_array_new_with_free_func (g_free); g_autoptr(GHashTable) seen = g_hash_table_new (g_str_hash, g_str_equal); const char *new_suffix; for (i = 0; renamed_from != NULL && renamed_from[i] != NULL; i++) { if (!g_hash_table_contains (seen, renamed_from[i])) { gchar *copy = g_strdup (renamed_from[i]); g_hash_table_insert (seen, copy, copy); g_ptr_array_add (merged, g_steal_pointer (&copy)); } } /* If an app was renamed from com.example.Foo to net.example.Bar, and * the new version exports net.example.Bar-suffix.desktop, we assume the * old version exported com.example.Foo-suffix.desktop. * * This assertion is true because * flatpak_name_matches_one_wildcard_prefix() is called on all * exported files before we get here. */ g_assert (g_str_has_prefix (name, app)); /* ".desktop" for the "main" desktop file; something like * "-suffix.desktop" for extra ones. */ new_suffix = name + strlen (app); for (i = 0; previous_ids[i] != NULL; i++) { g_autofree gchar *previous_desktop = g_strconcat (previous_ids[i], new_suffix, NULL); if (!g_hash_table_contains (seen, previous_desktop)) { g_hash_table_insert (seen, previous_desktop, previous_desktop); g_ptr_array_add (merged, g_steal_pointer (&previous_desktop)); } } if (merged->len > 0) { g_ptr_array_add (merged, NULL); g_key_file_set_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, X_FLATPAK_RENAMED_FROM, (const char * const *) merged->pdata, merged->len - 1); } } } groups = g_key_file_get_groups (keyfile, NULL); for (i = 0; groups[i] != NULL; i++) { g_auto(GStrv) flatpak_run_opts = g_key_file_get_string_list (keyfile, groups[i], "X-Flatpak-RunOptions", NULL, NULL); g_autofree char *flatpak_run_args = format_flatpak_run_args_from_run_opts (flatpak_run_opts); g_key_file_remove_key (keyfile, groups[i], "X-Flatpak-RunOptions", NULL); g_key_file_remove_key (keyfile, groups[i], "TryExec", NULL); /* Remove this to make sure nothing tries to execute it outside the sandbox*/ g_key_file_remove_key (keyfile, groups[i], "X-GNOME-Bugzilla-ExtraInfoScript", NULL); new_exec = g_string_new (""); g_string_append_printf (new_exec, FLATPAK_BINDIR "/flatpak run --branch=%s --arch=%s", escaped_branch, escaped_arch); if (flatpak_run_args != NULL) g_string_append_printf (new_exec, "%s", flatpak_run_args); old_exec = g_key_file_get_string (keyfile, groups[i], "Exec", NULL); if (old_exec && g_shell_parse_argv (old_exec, &old_argc, &old_argv, NULL) && old_argc >= 1) { int j; g_autofree char *command = maybe_quote (old_argv[0]); g_string_append_printf (new_exec, " --command=%s", command); for (j = 1; j < old_argc; j++) { if (strcasecmp (old_argv[j], "%f") == 0 || strcasecmp (old_argv[j], "%u") == 0) { g_string_append (new_exec, " --file-forwarding"); break; } } g_string_append (new_exec, " "); g_string_append (new_exec, escaped_app); for (j = 1; j < old_argc; j++) { g_autofree char *arg = maybe_quote (old_argv[j]); if (strcasecmp (arg, "%f") == 0) g_string_append_printf (new_exec, " @@ %s @@", arg); else if (strcasecmp (arg, "%u") == 0) g_string_append_printf (new_exec, " @@u %s @@", arg); else if (strcmp (arg, "@@") == 0 || strcmp (arg, "@@u") == 0) g_print (_("Skipping invalid Exec argument %s\n"), arg); else g_string_append_printf (new_exec, " %s", arg); } } else { g_string_append (new_exec, " "); g_string_append (new_exec, escaped_app); } g_key_file_set_string (keyfile, groups[i], G_KEY_FILE_DESKTOP_KEY_EXEC, new_exec->str); } new_data = g_key_file_to_data (keyfile, &new_data_len, error); if (new_data == NULL) goto out; if (!flatpak_open_in_tmpdir_at (parent_fd, 0755, tmpfile_name, &out_stream, cancellable, error)) goto out; if (!g_output_stream_write_all (out_stream, new_data, new_data_len, NULL, cancellable, error)) goto out; if (!g_output_stream_close (out_stream, cancellable, error)) goto out; if (target) *target = g_steal_pointer (&tmpfile_name); ret = TRUE; out: if (new_exec != NULL) g_string_free (new_exec, TRUE); return ret; }
1183
True
1
CVE-2021-21381
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:N
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
NONE
5.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
NONE
8.2
HIGH
1.8
5.8
False
[{'url': 'https://github.com/flatpak/flatpak/pull/4156', 'name': 'https://github.com/flatpak/flatpak/pull/4156', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/a7401e638bf0c03102039e216ab1081922f140ae', 'name': 'https://github.com/flatpak/flatpak/commit/a7401e638bf0c03102039e216ab1081922f140ae', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/8279c5818425b6812523e3805bbe242fb6a5d961', 'name': 'https://github.com/flatpak/flatpak/commit/8279c5818425b6812523e3805bbe242fb6a5d961', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.2', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.2', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-xgh4-387p-hqpp', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-xgh4-387p-hqpp', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/eb7946bb6248923d8c90fe9b84425fef97ae580d', 'name': 'https://github.com/flatpak/flatpak/commit/eb7946bb6248923d8c90fe9b84425fef97ae580d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://www.debian.org/security/2021/dsa-4868', 'name': 'DSA-4868', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/WXNVFOIB6ZP4DGOVKAM25T6OIEP3YLGV/', 'name': 'FEDORA-2021-26ad138ffa', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/2MXXLXC2DPJ45HSMTI5MZYHMYEGQN6AA/', 'name': 'FEDORA-2021-fe7decc595', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-74'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.9.4', 'versionEndExcluding': '1.10.2', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. In Flatpack since version 0.9.4 and before version 1.10.2 has a vulnerability in the "file forwarding" feature which can be used by an attacker to gain access to files that would not ordinarily be allowed by the app\'s permissions. By putting the special tokens `@@` and/or `@@u` in the Exec field of a Flatpak app\'s .desktop file, a malicious app publisher can trick flatpak into behaving as though the user had chosen to open a target file with their Flatpak app, which automatically makes that file available to the Flatpak app. This is fixed in version 1.10.2. A minimal solution is the first commit "`Disallow @@ and @@U usage in desktop files`". The follow-up commits "`dir: Reserve the whole @@ prefix`" and "`dir: Refuse to export .desktop files with suspicious uses of @@ tokens`" are recommended, but not strictly required. As a workaround, avoid installing Flatpak apps from untrusted sources, or check the contents of the exported `.desktop` files in `exports/share/applications/*.desktop` (typically `~/.local/share/flatpak/exports/share/applications/*.desktop` and `/var/lib/flatpak/exports/share/applications/*.desktop`) to make sure that literal filenames do not follow `@@` or `@@u`.'}]
2021-03-25T00:01Z
2021-03-11T17:15Z
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.
Software has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
https://cwe.mitre.org/data/definitions/74.html
0
Simon McVittie
2021-03-05 13:51:33+00:00
dir: Refuse to export .desktop files with suspicious uses of @@ tokens This is either a malicious/compromised app trying to do an attack, or a mistake that will break handling of %f, %u and so on. Either way, if we refuse to export the .desktop file, resulting in installation failing, then it makes the rejection more obvious than quietly removing the magic tokens. Signed-off-by: Simon McVittie <[email protected]> (cherry picked from commit 46b3ede5241561c7d588951048c687c5075a3eac)
a7401e638bf0c03102039e216ab1081922f140ae
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
export_desktop_file
export_desktop_file( const char * app , const char * branch , const char * arch , GKeyFile * metadata , const char * const * previous_ids , int parent_fd , const char * name , struct stat * stat_buf , char ** target , GCancellable * cancellable , GError ** error)
['app', 'branch', 'arch', 'metadata', 'previous_ids', 'parent_fd', 'name', 'stat_buf', 'target', 'cancellable', 'error']
export_desktop_file (const char *app, const char *branch, const char *arch, GKeyFile *metadata, const char * const *previous_ids, int parent_fd, const char *name, struct stat *stat_buf, char **target, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; glnx_autofd int desktop_fd = -1; g_autofree char *tmpfile_name = g_strdup_printf ("export-desktop-XXXXXX"); g_autoptr(GOutputStream) out_stream = NULL; g_autofree gchar *data = NULL; gsize data_len; g_autofree gchar *new_data = NULL; gsize new_data_len; g_autoptr(GKeyFile) keyfile = NULL; g_autofree gchar *old_exec = NULL; gint old_argc; g_auto(GStrv) old_argv = NULL; g_auto(GStrv) groups = NULL; GString *new_exec = NULL; g_autofree char *escaped_app = maybe_quote (app); g_autofree char *escaped_branch = maybe_quote (branch); g_autofree char *escaped_arch = maybe_quote (arch); int i; if (!flatpak_openat_noatime (parent_fd, name, &desktop_fd, cancellable, error)) goto out; if (!read_fd (desktop_fd, stat_buf, &data, &data_len, error)) goto out; keyfile = g_key_file_new (); if (!g_key_file_load_from_data (keyfile, data, data_len, G_KEY_FILE_KEEP_TRANSLATIONS, error)) goto out; if (g_str_has_suffix (name, ".service")) { g_autofree gchar *dbus_name = NULL; g_autofree gchar *expected_dbus_name = g_strndup (name, strlen (name) - strlen (".service")); dbus_name = g_key_file_get_string (keyfile, "D-BUS Service", "Name", NULL); if (dbus_name == NULL || strcmp (dbus_name, expected_dbus_name) != 0) { return flatpak_fail_error (error, FLATPAK_ERROR_EXPORT_FAILED, _("D-Bus service file '%s' has wrong name"), name); } } if (g_str_has_suffix (name, ".desktop")) { gsize length; g_auto(GStrv) tags = g_key_file_get_string_list (metadata, "Application", "tags", &length, NULL); if (tags != NULL) { g_key_file_set_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Flatpak-Tags", (const char * const *) tags, length); } /* Add a marker so consumers can easily find out that this launches a sandbox */ g_key_file_set_string (keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Flatpak", app); /* If the app has been renamed, add its old .desktop filename to * X-Flatpak-RenamedFrom in the new .desktop file, taking care not to * introduce duplicates. */ if (previous_ids != NULL) { const char *X_FLATPAK_RENAMED_FROM = "X-Flatpak-RenamedFrom"; g_auto(GStrv) renamed_from = g_key_file_get_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, X_FLATPAK_RENAMED_FROM, NULL, NULL); g_autoptr(GPtrArray) merged = g_ptr_array_new_with_free_func (g_free); g_autoptr(GHashTable) seen = g_hash_table_new (g_str_hash, g_str_equal); const char *new_suffix; for (i = 0; renamed_from != NULL && renamed_from[i] != NULL; i++) { if (!g_hash_table_contains (seen, renamed_from[i])) { gchar *copy = g_strdup (renamed_from[i]); g_hash_table_insert (seen, copy, copy); g_ptr_array_add (merged, g_steal_pointer (&copy)); } } /* If an app was renamed from com.example.Foo to net.example.Bar, and * the new version exports net.example.Bar-suffix.desktop, we assume the * old version exported com.example.Foo-suffix.desktop. * * This assertion is true because * flatpak_name_matches_one_wildcard_prefix() is called on all * exported files before we get here. */ g_assert (g_str_has_prefix (name, app)); /* ".desktop" for the "main" desktop file; something like * "-suffix.desktop" for extra ones. */ new_suffix = name + strlen (app); for (i = 0; previous_ids[i] != NULL; i++) { g_autofree gchar *previous_desktop = g_strconcat (previous_ids[i], new_suffix, NULL); if (!g_hash_table_contains (seen, previous_desktop)) { g_hash_table_insert (seen, previous_desktop, previous_desktop); g_ptr_array_add (merged, g_steal_pointer (&previous_desktop)); } } if (merged->len > 0) { g_ptr_array_add (merged, NULL); g_key_file_set_string_list (keyfile, G_KEY_FILE_DESKTOP_GROUP, X_FLATPAK_RENAMED_FROM, (const char * const *) merged->pdata, merged->len - 1); } } } groups = g_key_file_get_groups (keyfile, NULL); for (i = 0; groups[i] != NULL; i++) { g_auto(GStrv) flatpak_run_opts = g_key_file_get_string_list (keyfile, groups[i], "X-Flatpak-RunOptions", NULL, NULL); g_autofree char *flatpak_run_args = format_flatpak_run_args_from_run_opts (flatpak_run_opts); g_key_file_remove_key (keyfile, groups[i], "X-Flatpak-RunOptions", NULL); g_key_file_remove_key (keyfile, groups[i], "TryExec", NULL); /* Remove this to make sure nothing tries to execute it outside the sandbox*/ g_key_file_remove_key (keyfile, groups[i], "X-GNOME-Bugzilla-ExtraInfoScript", NULL); new_exec = g_string_new (""); g_string_append_printf (new_exec, FLATPAK_BINDIR "/flatpak run --branch=%s --arch=%s", escaped_branch, escaped_arch); if (flatpak_run_args != NULL) g_string_append_printf (new_exec, "%s", flatpak_run_args); old_exec = g_key_file_get_string (keyfile, groups[i], "Exec", NULL); if (old_exec && g_shell_parse_argv (old_exec, &old_argc, &old_argv, NULL) && old_argc >= 1) { int j; g_autofree char *command = maybe_quote (old_argv[0]); g_string_append_printf (new_exec, " --command=%s", command); for (j = 1; j < old_argc; j++) { if (strcasecmp (old_argv[j], "%f") == 0 || strcasecmp (old_argv[j], "%u") == 0) { g_string_append (new_exec, " --file-forwarding"); break; } } g_string_append (new_exec, " "); g_string_append (new_exec, escaped_app); for (j = 1; j < old_argc; j++) { g_autofree char *arg = maybe_quote (old_argv[j]); if (strcasecmp (arg, "%f") == 0) g_string_append_printf (new_exec, " @@ %s @@", arg); else if (strcasecmp (arg, "%u") == 0) g_string_append_printf (new_exec, " @@u %s @@", arg); else if (g_str_has_prefix (arg, "@@")) g_print (_("Skipping invalid Exec argument %s\n"), arg); else g_string_append_printf (new_exec, " %s", arg); } } else { g_string_append (new_exec, " "); g_string_append (new_exec, escaped_app); } g_key_file_set_string (keyfile, groups[i], G_KEY_FILE_DESKTOP_KEY_EXEC, new_exec->str); } new_data = g_key_file_to_data (keyfile, &new_data_len, error); if (new_data == NULL) goto out; if (!flatpak_open_in_tmpdir_at (parent_fd, 0755, tmpfile_name, &out_stream, cancellable, error)) goto out; if (!g_output_stream_write_all (out_stream, new_data, new_data_len, NULL, cancellable, error)) goto out; if (!g_output_stream_close (out_stream, cancellable, error)) goto out; if (target) *target = g_steal_pointer (&tmpfile_name); ret = TRUE; out: if (new_exec != NULL) g_string_free (new_exec, TRUE); return ret; }
1172
True
1
CVE-2021-41133
False
False
False
False
AV:L/AC:L/Au:N/C:P/I:P/A:P
LOCAL
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
4.6
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
LOCAL
LOW
LOW
NONE
UNCHANGED
HIGH
HIGH
HIGH
7.8
HIGH
1.8
5.9
False
[{'url': 'https://github.com/flatpak/flatpak/commit/1330662f33a55e88bfe18e76de28b7922d91a999', 'name': 'https://github.com/flatpak/flatpak/commit/1330662f33a55e88bfe18e76de28b7922d91a999', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/a10f52a7565c549612c92b8e736a6698a53db330', 'name': 'https://github.com/flatpak/flatpak/commit/a10f52a7565c549612c92b8e736a6698a53db330', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/4c34815784e9ffda5733225c7d95824f96375e36', 'name': 'https://github.com/flatpak/flatpak/commit/4c34815784e9ffda5733225c7d95824f96375e36', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/89ae9fe74c6d445bb1b3a40e568d77cf5de47e48', 'name': 'https://github.com/flatpak/flatpak/commit/89ae9fe74c6d445bb1b3a40e568d77cf5de47e48', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/462fca2c666e0cd2b60d6d2593a7216a83047aaf', 'name': 'https://github.com/flatpak/flatpak/commit/462fca2c666e0cd2b60d6d2593a7216a83047aaf', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/e26ac7586c392b5eb35ff4609fe232c52523b2cf', 'name': 'https://github.com/flatpak/flatpak/commit/e26ac7586c392b5eb35ff4609fe232c52523b2cf', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-67h7-w3jq-vh4q', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-67h7-w3jq-vh4q', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/26b12484eb8a6219b9e7aa287b298a894b2f34ca', 'name': 'https://github.com/flatpak/flatpak/commit/26b12484eb8a6219b9e7aa287b298a894b2f34ca', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/9766ee05b1425db397d2cf23afd24c7f6146a69f', 'name': 'https://github.com/flatpak/flatpak/commit/9766ee05b1425db397d2cf23afd24c7f6146a69f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/R5656ONDP2MGKIJMKEC7N2NXCV27WGTC/', 'name': 'FEDORA-2021-4b201d15e6', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.debian.org/security/2021/dsa-4984', 'name': 'DSA-4984', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2021/10/26/9', 'name': '[oss-security] 20211026 WebKitGTK and WPE WebKit Security Advisory WSA-2021-0006', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/T5DKCYRC6MFSTFCUP4DELCOUUP3SFEFX/', 'name': 'FEDORA-2021-c5a9c85737', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-20'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.10.0', 'versionEndExcluding': '1.10.4', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.8.2', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndExcluding': '1.12.1', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': "Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux. In versions prior to 1.10.4 and 1.12.0, Flatpak apps with direct access to AF_UNIX sockets such as those used by Wayland, Pipewire or pipewire-pulse can trick portals and other host-OS services into treating the Flatpak app as though it was an ordinary, non-sandboxed host-OS process. They can do this by manipulating the VFS using recent mount-related syscalls that are not blocked by Flatpak's denylist seccomp filter, in order to substitute a crafted `/.flatpak-info` or make that file disappear entirely. Flatpak apps that act as clients for AF_UNIX sockets such as those used by Wayland, Pipewire or pipewire-pulse can escalate the privileges that the corresponding services will believe the Flatpak app has. Note that protocols that operate entirely over the D-Bus session bus (user bus), system bus or accessibility bus are not affected by this. This is due to the use of a proxy process `xdg-dbus-proxy`, whose VFS cannot be manipulated by the Flatpak app, when interacting with these buses. Patches exist for versions 1.10.4 and 1.12.0, and as of time of publication, a patch for version 1.8.2 is being planned. There are no workarounds aside from upgrading to a patched version."}]
2021-12-04T03:04Z
2021-10-08T14:15Z
Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
Input validation is a frequently-used technique for checking potentially dangerous inputs in order to ensure that the inputs are safe for processing within the code, or when communicating with other components. When software does not validate input properly, an attacker is able to craft the input in a form that is not expected by the rest of the application. This will lead to parts of the system receiving unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution. Input validation is not the only technique for processing input, however. Other techniques attempt to transform potentially-dangerous input into something safe, such as filtering (CWE-790) - which attempts to remove dangerous inputs - or encoding/escaping (CWE-116), which attempts to ensure that the input is not misinterpreted when it is included in output to another component. Other techniques exist as well (see CWE-138 for more examples.) Input validation can be applied to: raw data - strings, numbers, parameters, file contents, etc. metadata - information about the raw data, such as headers or size Data can be simple or structured. Structured data can be composed of many nested layers, composed of combinations of metadata and raw data, with other simple or structured data. Many properties of raw data or metadata may need to be validated upon entry into the code, such as: specified quantities such as size, length, frequency, price, rate, number of operations, time, etc. implied or derived quantities, such as the actual size of a file instead of a specified size indexes, offsets, or positions into more complex data structures symbolic keys or other elements into hash tables, associative arrays, etc. well-formedness, i.e. syntactic correctness - compliance with expected syntax lexical token correctness - compliance with rules for what is treated as a token specified or derived type - the actual type of the input (or what the input appears to be) consistency - between individual data elements, between raw data and metadata, between references, etc. conformance to domain-specific rules, e.g. business logic equivalence - ensuring that equivalent inputs are treated the same authenticity, ownership, or other attestations about the input, e.g. a cryptographic signature to prove the source of the data Implied or derived properties of data must often be calculated or inferred by the code itself. Errors in deriving properties may be considered a contributing factor to improper input validation. Note that "input validation" has very different meanings to different people, or within different classification schemes. Caution must be used when referencing this CWE entry or mapping to it. For example, some weaknesses might involve inadvertently giving control to an attacker over an input when they should not be able to provide an input at all, but sometimes this is referred to as input validation. Finally, it is important to emphasize that the distinctions between input validation and output escaping are often blurred, and developers must be careful to understand the difference, including how input validation is not always sufficient to prevent vulnerabilities, especially when less stringent data types must be supported, such as free-form text. Consider a SQL injection scenario in which a person's last name is inserted into a query. The name "O'Reilly" would likely pass the validation step since it is a common last name in the English language. However, this valid name cannot be directly inserted into the database because it contains the "'" apostrophe character, which would need to be escaped or otherwise transformed. In this case, removing the apostrophe might reduce the risk of SQL injection, but it would produce incorrect behavior because the wrong name would be recorded.
https://cwe.mitre.org/data/definitions/20.html
0
Simon McVittie
2021-09-01 11:53:23+01:00
run: Add an errno value to seccomp filters At the moment, if we block a syscall we always make it fail with EPERM, but this is risky: user-space libraries can start to use new replacements for old syscalls at any time, and will often treat EPERM as a fatal error. For new syscalls, we should make the syscall fail with ENOSYS, which is indistinguishable from running on an older kernel and will cause fallback to an older implementation, for example clone3() to clone(). In future we should probably move from EPERM to ENOSYS for some of the syscalls we already block, but for now keep the status quo. This is a prerequisite for fixing the vulnerability tracked as GHSA-67h7-w3jq-vh4q. Signed-off-by: Simon McVittie <[email protected]>
e26ac7586c392b5eb35ff4609fe232c52523b2cf
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
setup_seccomp
setup_seccomp( FlatpakBwrap * bwrap , const char * arch , gulong allowed_personality , FlatpakRunFlags run_flags , GError ** error)
['bwrap', 'arch', 'allowed_personality', 'run_flags', 'error']
setup_seccomp (FlatpakBwrap *bwrap, const char *arch, gulong allowed_personality, FlatpakRunFlags run_flags, GError **error) { gboolean multiarch = (run_flags & FLATPAK_RUN_FLAG_MULTIARCH) != 0; gboolean devel = (run_flags & FLATPAK_RUN_FLAG_DEVEL) != 0; __attribute__((cleanup (cleanup_seccomp))) scmp_filter_ctx seccomp = NULL; /**** BEGIN NOTE ON CODE SHARING * * There are today a number of different Linux container * implementations. That will likely continue for long into the * future. But we can still try to share code, and it's important * to do so because it affects what library and application writers * can do, and we should support code portability between different * container tools. * * This syscall blocklist is copied from linux-user-chroot, which was in turn * clearly influenced by the Sandstorm.io blocklist. * * If you make any changes here, I suggest sending the changes along * to other sandbox maintainers. Using the libseccomp list is also * an appropriate venue: * https://groups.google.com/forum/#!forum/libseccomp * * A non-exhaustive list of links to container tooling that might * want to share this blocklist: * * https://github.com/sandstorm-io/sandstorm * in src/sandstorm/supervisor.c++ * https://github.com/flatpak/flatpak.git * in common/flatpak-run.c * https://git.gnome.org/browse/linux-user-chroot * in src/setup-seccomp.c * **** END NOTE ON CODE SHARING */ struct { int scall; struct scmp_arg_cmp *arg; } syscall_blocklist[] = { /* Block dmesg */ {SCMP_SYS (syslog)}, /* Useless old syscall */ {SCMP_SYS (uselib)}, /* Don't allow disabling accounting */ {SCMP_SYS (acct)}, /* 16-bit code is unnecessary in the sandbox, and modify_ldt is a historic source of interesting information leaks. */ {SCMP_SYS (modify_ldt)}, /* Don't allow reading current quota use */ {SCMP_SYS (quotactl)}, /* Don't allow access to the kernel keyring */ {SCMP_SYS (add_key)}, {SCMP_SYS (keyctl)}, {SCMP_SYS (request_key)}, /* Scary VM/NUMA ops */ {SCMP_SYS (move_pages)}, {SCMP_SYS (mbind)}, {SCMP_SYS (get_mempolicy)}, {SCMP_SYS (set_mempolicy)}, {SCMP_SYS (migrate_pages)}, /* Don't allow subnamespace setups: */ {SCMP_SYS (unshare)}, {SCMP_SYS (mount)}, {SCMP_SYS (pivot_root)}, #if defined(__s390__) || defined(__s390x__) || defined(__CRIS__) /* Architectures with CONFIG_CLONE_BACKWARDS2: the child stack * and flags arguments are reversed so the flags come second */ {SCMP_SYS (clone), &SCMP_A1 (SCMP_CMP_MASKED_EQ, CLONE_NEWUSER, CLONE_NEWUSER)}, #else /* Normally the flags come first */ {SCMP_SYS (clone), &SCMP_A0 (SCMP_CMP_MASKED_EQ, CLONE_NEWUSER, CLONE_NEWUSER)}, #endif /* Don't allow faking input to the controlling tty (CVE-2017-5226) */ {SCMP_SYS (ioctl), &SCMP_A1 (SCMP_CMP_MASKED_EQ, 0xFFFFFFFFu, (int) TIOCSTI)}, }; struct { int scall; struct scmp_arg_cmp *arg; } syscall_nondevel_blocklist[] = { /* Profiling operations; we expect these to be done by tools from outside * the sandbox. In particular perf has been the source of many CVEs. */ {SCMP_SYS (perf_event_open)}, /* Don't allow you to switch to bsd emulation or whatnot */ {SCMP_SYS (personality), &SCMP_A0 (SCMP_CMP_NE, allowed_personality)}, {SCMP_SYS (ptrace)} }; /* Blocklist all but unix, inet, inet6 and netlink */ struct { int family; FlatpakRunFlags flags_mask; } socket_family_allowlist[] = { /* NOTE: Keep in numerical order */ { AF_UNSPEC, 0 }, { AF_LOCAL, 0 }, { AF_INET, 0 }, { AF_INET6, 0 }, { AF_NETLINK, 0 }, { AF_CAN, FLATPAK_RUN_FLAG_CANBUS }, { AF_BLUETOOTH, FLATPAK_RUN_FLAG_BLUETOOTH }, }; int last_allowed_family; int i, r; g_auto(GLnxTmpfile) seccomp_tmpf = { 0, }; seccomp = seccomp_init (SCMP_ACT_ALLOW); if (!seccomp) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Initialize seccomp failed")); if (arch != NULL) { uint32_t arch_id = 0; const uint32_t *extra_arches = NULL; if (strcmp (arch, "i386") == 0) { arch_id = SCMP_ARCH_X86; } else if (strcmp (arch, "x86_64") == 0) { arch_id = SCMP_ARCH_X86_64; extra_arches = seccomp_x86_64_extra_arches; } else if (strcmp (arch, "arm") == 0) { arch_id = SCMP_ARCH_ARM; } #ifdef SCMP_ARCH_AARCH64 else if (strcmp (arch, "aarch64") == 0) { arch_id = SCMP_ARCH_AARCH64; extra_arches = seccomp_aarch64_extra_arches; } #endif /* We only really need to handle arches on multiarch systems. * If only one arch is supported the default is fine */ if (arch_id != 0) { /* This *adds* the target arch, instead of replacing the native one. This is not ideal, because we'd like to only allow the target arch, but we can't really disallow the native arch at this point, because then bubblewrap couldn't continue running. */ r = seccomp_arch_add (seccomp, arch_id); if (r < 0 && r != -EEXIST) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to add architecture to seccomp filter")); if (multiarch && extra_arches != NULL) { for (i = 0; extra_arches[i] != 0; i++) { r = seccomp_arch_add (seccomp, extra_arches[i]); if (r < 0 && r != -EEXIST) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to add multiarch architecture to seccomp filter")); } } } } /* TODO: Should we filter the kernel keyring syscalls in some way? * We do want them to be used by desktop apps, but they could also perhaps * leak system stuff or secrets from other apps. */ for (i = 0; i < G_N_ELEMENTS (syscall_blocklist); i++) { int scall = syscall_blocklist[i].scall; if (syscall_blocklist[i].arg) r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 1, *syscall_blocklist[i].arg); else r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 0); if (r < 0 && r == -EFAULT /* unknown syscall */) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to block syscall %d"), scall); } if (!devel) { for (i = 0; i < G_N_ELEMENTS (syscall_nondevel_blocklist); i++) { int scall = syscall_nondevel_blocklist[i].scall; if (syscall_nondevel_blocklist[i].arg) r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 1, *syscall_nondevel_blocklist[i].arg); else r = seccomp_rule_add (seccomp, SCMP_ACT_ERRNO (EPERM), scall, 0); if (r < 0 && r == -EFAULT /* unknown syscall */) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to block syscall %d"), scall); } } /* Socket filtering doesn't work on e.g. i386, so ignore failures here * However, we need to user seccomp_rule_add_exact to avoid libseccomp doing * something else: https://github.com/seccomp/libseccomp/issues/8 */ last_allowed_family = -1; for (i = 0; i < G_N_ELEMENTS (socket_family_allowlist); i++) { int family = socket_family_allowlist[i].family; int disallowed; if (socket_family_allowlist[i].flags_mask != 0 && (socket_family_allowlist[i].flags_mask & run_flags) != socket_family_allowlist[i].flags_mask) continue; for (disallowed = last_allowed_family + 1; disallowed < family; disallowed++) { /* Blocklist the in-between valid families */ seccomp_rule_add_exact (seccomp, SCMP_ACT_ERRNO (EAFNOSUPPORT), SCMP_SYS (socket), 1, SCMP_A0 (SCMP_CMP_EQ, disallowed)); } last_allowed_family = family; } /* Blocklist the rest */ seccomp_rule_add_exact (seccomp, SCMP_ACT_ERRNO (EAFNOSUPPORT), SCMP_SYS (socket), 1, SCMP_A0 (SCMP_CMP_GE, last_allowed_family + 1)); if (!glnx_open_anonymous_tmpfile_full (O_RDWR | O_CLOEXEC, "/tmp", &seccomp_tmpf, error)) return FALSE; if (seccomp_export_bpf (seccomp, seccomp_tmpf.fd) != 0) return flatpak_fail_error (error, FLATPAK_ERROR_SETUP_FAILED, _("Failed to export bpf")); lseek (seccomp_tmpf.fd, 0, SEEK_SET); flatpak_bwrap_add_args_data_fd (bwrap, "--seccomp", glnx_steal_fd (&seccomp_tmpf.fd), NULL); return TRUE; }
1025
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_dir_deploy
flatpak_dir_deploy( FlatpakDir * self , const char * origin , FlatpakDecomposed * ref , const char * checksum_or_latest , const char * const * subpaths , const char * const * previous_ids , GCancellable * cancellable , GError ** error)
['self', 'origin', 'ref', 'checksum_or_latest', 'subpaths', 'previous_ids', 'cancellable', 'error']
flatpak_dir_deploy (FlatpakDir *self, const char *origin, FlatpakDecomposed *ref, const char *checksum_or_latest, const char * const * subpaths, const char * const * previous_ids, GCancellable *cancellable, GError **error) { g_autofree char *resolved_ref = NULL; g_autofree char *ref_id = NULL; g_autoptr(GFile) root = NULL; g_autoptr(GFile) deploy_base = NULL; g_autoptr(GFile) checkoutdir = NULL; g_autoptr(GFile) bindir = NULL; g_autofree char *checkoutdirpath = NULL; g_autoptr(GFile) real_checkoutdir = NULL; g_autoptr(GFile) dotref = NULL; g_autoptr(GFile) files_etc = NULL; g_autoptr(GFile) deploy_data_file = NULL; g_autoptr(GVariant) commit_data = NULL; g_autoptr(GBytes) deploy_data = NULL; g_autoptr(GFile) export = NULL; g_autoptr(GFile) extradir = NULL; g_autoptr(GKeyFile) keyfile = NULL; guint64 installed_size = 0; OstreeRepoCheckoutAtOptions options = { 0, }; const char *checksum; glnx_autofd int checkoutdir_dfd = -1; g_autoptr(GFile) tmp_dir_template = NULL; g_autofree char *tmp_dir_path = NULL; const char *xa_ref = NULL; g_autofree char *checkout_basename = NULL; gboolean created_extra_data = FALSE; g_autoptr(GVariant) commit_metadata = NULL; g_auto(GLnxLockFile) lock = { 0, }; g_autoptr(GFile) metadata_file = NULL; g_autofree char *metadata_contents = NULL; gboolean is_oci; const char *flatpak; if (!flatpak_dir_ensure_repo (self, cancellable, error)) return FALSE; ref_id = flatpak_decomposed_dup_id (ref); /* Keep a shared repo lock to avoid prunes removing objects we're relying on * while we do the checkout. This could happen if the ref changes after we * read its current value for the checkout. */ if (!flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error)) return FALSE; deploy_base = flatpak_dir_get_deploy_dir (self, ref); if (checksum_or_latest == NULL) { g_debug ("No checksum specified, getting tip of %s from origin %s", flatpak_decomposed_get_ref (ref), origin); resolved_ref = flatpak_dir_read_latest (self, origin, flatpak_decomposed_get_ref (ref), NULL, cancellable, error); if (resolved_ref == NULL) { g_prefix_error (error, _("While trying to resolve ref %s: "), flatpak_decomposed_get_ref (ref)); return FALSE; } checksum = resolved_ref; g_debug ("tip resolved to: %s", checksum); } else { checksum = checksum_or_latest; g_debug ("Looking for checksum %s in local repo", checksum); if (!ostree_repo_read_commit (self->repo, checksum, NULL, NULL, cancellable, NULL)) return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("%s is not available"), flatpak_decomposed_get_ref (ref)); } if (!ostree_repo_load_commit (self->repo, checksum, &commit_data, NULL, error)) return FALSE; commit_metadata = g_variant_get_child_value (commit_data, 0); checkout_basename = flatpak_dir_get_deploy_subdir (self, checksum, subpaths); real_checkoutdir = g_file_get_child (deploy_base, checkout_basename); if (g_file_query_exists (real_checkoutdir, cancellable)) return flatpak_fail_error (error, FLATPAK_ERROR_ALREADY_INSTALLED, _("%s commit %s already installed"), flatpak_decomposed_get_ref (ref), checksum); g_autofree char *template = g_strdup_printf (".%s-XXXXXX", checkout_basename); tmp_dir_template = g_file_get_child (deploy_base, template); tmp_dir_path = g_file_get_path (tmp_dir_template); if (g_mkdtemp_full (tmp_dir_path, 0755) == NULL) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Can't create deploy directory")); return FALSE; } checkoutdir = g_file_new_for_path (tmp_dir_path); if (!ostree_repo_read_commit (self->repo, checksum, &root, NULL, cancellable, error)) { g_prefix_error (error, _("Failed to read commit %s: "), checksum); return FALSE; } if (!flatpak_repo_collect_sizes (self->repo, root, &installed_size, NULL, cancellable, error)) return FALSE; options.mode = OSTREE_REPO_CHECKOUT_MODE_USER; options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES; options.enable_fsync = FALSE; /* We checkout to a temp dir and sync before moving it in place */ options.bareuseronly_dirs = TRUE; /* https://github.com/ostreedev/ostree/pull/927 */ checkoutdirpath = g_file_get_path (checkoutdir); if (subpaths == NULL || *subpaths == NULL) { if (!ostree_repo_checkout_at (self->repo, &options, AT_FDCWD, checkoutdirpath, checksum, cancellable, error)) { g_prefix_error (error, _("While trying to checkout %s into %s: "), checksum, checkoutdirpath); return FALSE; } } else { g_autoptr(GFile) files = g_file_get_child (checkoutdir, "files"); int i; if (!g_file_make_directory_with_parents (files, cancellable, error)) return FALSE; options.subpath = "/metadata"; if (!ostree_repo_checkout_at (self->repo, &options, AT_FDCWD, checkoutdirpath, checksum, cancellable, error)) { g_prefix_error (error, _("While trying to checkout metadata subpath: ")); return FALSE; } for (i = 0; subpaths[i] != NULL; i++) { g_autofree char *subpath = g_build_filename ("/files", subpaths[i], NULL); g_autofree char *dstpath = g_build_filename (checkoutdirpath, "/files", subpaths[i], NULL); g_autofree char *dstpath_parent = g_path_get_dirname (dstpath); g_autoptr(GFile) child = NULL; child = g_file_resolve_relative_path (root, subpath); if (!g_file_query_exists (child, cancellable)) { g_debug ("subpath %s not in tree", subpaths[i]); continue; } if (g_mkdir_with_parents (dstpath_parent, 0755)) { glnx_set_error_from_errno (error); return FALSE; } options.subpath = subpath; if (!ostree_repo_checkout_at (self->repo, &options, AT_FDCWD, dstpath, checksum, cancellable, error)) { g_prefix_error (error, _("While trying to checkout subpath ‘%s’: "), subpath); return FALSE; } } } /* Extract any extra data */ extradir = g_file_resolve_relative_path (checkoutdir, "files/extra"); if (!flatpak_rm_rf (extradir, cancellable, error)) { g_prefix_error (error, _("While trying to remove existing extra dir: ")); return FALSE; } if (!extract_extra_data (self, checksum, extradir, &created_extra_data, cancellable, error)) return FALSE; if (created_extra_data) { if (!apply_extra_data (self, checkoutdir, cancellable, error)) { g_prefix_error (error, _("While trying to apply extra data: ")); return FALSE; } } g_variant_lookup (commit_metadata, "xa.ref", "&s", &xa_ref); if (xa_ref != NULL) { gboolean gpg_verify_summary; if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, origin, &gpg_verify_summary, error)) return FALSE; if (gpg_verify_summary) { /* If we're using signed summaries, then the security is really due to the signatures on * the summary, and the xa.ref is not needed for security. In particular, endless are * currently using one single commit on multiple branches to handle devel/stable promotion. * So, to support this we report branch discrepancies as a warning, rather than as an error. * See https://github.com/flatpak/flatpak/pull/1013 for more discussion. */ FlatpakDecomposed *checkout_ref = ref; g_autoptr(FlatpakDecomposed) commit_ref = NULL; commit_ref = flatpak_decomposed_new_from_ref (xa_ref, error); if (commit_ref == NULL) { g_prefix_error (error, _("Invalid commit ref %s: "), xa_ref); return FALSE; } /* Fatal if kind/name/arch don't match. Warn for branch mismatch. */ if (!flatpak_decomposed_equal_except_branch (checkout_ref, commit_ref)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, _("Deployed ref %s does not match commit (%s)"), flatpak_decomposed_get_ref (ref), xa_ref); return FALSE; } if (strcmp (flatpak_decomposed_get_branch (checkout_ref), flatpak_decomposed_get_branch (commit_ref)) != 0) g_warning (_("Deployed ref %s branch does not match commit (%s)"), flatpak_decomposed_get_ref (ref), xa_ref); } else if (strcmp (flatpak_decomposed_get_ref (ref), xa_ref) != 0) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, _("Deployed ref %s does not match commit (%s)"), flatpak_decomposed_get_ref (ref), xa_ref); return FALSE; } } keyfile = g_key_file_new (); metadata_file = g_file_resolve_relative_path (checkoutdir, "metadata"); if (g_file_load_contents (metadata_file, NULL, &metadata_contents, NULL, NULL, NULL)) { if (!g_key_file_load_from_data (keyfile, metadata_contents, -1, 0, error)) return FALSE; if (!flatpak_check_required_version (flatpak_decomposed_get_ref (ref), keyfile, error)) return FALSE; } /* Check the metadata in the commit to make sure it matches the actual * deployed metadata, in case we relied on the one in the commit for * a decision * Note: For historical reason we don't enforce commits to contain xa.metadata * since this was lacking in fedora builds. */ is_oci = flatpak_dir_get_remote_oci (self, origin); if (!validate_commit_metadata (commit_data, flatpak_decomposed_get_ref (ref), metadata_contents, !is_oci, error)) return FALSE; dotref = g_file_resolve_relative_path (checkoutdir, "files/.ref"); if (!g_file_replace_contents (dotref, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; export = g_file_get_child (checkoutdir, "export"); /* Never export any binaries bundled with the app */ bindir = g_file_get_child (export, "bin"); if (!flatpak_rm_rf (bindir, cancellable, error)) return FALSE; if (flatpak_decomposed_is_runtime (ref)) { /* Ensure that various files exist as regular files in /usr/etc, as we want to bind-mount over them */ files_etc = g_file_resolve_relative_path (checkoutdir, "files/etc"); if (g_file_query_exists (files_etc, cancellable)) { char *etcfiles[] = {"passwd", "group", "machine-id" }; g_autoptr(GFile) etc_resolve_conf = g_file_get_child (files_etc, "resolv.conf"); int i; for (i = 0; i < G_N_ELEMENTS (etcfiles); i++) { g_autoptr(GFile) etc_file = g_file_get_child (files_etc, etcfiles[i]); GFileType type; type = g_file_query_file_type (etc_file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable); if (type == G_FILE_TYPE_REGULAR) continue; if (type != G_FILE_TYPE_UNKNOWN) { /* Already exists, but not regular, probably symlink. Remove it */ if (!g_file_delete (etc_file, cancellable, error)) return FALSE; } if (!g_file_replace_contents (etc_file, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; } if (g_file_query_exists (etc_resolve_conf, cancellable) && !g_file_delete (etc_resolve_conf, cancellable, error)) return FALSE; if (!g_file_make_symbolic_link (etc_resolve_conf, "/run/host/monitor/resolv.conf", cancellable, error)) return FALSE; } /* Runtime should never export anything */ if (!flatpak_rm_rf (export, cancellable, error)) return FALSE; } else /* is app */ { g_autofree char *ref_arch = flatpak_decomposed_dup_arch (ref); g_autofree char *ref_branch = flatpak_decomposed_dup_branch (ref); g_autoptr(GFile) wrapper = g_file_get_child (bindir, ref_id); g_autofree char *escaped_app = maybe_quote (ref_id); g_autofree char *escaped_branch = maybe_quote (ref_branch); g_autofree char *escaped_arch = maybe_quote (ref_arch); g_autofree char *bin_data = NULL; int r; if (!flatpak_mkdir_p (bindir, cancellable, error)) return FALSE; if (!flatpak_rewrite_export_dir (ref_id, ref_branch, ref_arch, keyfile, previous_ids, export, cancellable, error)) return FALSE; if ((flatpak = g_getenv ("FLATPAK_BINARY")) == NULL) flatpak = FLATPAK_BINDIR "/flatpak"; bin_data = g_strdup_printf ("#!/bin/sh\nexec %s run --branch=%s --arch=%s %s \"$@\"\n", flatpak, escaped_branch, escaped_arch, escaped_app); if (!g_file_replace_contents (wrapper, bin_data, strlen (bin_data), NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; do r = fchmodat (AT_FDCWD, flatpak_file_get_path_cached (wrapper), 0755, 0); while (G_UNLIKELY (r == -1 && errno == EINTR)); if (r == -1) return glnx_throw_errno_prefix (error, "fchmodat"); } deploy_data = flatpak_dir_new_deploy_data (self, checkoutdir, commit_data, commit_metadata, keyfile, ref_id, origin, checksum, (char **) subpaths, installed_size, previous_ids); /* Check the app is actually allowed to be used by this user. This can block * on getting authorisation. */ if (!flatpak_dir_check_parental_controls (self, flatpak_decomposed_get_ref (ref), deploy_data, cancellable, error)) return FALSE; deploy_data_file = g_file_get_child (checkoutdir, "deploy"); if (!flatpak_bytes_save (deploy_data_file, deploy_data, cancellable, error)) return FALSE; if (!glnx_opendirat (AT_FDCWD, checkoutdirpath, TRUE, &checkoutdir_dfd, error)) return FALSE; if (syncfs (checkoutdir_dfd) != 0) { glnx_set_error_from_errno (error); return FALSE; } if (!g_file_move (checkoutdir, real_checkoutdir, G_FILE_COPY_NO_FALLBACK_FOR_MOVE, cancellable, NULL, NULL, error)) return FALSE; if (!flatpak_dir_set_active (self, ref, checkout_basename, cancellable, error)) return FALSE; if (!flatpak_dir_update_deploy_ref (self, flatpak_decomposed_get_ref (ref), checksum, error)) return FALSE; return TRUE; }
2090
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_dir_pull
flatpak_dir_pull( FlatpakDir * self , FlatpakRemoteState * state , const char * ref , const char * opt_rev , const char ** subpaths , GFile * sideload_repo , GBytes * require_metadata , const char * token , OstreeRepo * repo , FlatpakPullFlags flatpak_flags , OstreeRepoPullFlags flags , FlatpakProgress * progress , GCancellable * cancellable , GError ** error)
['self', 'state', 'ref', 'opt_rev', 'subpaths', 'sideload_repo', 'require_metadata', 'token', 'repo', 'flatpak_flags', 'flags', 'progress', 'cancellable', 'error']
flatpak_dir_pull (FlatpakDir *self, FlatpakRemoteState *state, const char *ref, const char *opt_rev, const char **subpaths, GFile *sideload_repo, GBytes *require_metadata, const char *token, OstreeRepo *repo, FlatpakPullFlags flatpak_flags, OstreeRepoPullFlags flags, FlatpakProgress *progress, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; g_autofree char *rev = NULL; g_autofree char *url = NULL; g_autoptr(GPtrArray) subdirs_arg = NULL; g_auto(GLnxLockFile) lock = { 0, }; g_autofree char *name = NULL; g_autofree char *current_checksum = NULL; if (!flatpak_dir_ensure_repo (self, cancellable, error)) return FALSE; /* Keep a shared repo lock to avoid prunes removing objects we're relying on * while we do the pull. There are two cases we protect against. 1) objects we * need but that we already decided are locally available could be removed, * and 2) during the transaction commit objects that don't yet have a ref to * them could be considered unreachable. */ if (repo == NULL && !flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error)) return FALSE; if (flatpak_dir_get_remote_oci (self, state->remote_name)) return flatpak_dir_pull_oci (self, state, ref, opt_rev, repo, flatpak_flags, flags, token, progress, cancellable, error); if (!ostree_repo_remote_get_url (self->repo, state->remote_name, &url, error)) return FALSE; if (*url == 0) return TRUE; /* Empty url, silently disables updates */ /* We get the rev ahead of time so that we know it for looking up e.g. extra-data and to make sure we're atomically using a single rev if we happen to do multiple pulls (e.g. with subpaths) */ if (opt_rev != NULL) { rev = g_strdup (opt_rev); } else { flatpak_remote_state_lookup_ref (state, ref, &rev, NULL, NULL, NULL, error); if (rev == NULL && error != NULL && *error == NULL) flatpak_fail_error (error, FLATPAK_ERROR_REF_NOT_FOUND, _("Couldn't find latest checksum for ref %s in remote %s"), ref, state->remote_name); if (rev == NULL) { g_assert (error == NULL || *error != NULL); return FALSE; } } g_debug ("%s: Using commit %s for pull of ref %s from remote %s%s%s", G_STRFUNC, rev, ref, state->remote_name, sideload_repo ? "sideloaded from " : "", sideload_repo ? flatpak_file_get_path_cached (sideload_repo) : "" ); if (repo == NULL) repo = self->repo; /* Past this we must use goto out, so we clean up console and abort the transaction on error */ if (subpaths != NULL && subpaths[0] != NULL) { subdirs_arg = g_ptr_array_new_with_free_func (g_free); int i; g_ptr_array_add (subdirs_arg, g_strdup ("/metadata")); for (i = 0; subpaths[i] != NULL; i++) g_ptr_array_add (subdirs_arg, g_build_filename ("/files", subpaths[i], NULL)); g_ptr_array_add (subdirs_arg, NULL); } /* Setup extra data information before starting to pull, so we can have precise * progress reports */ if (!flatpak_dir_setup_extra_data (self, state, repo, ref, rev, sideload_repo, token, flatpak_flags, progress, cancellable, error)) goto out; if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error)) goto out; flatpak_repo_resolve_rev (repo, NULL, state->remote_name, ref, TRUE, &current_checksum, NULL, NULL); if (!repo_pull (repo, state, subdirs_arg ? (const char **) subdirs_arg->pdata : NULL, ref, rev, sideload_repo, token, flatpak_flags, flags, progress, cancellable, error)) { g_prefix_error (error, _("While pulling %s from remote %s: "), ref, state->remote_name); goto out; } if (require_metadata) { g_autoptr(GVariant) commit_data = NULL; if (!ostree_repo_load_commit (repo, rev, &commit_data, NULL, error) || !validate_commit_metadata (commit_data, ref, (const char *)g_bytes_get_data (require_metadata, NULL), TRUE, error)) return FALSE; } if (!flatpak_dir_pull_extra_data (self, repo, state->remote_name, ref, rev, flatpak_flags, progress, cancellable, error)) goto out; if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error)) goto out; ret = TRUE; if (repo == self->repo) name = flatpak_dir_get_name (self); else { GFile *file = ostree_repo_get_path (repo); name = g_file_get_path (file); } (flatpak_dir_log) (self, __FILE__, __LINE__, __FUNCTION__, name, "pull", state->remote_name, ref, rev, current_checksum, NULL, "Pulled %s from %s", ref, state->remote_name); out: if (!ret) { ostree_repo_abort_transaction (repo, cancellable, NULL); g_assert (error == NULL || *error != NULL); } return ret; }
775
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
upgrade_deploy_data
upgrade_deploy_data( GBytes * deploy_data , GFile * deploy_dir , FlatpakDecomposed * ref , OstreeRepo * repo , GCancellable * cancellable , GError ** error)
['deploy_data', 'deploy_dir', 'ref', 'repo', 'cancellable', 'error']
upgrade_deploy_data (GBytes *deploy_data, GFile *deploy_dir, FlatpakDecomposed *ref, OstreeRepo *repo, GCancellable *cancellable, GError **error) { VarDeployDataRef deploy_ref = var_deploy_data_from_bytes (deploy_data); g_autoptr(GVariant) metadata = g_variant_ref_sink (var_metadata_peek_as_gvariant (var_deploy_data_get_metadata (deploy_ref))); g_auto(GVariantDict) metadata_dict = FLATPAK_VARIANT_DICT_INITIALIZER; g_autofree const char **subpaths = NULL; g_autoptr(GVariant) res = NULL; int i, n, old_version; g_variant_dict_init (&metadata_dict, NULL); g_variant_dict_insert_value (&metadata_dict, "deploy-version", g_variant_new_int32 (FLATPAK_DEPLOY_VERSION_CURRENT)); /* Copy all metadata except version from old */ n = g_variant_n_children (metadata); for (i = 0; i < n; i++) { const char *key; g_autoptr(GVariant) value = NULL; g_variant_get_child (metadata, i, "{&s@v}", &key, &value); if (strcmp (key, "deploy-version") == 0) continue; g_variant_dict_insert_value (&metadata_dict, key, value); } old_version = flatpak_deploy_data_get_version (deploy_data); if (old_version < 1) { g_autofree char *id = flatpak_decomposed_dup_id (ref); add_appdata_to_deploy_data (&metadata_dict, deploy_dir, id); } if (old_version < 3) { /* We don't know what timestamp to use here, use 0 and special case that for update checks */ g_variant_dict_insert_value (&metadata_dict, "timestamp", g_variant_new_uint64 (0)); } /* Deploy versions older than 4 might have some of the below fields, but it's * not guaranteed if the deploy was first created with an old Flatpak version */ if (old_version < 4) { const char *commit; g_autoptr(GVariant) commit_data = NULL; g_autoptr(GVariant) commit_metadata = NULL; g_autoptr(GKeyFile) keyfile = NULL; g_autoptr(GFile) metadata_file = NULL; g_autofree char *metadata_contents = NULL; g_autofree char *id = flatpak_decomposed_dup_id (ref); /* Add fields from commit metadata to deploy */ commit = flatpak_deploy_data_get_commit (deploy_data); if (!ostree_repo_load_commit (repo, commit, &commit_data, NULL, error)) return NULL; commit_metadata = g_variant_get_child_value (commit_data, 0); add_commit_metadata_to_deploy_data (&metadata_dict, commit_metadata); /* Add fields from metadata file to deploy */ keyfile = g_key_file_new (); metadata_file = g_file_resolve_relative_path (deploy_dir, "metadata"); if (!g_file_load_contents (metadata_file, cancellable, &metadata_contents, NULL, NULL, error)) return NULL; if (!g_key_file_load_from_data (keyfile, metadata_contents, -1, 0, error)) return NULL; add_metadata_to_deploy_data (&metadata_dict, keyfile); /* Add fields from appdata to deploy, since appdata-content-rating wasn't * added when upgrading from version 2 as it should have been */ if (old_version >= 1) add_appdata_to_deploy_data (&metadata_dict, deploy_dir, id); } subpaths = flatpak_deploy_data_get_subpaths (deploy_data); res = g_variant_ref_sink (g_variant_new ("(ss^ast@a{sv})", flatpak_deploy_data_get_origin (deploy_data), flatpak_deploy_data_get_commit (deploy_data), subpaths, GUINT64_TO_BE (flatpak_deploy_data_get_installed_size (deploy_data)), g_variant_dict_end (&metadata_dict))); return g_variant_get_data_as_bytes (res); }
470
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
validate_commit_metadata
validate_commit_metadata( GVariant * commit_data , const char * ref , const char * required_metadata , gboolean require_xa_metadata , GError ** error)
['commit_data', 'ref', 'required_metadata', 'require_xa_metadata', 'error']
validate_commit_metadata (GVariant *commit_data, const char *ref, const char *required_metadata, gboolean require_xa_metadata, GError **error) { g_autoptr(GVariant) commit_metadata = NULL; const char *xa_metadata = NULL; commit_metadata = g_variant_get_child_value (commit_data, 0); if (commit_metadata != NULL) g_variant_lookup (commit_metadata, "xa.metadata", "&s", &xa_metadata); if ((xa_metadata == NULL && require_xa_metadata) || (xa_metadata != NULL && g_strcmp0 (required_metadata, xa_metadata) != 0)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, _("Commit metadata for %s not matching expected metadata"), ref); return FALSE; } return TRUE; }
116
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_transaction_add_ref
flatpak_transaction_add_ref( FlatpakTransaction * self , const char * remote , FlatpakDecomposed * ref , const char ** subpaths , const char ** previous_ids , const char * commit , FlatpakTransactionOperationType kind , GFile * bundle , const char * external_metadata , gboolean pin_on_deploy , GError ** error)
['self', 'remote', 'ref', 'subpaths', 'previous_ids', 'commit', 'kind', 'bundle', 'external_metadata', 'pin_on_deploy', 'error']
flatpak_transaction_add_ref (FlatpakTransaction *self, const char *remote, FlatpakDecomposed *ref, const char **subpaths, const char **previous_ids, const char *commit, FlatpakTransactionOperationType kind, GFile *bundle, const char *external_metadata, gboolean pin_on_deploy, GError **error) { FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self); g_autofree char *origin = NULL; g_auto(GStrv) new_subpaths = NULL; const char *pref; g_autofree char *origin_remote = NULL; g_autoptr(FlatpakRemoteState) state = NULL; FlatpakTransactionOperation *op; if (remote_name_is_file (remote)) { gboolean changed_config; g_autofree char *id = flatpak_decomposed_dup_id (ref); origin_remote = flatpak_dir_create_origin_remote (priv->dir, remote, /* uri */ id, "Local repo", flatpak_decomposed_get_ref (ref), NULL, NULL, &changed_config, NULL, error); if (origin_remote == NULL) return FALSE; /* Reload changed configuration */ if (changed_config) flatpak_installation_drop_caches (priv->installation, NULL, NULL); g_ptr_array_add (priv->added_origin_remotes, g_strdup (origin_remote)); remote = origin_remote; } pref = flatpak_decomposed_get_pref (ref); /* install or update */ if (kind == FLATPAK_TRANSACTION_OPERATION_UPDATE) { g_autoptr(GBytes) deploy_data = NULL; if (!dir_ref_is_installed (priv->dir, ref, &origin, &deploy_data)) return flatpak_fail_error (error, FLATPAK_ERROR_NOT_INSTALLED, _("%s not installed"), pref); if (flatpak_dir_get_remote_disabled (priv->dir, origin)) { g_debug (_("Remote %s disabled, ignoring %s update"), origin, pref); return TRUE; } remote = origin; if (subpaths == NULL) { g_autofree const char **old_subpaths = flatpak_deploy_data_get_subpaths (deploy_data); /* As stated in the documentation for flatpak_transaction_add_update(), * for locale extensions we merge existing subpaths with the set of * configured languages, to match the behavior of add_related(). */ if (flatpak_decomposed_id_has_suffix (ref, ".Locale")) { g_auto(GStrv) extra_subpaths = flatpak_dir_get_locale_subpaths (priv->dir); new_subpaths = flatpak_subpaths_merge ((char **)old_subpaths, extra_subpaths); } else { /* Otherwise we resolve to the current subpaths here so we can know in operation-done what subpaths will be pulled */ new_subpaths = g_strdupv ((char **)old_subpaths); } subpaths = (const char **)new_subpaths; } } else if (kind == FLATPAK_TRANSACTION_OPERATION_INSTALL) { if (!priv->reinstall && dir_ref_is_installed (priv->dir, ref, &origin, NULL)) { if (g_strcmp0 (remote, origin) == 0) return flatpak_fail_error (error, FLATPAK_ERROR_ALREADY_INSTALLED, _("%s is already installed"), pref); else return flatpak_fail_error (error, FLATPAK_ERROR_DIFFERENT_REMOTE, _("%s is already installed from remote %s"), pref, origin); } } else if (kind == FLATPAK_TRANSACTION_OPERATION_UNINSTALL) { if (!dir_ref_is_installed (priv->dir, ref, &origin, NULL)) return flatpak_fail_error (error, FLATPAK_ERROR_NOT_INSTALLED, _("%s not installed"), pref); remote = origin; } /* This should have been passed in or found out above */ g_assert (remote != NULL); /* We don't need remote state for an uninstall, and we don't want a missing * remote to be fatal */ if (kind != FLATPAK_TRANSACTION_OPERATION_UNINSTALL) { g_autofree char *arch = flatpak_decomposed_dup_arch (ref); state = flatpak_transaction_ensure_remote_state (self, kind, remote, arch, error); if (state == NULL) return FALSE; } op = flatpak_transaction_add_op (self, remote, ref, subpaths, previous_ids, commit, bundle, kind, pin_on_deploy, error); if (op == NULL) return FALSE; if (external_metadata) op->external_metadata = g_bytes_new (external_metadata, strlen (external_metadata) + 1); return TRUE; }
586
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
load_deployed_metadata
load_deployed_metadata( FlatpakTransaction * self , FlatpakDecomposed * ref , char ** out_commit , char ** out_remote)
['self', 'ref', 'out_commit', 'out_remote']
load_deployed_metadata (FlatpakTransaction *self, FlatpakDecomposed *ref, char **out_commit, char **out_remote) { FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self); g_autoptr(GFile) deploy_dir = NULL; g_autoptr(GFile) metadata_file = NULL; g_autofree char *metadata_contents = NULL; gsize metadata_contents_length; deploy_dir = flatpak_dir_get_if_deployed (priv->dir, ref, NULL, NULL); if (deploy_dir == NULL) return NULL; if (out_commit || out_remote) { g_autoptr(GBytes) deploy_data = NULL; deploy_data = flatpak_load_deploy_data (deploy_dir, ref, flatpak_dir_get_repo (priv->dir), FLATPAK_DEPLOY_VERSION_ANY, NULL, NULL); if (deploy_data == NULL) return NULL; if (out_commit) *out_commit = g_strdup (flatpak_deploy_data_get_commit (deploy_data)); if (out_remote) *out_remote = g_strdup (flatpak_deploy_data_get_origin (deploy_data)); } metadata_file = g_file_get_child (deploy_dir, "metadata"); if (!g_file_load_contents (metadata_file, NULL, &metadata_contents, &metadata_contents_length, NULL, NULL)) { g_debug ("No metadata in local deploy of %s", flatpak_decomposed_get_ref (ref)); return NULL; } return g_bytes_new_take (g_steal_pointer (&metadata_contents), metadata_contents_length + 1); }
214
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
resolve_op_from_commit
resolve_op_from_commit( FlatpakTransaction * self , FlatpakTransactionOperation * op , const char * checksum , GFile * sideload_path , GVariant * commit_data)
['self', 'op', 'checksum', 'sideload_path', 'commit_data']
resolve_op_from_commit (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, GVariant *commit_data) { g_autoptr(GBytes) metadata_bytes = NULL; g_autoptr(GVariant) commit_metadata = NULL; const char *xa_metadata = NULL; guint64 download_size = 0; guint64 installed_size = 0; commit_metadata = g_variant_get_child_value (commit_data, 0); g_variant_lookup (commit_metadata, "xa.metadata", "&s", &xa_metadata); if (xa_metadata == NULL) g_message ("Warning: No xa.metadata in local commit %s ref %s", checksum, flatpak_decomposed_get_ref (op->ref)); else metadata_bytes = g_bytes_new (xa_metadata, strlen (xa_metadata) + 1); if (g_variant_lookup (commit_metadata, "xa.download-size", "t", &download_size)) op->download_size = GUINT64_FROM_BE (download_size); if (g_variant_lookup (commit_metadata, "xa.installed-size", "t", &installed_size)) op->installed_size = GUINT64_FROM_BE (installed_size); g_variant_lookup (commit_metadata, OSTREE_COMMIT_META_KEY_ENDOFLIFE, "s", &op->eol); g_variant_lookup (commit_metadata, OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE, "s", &op->eol_rebase); resolve_op_end (self, op, checksum, sideload_path, metadata_bytes); }
201
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
try_resolve_op_from_metadata
try_resolve_op_from_metadata( FlatpakTransaction * self , FlatpakTransactionOperation * op , const char * checksum , GFile * sideload_path , FlatpakRemoteState * state)
['self', 'op', 'checksum', 'sideload_path', 'state']
try_resolve_op_from_metadata (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, FlatpakRemoteState *state) { g_autoptr(GBytes) metadata_bytes = NULL; guint64 download_size = 0; guint64 installed_size = 0; const char *metadata = NULL; VarMetadataRef sparse_cache; VarRefInfoRef info; g_autofree char *summary_checksum = NULL; /* Ref has to match the actual commit in the summary */ if ((state->summary == NULL && state->index == NULL) || !flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (op->ref), &summary_checksum, NULL, NULL, NULL, NULL) || strcmp (summary_checksum, checksum) != 0) return FALSE; /* And, we must have the actual cached data in the summary */ if (!flatpak_remote_state_lookup_cache (state, flatpak_decomposed_get_ref (op->ref), &download_size, &installed_size, &metadata, NULL)) return FALSE; metadata_bytes = g_bytes_new (metadata, strlen (metadata) + 1); if (flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (op->ref), NULL, NULL, &info, NULL, NULL)) op->summary_metadata = var_metadata_dup_to_gvariant (var_ref_info_get_metadata (info)); op->installed_size = installed_size; op->download_size = download_size; op->token_type = state->default_token_type; if (flatpak_remote_state_lookup_sparse_cache (state, flatpak_decomposed_get_ref (op->ref), &sparse_cache, NULL)) { op->eol = g_strdup (var_metadata_lookup_string (sparse_cache, FLATPAK_SPARSE_CACHE_KEY_ENDOFLINE, NULL)); op->eol_rebase = g_strdup (var_metadata_lookup_string (sparse_cache, FLATPAK_SPARSE_CACHE_KEY_ENDOFLINE_REBASE, NULL)); op->token_type = GINT32_FROM_LE (var_metadata_lookup_int32 (sparse_cache, FLATPAK_SPARSE_CACHE_KEY_TOKEN_TYPE, op->token_type)); } resolve_op_end (self, op, checksum, sideload_path, metadata_bytes); return TRUE; }
302
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Ryan Gonzalez
2021-12-23 18:30:17-06:00
Fix metadata file contents after null terminators being ignored In particular, if a null terminator is placed inside the metadata file, Flatpak will only compare the text *before* it to the value of xa.metadata, but the full file will be parsed when permissions are set at runtime. This means that any app can include a null terminator in its permissions metadata, and Flatpak will only show the user the permissions *preceding* the terminator during install, but the permissions *after* the terminator are applied at runtime. Fixes GHSA-qpjc-vq3c-572j / CVE-2021-43860 Signed-off-by: Ryan Gonzalez <[email protected]>
ba818f504c926baaf6e362be8159cfacf994310e
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_pull_from_bundle
flatpak_pull_from_bundle( OstreeRepo * repo , GFile * file , const char * remote , const char * ref , gboolean require_gpg_signature , GCancellable * cancellable , GError ** error)
['repo', 'file', 'remote', 'ref', 'require_gpg_signature', 'cancellable', 'error']
flatpak_pull_from_bundle (OstreeRepo *repo, GFile *file, const char *remote, const char *ref, gboolean require_gpg_signature, GCancellable *cancellable, GError **error) { g_autofree char *metadata_contents = NULL; g_autofree char *to_checksum = NULL; g_autoptr(GFile) root = NULL; g_autoptr(GFile) metadata_file = NULL; g_autoptr(GInputStream) in = NULL; g_autoptr(OstreeGpgVerifyResult) gpg_result = NULL; g_autoptr(GError) my_error = NULL; g_autoptr(GVariant) metadata = NULL; gboolean metadata_valid; g_autofree char *remote_collection_id = NULL; g_autofree char *collection_id = NULL; metadata = flatpak_bundle_load (file, &to_checksum, NULL, NULL, NULL, &metadata_contents, NULL, NULL, &collection_id, error); if (metadata == NULL) return FALSE; if (!ostree_repo_get_remote_option (repo, remote, "collection-id", NULL, &remote_collection_id, NULL)) remote_collection_id = NULL; if (remote_collection_id != NULL && collection_id != NULL && strcmp (remote_collection_id, collection_id) != 0) return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Collection ‘%s’ of bundle doesn’t match collection ‘%s’ of remote"), collection_id, remote_collection_id); if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error)) return FALSE; /* Don’t need to set the collection ID here, since the remote binds this ref to the collection. */ ostree_repo_transaction_set_ref (repo, remote, ref, to_checksum); if (!ostree_repo_static_delta_execute_offline (repo, file, FALSE, cancellable, error)) return FALSE; gpg_result = ostree_repo_verify_commit_ext (repo, to_checksum, NULL, NULL, cancellable, &my_error); if (gpg_result == NULL) { /* no gpg signature, we ignore this *if* there is no gpg key * specified in the bundle or by the user */ if (g_error_matches (my_error, OSTREE_GPG_ERROR, OSTREE_GPG_ERROR_NO_SIGNATURE) && !require_gpg_signature) { g_clear_error (&my_error); } else { g_propagate_error (error, g_steal_pointer (&my_error)); return FALSE; } } else { /* If there is no valid gpg signature we fail, unless there is no gpg key specified (on the command line or in the file) because then we trust the source bundle. */ if (ostree_gpg_verify_result_count_valid (gpg_result) == 0 && require_gpg_signature) return flatpak_fail_error (error, FLATPAK_ERROR_UNTRUSTED, _("GPG signatures found, but none are in trusted keyring")); } if (!ostree_repo_read_commit (repo, to_checksum, &root, NULL, NULL, error)) return FALSE; if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error)) return FALSE; /* We ensure that the actual installed metadata matches the one in the header, because you may have made decisions on whether to install it or not based on that data. */ metadata_file = g_file_resolve_relative_path (root, "metadata"); in = (GInputStream *) g_file_read (metadata_file, cancellable, NULL); if (in != NULL) { g_autoptr(GMemoryOutputStream) data_stream = (GMemoryOutputStream *) g_memory_output_stream_new_resizable (); if (g_output_stream_splice (G_OUTPUT_STREAM (data_stream), in, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE, cancellable, error) < 0) return FALSE; /* Null terminate */ g_output_stream_write (G_OUTPUT_STREAM (data_stream), "\0", 1, NULL, NULL); metadata_valid = metadata_contents != NULL && strcmp (metadata_contents, g_memory_output_stream_get_data (data_stream)) == 0; } else { metadata_valid = (metadata_contents == NULL); } if (!metadata_valid) { /* Immediately remove this broken commit */ ostree_repo_set_ref_immediate (repo, remote, ref, NULL, cancellable, error); return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Metadata in header and app are inconsistent")); } return TRUE; }
538
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-10 16:43:08+01:00
Transaction: Fail the resolve if xa.metadata invalid or missing If we fail to parse xa.metadata from the summary cache or the commit xa.metadata we fail the resolve. If xa.metadata is missing in the commit we fail the resolve (it is always set in the summary cache, because summary update converts missing xa.metadata to "", so we either get that, or cache miss which leads to resolving from the commit. This means that op->resolved_metadata is always set during install and updates, which means we will show the app permissions. The transaction will also always make sure that this data actually matches what gets deployed. Before this change an invalid metadata in the summary cache could lead to a NULL resolved_metadata, which means we wouldn't print the app permissions, yet we would still deploy some metadata file that could have permissions. (NOTE: It would fail to deploy unless the xa.metadata in the commit matched the metadata file, but in this corner case we would't compare the summary and commit metadata, so they may differ.)
d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
mark_op_resolved
mark_op_resolved( FlatpakTransactionOperation * op , const char * commit , GFile * sideload_path , GBytes * metadata , GBytes * old_metadata)
['op', 'commit', 'sideload_path', 'metadata', 'old_metadata']
mark_op_resolved (FlatpakTransactionOperation *op, const char *commit, GFile *sideload_path, GBytes *metadata, GBytes *old_metadata) { g_debug ("marking op %s:%s resolved to %s", kind_to_str (op->kind), flatpak_decomposed_get_ref (op->ref), commit ? commit : "-"); g_assert (op != NULL); g_assert (commit != NULL); op->resolved = TRUE; if (op->resolved_commit != commit) { g_free (op->resolved_commit); /* This is already set if we retry resolving to get a token, so free first */ op->resolved_commit = g_strdup (commit); } if (sideload_path) op->resolved_sideload_path = g_object_ref (sideload_path); if (metadata) { g_autoptr(GKeyFile) metakey = g_key_file_new (); if (g_key_file_load_from_bytes (metakey, metadata, G_KEY_FILE_NONE, NULL)) { op->resolved_metadata = g_bytes_ref (metadata); op->resolved_metakey = g_steal_pointer (&metakey); } else g_message ("Warning: Failed to parse metadata for %s\n", flatpak_decomposed_get_ref (op->ref)); } if (old_metadata) { g_autoptr(GKeyFile) metakey = g_key_file_new (); if (g_key_file_load_from_bytes (metakey, old_metadata, G_KEY_FILE_NONE, NULL)) { op->resolved_old_metadata = g_bytes_ref (old_metadata); op->resolved_old_metakey = g_steal_pointer (&metakey); } else g_message ("Warning: Failed to parse old metadata for %s\n", flatpak_decomposed_get_ref (op->ref)); } }
235
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-10 16:43:08+01:00
Transaction: Fail the resolve if xa.metadata invalid or missing If we fail to parse xa.metadata from the summary cache or the commit xa.metadata we fail the resolve. If xa.metadata is missing in the commit we fail the resolve (it is always set in the summary cache, because summary update converts missing xa.metadata to "", so we either get that, or cache miss which leads to resolving from the commit. This means that op->resolved_metadata is always set during install and updates, which means we will show the app permissions. The transaction will also always make sure that this data actually matches what gets deployed. Before this change an invalid metadata in the summary cache could lead to a NULL resolved_metadata, which means we wouldn't print the app permissions, yet we would still deploy some metadata file that could have permissions. (NOTE: It would fail to deploy unless the xa.metadata in the commit matched the metadata file, but in this corner case we would't compare the summary and commit metadata, so they may differ.)
d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
resolve_op_end
resolve_op_end( FlatpakTransaction * self , FlatpakTransactionOperation * op , const char * checksum , GFile * sideload_path , GBytes * metadata_bytes)
['self', 'op', 'checksum', 'sideload_path', 'metadata_bytes']
resolve_op_end (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, GBytes *metadata_bytes) { g_autoptr(GBytes) old_metadata_bytes = NULL; old_metadata_bytes = load_deployed_metadata (self, op->ref, NULL, NULL); mark_op_resolved (op, checksum, sideload_path, metadata_bytes, old_metadata_bytes); emit_eol_and_maybe_skip (self, op); }
68
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-10 16:43:08+01:00
Transaction: Fail the resolve if xa.metadata invalid or missing If we fail to parse xa.metadata from the summary cache or the commit xa.metadata we fail the resolve. If xa.metadata is missing in the commit we fail the resolve (it is always set in the summary cache, because summary update converts missing xa.metadata to "", so we either get that, or cache miss which leads to resolving from the commit. This means that op->resolved_metadata is always set during install and updates, which means we will show the app permissions. The transaction will also always make sure that this data actually matches what gets deployed. Before this change an invalid metadata in the summary cache could lead to a NULL resolved_metadata, which means we wouldn't print the app permissions, yet we would still deploy some metadata file that could have permissions. (NOTE: It would fail to deploy unless the xa.metadata in the commit matched the metadata file, but in this corner case we would't compare the summary and commit metadata, so they may differ.)
d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
resolve_op_from_commit
resolve_op_from_commit( FlatpakTransaction * self , FlatpakTransactionOperation * op , const char * checksum , GFile * sideload_path , GVariant * commit_data)
['self', 'op', 'checksum', 'sideload_path', 'commit_data']
resolve_op_from_commit (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, GVariant *commit_data) { g_autoptr(GBytes) metadata_bytes = NULL; g_autoptr(GVariant) commit_metadata = NULL; const char *xa_metadata = NULL; guint64 download_size = 0; guint64 installed_size = 0; commit_metadata = g_variant_get_child_value (commit_data, 0); g_variant_lookup (commit_metadata, "xa.metadata", "&s", &xa_metadata); if (xa_metadata == NULL) g_message ("Warning: No xa.metadata in local commit %s ref %s", checksum, flatpak_decomposed_get_ref (op->ref)); else metadata_bytes = g_bytes_new (xa_metadata, strlen (xa_metadata)); if (g_variant_lookup (commit_metadata, "xa.download-size", "t", &download_size)) op->download_size = GUINT64_FROM_BE (download_size); if (g_variant_lookup (commit_metadata, "xa.installed-size", "t", &installed_size)) op->installed_size = GUINT64_FROM_BE (installed_size); g_variant_lookup (commit_metadata, OSTREE_COMMIT_META_KEY_ENDOFLIFE, "s", &op->eol); g_variant_lookup (commit_metadata, OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE, "s", &op->eol_rebase); resolve_op_end (self, op, checksum, sideload_path, metadata_bytes); }
199
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-10 16:43:08+01:00
Transaction: Fail the resolve if xa.metadata invalid or missing If we fail to parse xa.metadata from the summary cache or the commit xa.metadata we fail the resolve. If xa.metadata is missing in the commit we fail the resolve (it is always set in the summary cache, because summary update converts missing xa.metadata to "", so we either get that, or cache miss which leads to resolving from the commit. This means that op->resolved_metadata is always set during install and updates, which means we will show the app permissions. The transaction will also always make sure that this data actually matches what gets deployed. Before this change an invalid metadata in the summary cache could lead to a NULL resolved_metadata, which means we wouldn't print the app permissions, yet we would still deploy some metadata file that could have permissions. (NOTE: It would fail to deploy unless the xa.metadata in the commit matched the metadata file, but in this corner case we would't compare the summary and commit metadata, so they may differ.)
d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
resolve_ops
resolve_ops( FlatpakTransaction * self , GCancellable * cancellable , GError ** error)
['self', 'cancellable', 'error']
resolve_ops (FlatpakTransaction *self, GCancellable *cancellable, GError **error) { FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self); GList *l; for (l = priv->ops; l != NULL; l = l->next) { FlatpakTransactionOperation *op = l->data; g_autoptr(FlatpakRemoteState) state = NULL; g_autofree char *checksum = NULL; g_autoptr(GBytes) metadata_bytes = NULL; if (op->resolved) continue; if (op->skip) { /* We're not yet resolved, but marked skip anyway, this can happen if during * request_required_tokens() we were normalized away even though not fully resolved. * For example we got the checksum but need to auth to get the commit, but the * checksum we got was the version already installed. */ g_assert (op->resolved_commit != NULL); mark_op_resolved (op, op->resolved_commit, NULL, NULL, NULL); continue; } if (op->kind == FLATPAK_TRANSACTION_OPERATION_UNINSTALL) { /* We resolve to the deployed metadata, because we need it to uninstall related ops */ metadata_bytes = load_deployed_metadata (self, op->ref, &checksum, NULL); if (metadata_bytes == NULL) { op->skip = TRUE; continue; } mark_op_resolved (op, checksum, NULL, metadata_bytes, NULL); continue; } if (op->kind == FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE) { g_assert (op->commit != NULL); mark_op_resolved (op, op->commit, NULL, op->external_metadata, NULL); continue; } /* op->kind is INSTALL or UPDATE */ if (flatpak_decomposed_is_app (op->ref)) { if (op->kind == FLATPAK_TRANSACTION_OPERATION_INSTALL) priv->max_op = APP_INSTALL; else priv->max_op = MAX (priv->max_op, APP_UPDATE); } else if (flatpak_decomposed_is_runtime (op->ref)) { if (op->kind == FLATPAK_TRANSACTION_OPERATION_INSTALL) priv->max_op = MAX (priv->max_op, RUNTIME_INSTALL); } state = flatpak_transaction_ensure_remote_state (self, op->kind, op->remote, NULL, error); if (state == NULL) return FALSE; /* Should we use local state */ if (transaction_is_local_only (self, op->kind)) { g_autoptr(GVariant) commit_data = flatpak_dir_read_latest_commit (priv->dir, op->remote, op->ref, &checksum, NULL, error); if (commit_data == NULL) return FALSE; resolve_op_from_commit (self, op, checksum, NULL, commit_data); } else { g_autoptr(GError) local_error = NULL; g_autoptr(GFile) sideload_path = NULL; if (op->commit != NULL) { checksum = g_strdup (op->commit); /* Check if this is available offline and if so, use that */ sideload_path = flatpak_remote_state_lookup_sideload_checksum (state, op->commit); } else { g_autofree char *latest_checksum = NULL; g_autoptr(GFile) latest_sideload_path = NULL; g_autofree char *local_checksum = NULL; guint64 latest_timestamp; g_autoptr(GVariant) local_commit_data = flatpak_dir_read_latest_commit (priv->dir, op->remote, op->ref, &local_checksum, NULL, NULL); if (flatpak_dir_find_latest_rev (priv->dir, state, flatpak_decomposed_get_ref (op->ref), op->commit, &latest_checksum, &latest_timestamp, &latest_sideload_path, cancellable, &local_error)) { /* If we found the latest in a sideload repo, it may be older that what is locally available, check timestamps. * Note: If the timestamps are equal (timestamp granularity issue), assume we want to update */ if (latest_sideload_path != NULL && local_commit_data && latest_timestamp != 0 && ostree_commit_get_timestamp (local_commit_data) > latest_timestamp) { g_debug ("Installed commit %s newer than sideloaded %s, ignoring", local_checksum, latest_checksum); checksum = g_steal_pointer (&local_checksum); } else { /* Otherwise, use whatever we found */ checksum = g_steal_pointer (&latest_checksum); sideload_path = g_steal_pointer (&latest_sideload_path); } } else { /* Ref not available in the remote (maybe offline), resolve to local version if installed */ if (local_commit_data == NULL) { g_propagate_error (error, g_steal_pointer (&local_error)); return FALSE; } g_message (_("Warning: Treating remote fetch error as non-fatal since %s is already installed: %s"), flatpak_decomposed_get_ref (op->ref), local_error->message); g_clear_error (&local_error); checksum = g_steal_pointer (&local_checksum); } } /* First try to resolve via metadata (if remote is available and its metadata matches the commit version) */ if (!try_resolve_op_from_metadata (self, op, checksum, sideload_path, state)) { /* Else try to load the commit object. * Note, we don't have a token here, so this will not work for authenticated apps. * We handle this by catching the 401 http status and retrying. */ g_autoptr(GVariant) commit_data = NULL; VarRefInfoRef ref_info; /* OCI needs this to get the oci repository for the ref to request the token, so lets always set it here */ if (op->summary_metadata == NULL && flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (op->ref), NULL, NULL, &ref_info, NULL, NULL)) op->summary_metadata = var_metadata_dup_to_gvariant (var_ref_info_get_metadata (ref_info)); commit_data = flatpak_remote_state_load_ref_commit (state, priv->dir, flatpak_decomposed_get_ref (op->ref), checksum, /* initially NULL */ op->resolved_token, NULL, NULL, &local_error); if (commit_data == NULL) { if (g_error_matches (local_error, FLATPAK_HTTP_ERROR, FLATPAK_HTTP_ERROR_UNAUTHORIZED) && !op->requested_token) { g_debug ("Unauthorized access during resolve by commit of %s, retrying with token", flatpak_decomposed_get_ref (op->ref)); priv->needs_resolve = TRUE; priv->needs_tokens = TRUE; /* Token type maxint32 means we don't know the type */ op->token_type = G_MAXINT32; op->resolved_commit = g_strdup (checksum); g_clear_error (&local_error); continue; } g_propagate_error (error, g_steal_pointer (&local_error)); return FALSE; } resolve_op_from_commit (self, op, checksum, sideload_path, commit_data); } } } return TRUE; }
844
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-10 16:43:08+01:00
Transaction: Fail the resolve if xa.metadata invalid or missing If we fail to parse xa.metadata from the summary cache or the commit xa.metadata we fail the resolve. If xa.metadata is missing in the commit we fail the resolve (it is always set in the summary cache, because summary update converts missing xa.metadata to "", so we either get that, or cache miss which leads to resolving from the commit. This means that op->resolved_metadata is always set during install and updates, which means we will show the app permissions. The transaction will also always make sure that this data actually matches what gets deployed. Before this change an invalid metadata in the summary cache could lead to a NULL resolved_metadata, which means we wouldn't print the app permissions, yet we would still deploy some metadata file that could have permissions. (NOTE: It would fail to deploy unless the xa.metadata in the commit matched the metadata file, but in this corner case we would't compare the summary and commit metadata, so they may differ.)
d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
try_resolve_op_from_metadata
try_resolve_op_from_metadata( FlatpakTransaction * self , FlatpakTransactionOperation * op , const char * checksum , GFile * sideload_path , FlatpakRemoteState * state)
['self', 'op', 'checksum', 'sideload_path', 'state']
try_resolve_op_from_metadata (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, FlatpakRemoteState *state) { g_autoptr(GBytes) metadata_bytes = NULL; guint64 download_size = 0; guint64 installed_size = 0; const char *metadata = NULL; VarMetadataRef sparse_cache; VarRefInfoRef info; g_autofree char *summary_checksum = NULL; /* Ref has to match the actual commit in the summary */ if ((state->summary == NULL && state->index == NULL) || !flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (op->ref), &summary_checksum, NULL, NULL, NULL, NULL) || strcmp (summary_checksum, checksum) != 0) return FALSE; /* And, we must have the actual cached data in the summary */ if (!flatpak_remote_state_lookup_cache (state, flatpak_decomposed_get_ref (op->ref), &download_size, &installed_size, &metadata, NULL)) return FALSE; metadata_bytes = g_bytes_new (metadata, strlen (metadata)); if (flatpak_remote_state_lookup_ref (state, flatpak_decomposed_get_ref (op->ref), NULL, NULL, &info, NULL, NULL)) op->summary_metadata = var_metadata_dup_to_gvariant (var_ref_info_get_metadata (info)); op->installed_size = installed_size; op->download_size = download_size; op->token_type = state->default_token_type; if (flatpak_remote_state_lookup_sparse_cache (state, flatpak_decomposed_get_ref (op->ref), &sparse_cache, NULL)) { op->eol = g_strdup (var_metadata_lookup_string (sparse_cache, FLATPAK_SPARSE_CACHE_KEY_ENDOFLINE, NULL)); op->eol_rebase = g_strdup (var_metadata_lookup_string (sparse_cache, FLATPAK_SPARSE_CACHE_KEY_ENDOFLINE_REBASE, NULL)); op->token_type = GINT32_FROM_LE (var_metadata_lookup_int32 (sparse_cache, FLATPAK_SPARSE_CACHE_KEY_TOKEN_TYPE, op->token_type)); } resolve_op_end (self, op, checksum, sideload_path, metadata_bytes); return TRUE; }
300
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-11 10:27:46+01:00
Require metadata in commit also for OCI remotes This was disables a long time ago because the fedora remotes didn't contain metadata, but that has been added since then. Requiring fixes a security concern where an app claims to require no permissions (by having no metadata in commit) but then actually requires permissions in the installed app.
93357d357119093804df05acc32ff335839c6451
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_dir_deploy
flatpak_dir_deploy( FlatpakDir * self , const char * origin , FlatpakDecomposed * ref , const char * checksum_or_latest , const char * const * subpaths , const char * const * previous_ids , GCancellable * cancellable , GError ** error)
['self', 'origin', 'ref', 'checksum_or_latest', 'subpaths', 'previous_ids', 'cancellable', 'error']
flatpak_dir_deploy (FlatpakDir *self, const char *origin, FlatpakDecomposed *ref, const char *checksum_or_latest, const char * const * subpaths, const char * const * previous_ids, GCancellable *cancellable, GError **error) { g_autofree char *resolved_ref = NULL; g_autofree char *ref_id = NULL; g_autoptr(GFile) root = NULL; g_autoptr(GFile) deploy_base = NULL; g_autoptr(GFile) checkoutdir = NULL; g_autoptr(GFile) bindir = NULL; g_autofree char *checkoutdirpath = NULL; g_autoptr(GFile) real_checkoutdir = NULL; g_autoptr(GFile) dotref = NULL; g_autoptr(GFile) files_etc = NULL; g_autoptr(GFile) deploy_data_file = NULL; g_autoptr(GVariant) commit_data = NULL; g_autoptr(GBytes) deploy_data = NULL; g_autoptr(GFile) export = NULL; g_autoptr(GFile) extradir = NULL; g_autoptr(GKeyFile) keyfile = NULL; guint64 installed_size = 0; OstreeRepoCheckoutAtOptions options = { 0, }; const char *checksum; glnx_autofd int checkoutdir_dfd = -1; g_autoptr(GFile) tmp_dir_template = NULL; g_autofree char *tmp_dir_path = NULL; const char *xa_ref = NULL; g_autofree char *checkout_basename = NULL; gboolean created_extra_data = FALSE; g_autoptr(GVariant) commit_metadata = NULL; g_auto(GLnxLockFile) lock = { 0, }; g_autoptr(GFile) metadata_file = NULL; g_autofree char *metadata_contents = NULL; gsize metadata_size = 0; gboolean is_oci; const char *flatpak; if (!flatpak_dir_ensure_repo (self, cancellable, error)) return FALSE; ref_id = flatpak_decomposed_dup_id (ref); /* Keep a shared repo lock to avoid prunes removing objects we're relying on * while we do the checkout. This could happen if the ref changes after we * read its current value for the checkout. */ if (!flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error)) return FALSE; deploy_base = flatpak_dir_get_deploy_dir (self, ref); if (checksum_or_latest == NULL) { g_debug ("No checksum specified, getting tip of %s from origin %s", flatpak_decomposed_get_ref (ref), origin); resolved_ref = flatpak_dir_read_latest (self, origin, flatpak_decomposed_get_ref (ref), NULL, cancellable, error); if (resolved_ref == NULL) { g_prefix_error (error, _("While trying to resolve ref %s: "), flatpak_decomposed_get_ref (ref)); return FALSE; } checksum = resolved_ref; g_debug ("tip resolved to: %s", checksum); } else { checksum = checksum_or_latest; g_debug ("Looking for checksum %s in local repo", checksum); if (!ostree_repo_read_commit (self->repo, checksum, NULL, NULL, cancellable, NULL)) return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("%s is not available"), flatpak_decomposed_get_ref (ref)); } if (!ostree_repo_load_commit (self->repo, checksum, &commit_data, NULL, error)) return FALSE; commit_metadata = g_variant_get_child_value (commit_data, 0); checkout_basename = flatpak_dir_get_deploy_subdir (self, checksum, subpaths); real_checkoutdir = g_file_get_child (deploy_base, checkout_basename); if (g_file_query_exists (real_checkoutdir, cancellable)) return flatpak_fail_error (error, FLATPAK_ERROR_ALREADY_INSTALLED, _("%s commit %s already installed"), flatpak_decomposed_get_ref (ref), checksum); g_autofree char *template = g_strdup_printf (".%s-XXXXXX", checkout_basename); tmp_dir_template = g_file_get_child (deploy_base, template); tmp_dir_path = g_file_get_path (tmp_dir_template); if (g_mkdtemp_full (tmp_dir_path, 0755) == NULL) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Can't create deploy directory")); return FALSE; } checkoutdir = g_file_new_for_path (tmp_dir_path); if (!ostree_repo_read_commit (self->repo, checksum, &root, NULL, cancellable, error)) { g_prefix_error (error, _("Failed to read commit %s: "), checksum); return FALSE; } if (!flatpak_repo_collect_sizes (self->repo, root, &installed_size, NULL, cancellable, error)) return FALSE; options.mode = OSTREE_REPO_CHECKOUT_MODE_USER; options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES; options.enable_fsync = FALSE; /* We checkout to a temp dir and sync before moving it in place */ options.bareuseronly_dirs = TRUE; /* https://github.com/ostreedev/ostree/pull/927 */ checkoutdirpath = g_file_get_path (checkoutdir); if (subpaths == NULL || *subpaths == NULL) { if (!ostree_repo_checkout_at (self->repo, &options, AT_FDCWD, checkoutdirpath, checksum, cancellable, error)) { g_prefix_error (error, _("While trying to checkout %s into %s: "), checksum, checkoutdirpath); return FALSE; } } else { g_autoptr(GFile) files = g_file_get_child (checkoutdir, "files"); int i; if (!g_file_make_directory_with_parents (files, cancellable, error)) return FALSE; options.subpath = "/metadata"; if (!ostree_repo_checkout_at (self->repo, &options, AT_FDCWD, checkoutdirpath, checksum, cancellable, error)) { g_prefix_error (error, _("While trying to checkout metadata subpath: ")); return FALSE; } for (i = 0; subpaths[i] != NULL; i++) { g_autofree char *subpath = g_build_filename ("/files", subpaths[i], NULL); g_autofree char *dstpath = g_build_filename (checkoutdirpath, "/files", subpaths[i], NULL); g_autofree char *dstpath_parent = g_path_get_dirname (dstpath); g_autoptr(GFile) child = NULL; child = g_file_resolve_relative_path (root, subpath); if (!g_file_query_exists (child, cancellable)) { g_debug ("subpath %s not in tree", subpaths[i]); continue; } if (g_mkdir_with_parents (dstpath_parent, 0755)) { glnx_set_error_from_errno (error); return FALSE; } options.subpath = subpath; if (!ostree_repo_checkout_at (self->repo, &options, AT_FDCWD, dstpath, checksum, cancellable, error)) { g_prefix_error (error, _("While trying to checkout subpath ‘%s’: "), subpath); return FALSE; } } } /* Extract any extra data */ extradir = g_file_resolve_relative_path (checkoutdir, "files/extra"); if (!flatpak_rm_rf (extradir, cancellable, error)) { g_prefix_error (error, _("While trying to remove existing extra dir: ")); return FALSE; } if (!extract_extra_data (self, checksum, extradir, &created_extra_data, cancellable, error)) return FALSE; if (created_extra_data) { if (!apply_extra_data (self, checkoutdir, cancellable, error)) { g_prefix_error (error, _("While trying to apply extra data: ")); return FALSE; } } g_variant_lookup (commit_metadata, "xa.ref", "&s", &xa_ref); if (xa_ref != NULL) { gboolean gpg_verify_summary; if (!ostree_repo_remote_get_gpg_verify_summary (self->repo, origin, &gpg_verify_summary, error)) return FALSE; if (gpg_verify_summary) { /* If we're using signed summaries, then the security is really due to the signatures on * the summary, and the xa.ref is not needed for security. In particular, endless are * currently using one single commit on multiple branches to handle devel/stable promotion. * So, to support this we report branch discrepancies as a warning, rather than as an error. * See https://github.com/flatpak/flatpak/pull/1013 for more discussion. */ FlatpakDecomposed *checkout_ref = ref; g_autoptr(FlatpakDecomposed) commit_ref = NULL; commit_ref = flatpak_decomposed_new_from_ref (xa_ref, error); if (commit_ref == NULL) { g_prefix_error (error, _("Invalid commit ref %s: "), xa_ref); return FALSE; } /* Fatal if kind/name/arch don't match. Warn for branch mismatch. */ if (!flatpak_decomposed_equal_except_branch (checkout_ref, commit_ref)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, _("Deployed ref %s does not match commit (%s)"), flatpak_decomposed_get_ref (ref), xa_ref); return FALSE; } if (strcmp (flatpak_decomposed_get_branch (checkout_ref), flatpak_decomposed_get_branch (commit_ref)) != 0) g_warning (_("Deployed ref %s branch does not match commit (%s)"), flatpak_decomposed_get_ref (ref), xa_ref); } else if (strcmp (flatpak_decomposed_get_ref (ref), xa_ref) != 0) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, _("Deployed ref %s does not match commit (%s)"), flatpak_decomposed_get_ref (ref), xa_ref); return FALSE; } } keyfile = g_key_file_new (); metadata_file = g_file_resolve_relative_path (checkoutdir, "metadata"); if (g_file_load_contents (metadata_file, NULL, &metadata_contents, &metadata_size, NULL, NULL)) { if (!g_key_file_load_from_data (keyfile, metadata_contents, metadata_size, 0, error)) return FALSE; if (!flatpak_check_required_version (flatpak_decomposed_get_ref (ref), keyfile, error)) return FALSE; } /* Check the metadata in the commit to make sure it matches the actual * deployed metadata, in case we relied on the one in the commit for * a decision * Note: For historical reason we don't enforce commits to contain xa.metadata * since this was lacking in fedora builds. */ is_oci = flatpak_dir_get_remote_oci (self, origin); if (!validate_commit_metadata (commit_data, flatpak_decomposed_get_ref (ref), metadata_contents, metadata_size, !is_oci, error)) return FALSE; dotref = g_file_resolve_relative_path (checkoutdir, "files/.ref"); if (!g_file_replace_contents (dotref, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; export = g_file_get_child (checkoutdir, "export"); /* Never export any binaries bundled with the app */ bindir = g_file_get_child (export, "bin"); if (!flatpak_rm_rf (bindir, cancellable, error)) return FALSE; if (flatpak_decomposed_is_runtime (ref)) { /* Ensure that various files exist as regular files in /usr/etc, as we want to bind-mount over them */ files_etc = g_file_resolve_relative_path (checkoutdir, "files/etc"); if (g_file_query_exists (files_etc, cancellable)) { char *etcfiles[] = {"passwd", "group", "machine-id" }; g_autoptr(GFile) etc_resolve_conf = g_file_get_child (files_etc, "resolv.conf"); int i; for (i = 0; i < G_N_ELEMENTS (etcfiles); i++) { g_autoptr(GFile) etc_file = g_file_get_child (files_etc, etcfiles[i]); GFileType type; type = g_file_query_file_type (etc_file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, cancellable); if (type == G_FILE_TYPE_REGULAR) continue; if (type != G_FILE_TYPE_UNKNOWN) { /* Already exists, but not regular, probably symlink. Remove it */ if (!g_file_delete (etc_file, cancellable, error)) return FALSE; } if (!g_file_replace_contents (etc_file, "", 0, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; } if (g_file_query_exists (etc_resolve_conf, cancellable) && !g_file_delete (etc_resolve_conf, cancellable, error)) return FALSE; if (!g_file_make_symbolic_link (etc_resolve_conf, "/run/host/monitor/resolv.conf", cancellable, error)) return FALSE; } /* Runtime should never export anything */ if (!flatpak_rm_rf (export, cancellable, error)) return FALSE; } else /* is app */ { g_autofree char *ref_arch = flatpak_decomposed_dup_arch (ref); g_autofree char *ref_branch = flatpak_decomposed_dup_branch (ref); g_autoptr(GFile) wrapper = g_file_get_child (bindir, ref_id); g_autofree char *escaped_app = maybe_quote (ref_id); g_autofree char *escaped_branch = maybe_quote (ref_branch); g_autofree char *escaped_arch = maybe_quote (ref_arch); g_autofree char *bin_data = NULL; int r; if (!flatpak_mkdir_p (bindir, cancellable, error)) return FALSE; if (!flatpak_rewrite_export_dir (ref_id, ref_branch, ref_arch, keyfile, previous_ids, export, cancellable, error)) return FALSE; if ((flatpak = g_getenv ("FLATPAK_BINARY")) == NULL) flatpak = FLATPAK_BINDIR "/flatpak"; bin_data = g_strdup_printf ("#!/bin/sh\nexec %s run --branch=%s --arch=%s %s \"$@\"\n", flatpak, escaped_branch, escaped_arch, escaped_app); if (!g_file_replace_contents (wrapper, bin_data, strlen (bin_data), NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; do r = fchmodat (AT_FDCWD, flatpak_file_get_path_cached (wrapper), 0755, 0); while (G_UNLIKELY (r == -1 && errno == EINTR)); if (r == -1) return glnx_throw_errno_prefix (error, "fchmodat"); } deploy_data = flatpak_dir_new_deploy_data (self, checkoutdir, commit_data, commit_metadata, keyfile, ref_id, origin, checksum, (char **) subpaths, installed_size, previous_ids); /* Check the app is actually allowed to be used by this user. This can block * on getting authorisation. */ if (!flatpak_dir_check_parental_controls (self, flatpak_decomposed_get_ref (ref), deploy_data, cancellable, error)) return FALSE; deploy_data_file = g_file_get_child (checkoutdir, "deploy"); if (!flatpak_bytes_save (deploy_data_file, deploy_data, cancellable, error)) return FALSE; if (!glnx_opendirat (AT_FDCWD, checkoutdirpath, TRUE, &checkoutdir_dfd, error)) return FALSE; if (syncfs (checkoutdir_dfd) != 0) { glnx_set_error_from_errno (error); return FALSE; } if (!g_file_move (checkoutdir, real_checkoutdir, G_FILE_COPY_NO_FALLBACK_FOR_MOVE, cancellable, NULL, NULL, error)) return FALSE; if (!flatpak_dir_set_active (self, ref, checkout_basename, cancellable, error)) return FALSE; if (!flatpak_dir_update_deploy_ref (self, flatpak_decomposed_get_ref (ref), checksum, error)) return FALSE; return TRUE; }
2097
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-11 10:27:46+01:00
Require metadata in commit also for OCI remotes This was disables a long time ago because the fedora remotes didn't contain metadata, but that has been added since then. Requiring fixes a security concern where an app claims to require no permissions (by having no metadata in commit) but then actually requires permissions in the installed app.
93357d357119093804df05acc32ff335839c6451
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_dir_pull
flatpak_dir_pull( FlatpakDir * self , FlatpakRemoteState * state , const char * ref , const char * opt_rev , const char ** subpaths , GFile * sideload_repo , GBytes * require_metadata , const char * token , OstreeRepo * repo , FlatpakPullFlags flatpak_flags , OstreeRepoPullFlags flags , FlatpakProgress * progress , GCancellable * cancellable , GError ** error)
['self', 'state', 'ref', 'opt_rev', 'subpaths', 'sideload_repo', 'require_metadata', 'token', 'repo', 'flatpak_flags', 'flags', 'progress', 'cancellable', 'error']
flatpak_dir_pull (FlatpakDir *self, FlatpakRemoteState *state, const char *ref, const char *opt_rev, const char **subpaths, GFile *sideload_repo, GBytes *require_metadata, const char *token, OstreeRepo *repo, FlatpakPullFlags flatpak_flags, OstreeRepoPullFlags flags, FlatpakProgress *progress, GCancellable *cancellable, GError **error) { gboolean ret = FALSE; g_autofree char *rev = NULL; g_autofree char *url = NULL; g_autoptr(GPtrArray) subdirs_arg = NULL; g_auto(GLnxLockFile) lock = { 0, }; g_autofree char *name = NULL; g_autofree char *current_checksum = NULL; if (!flatpak_dir_ensure_repo (self, cancellable, error)) return FALSE; /* Keep a shared repo lock to avoid prunes removing objects we're relying on * while we do the pull. There are two cases we protect against. 1) objects we * need but that we already decided are locally available could be removed, * and 2) during the transaction commit objects that don't yet have a ref to * them could be considered unreachable. */ if (repo == NULL && !flatpak_dir_repo_lock (self, &lock, LOCK_SH, cancellable, error)) return FALSE; if (flatpak_dir_get_remote_oci (self, state->remote_name)) return flatpak_dir_pull_oci (self, state, ref, opt_rev, repo, flatpak_flags, flags, token, progress, cancellable, error); if (!ostree_repo_remote_get_url (self->repo, state->remote_name, &url, error)) return FALSE; if (*url == 0) return TRUE; /* Empty url, silently disables updates */ /* We get the rev ahead of time so that we know it for looking up e.g. extra-data and to make sure we're atomically using a single rev if we happen to do multiple pulls (e.g. with subpaths) */ if (opt_rev != NULL) { rev = g_strdup (opt_rev); } else { flatpak_remote_state_lookup_ref (state, ref, &rev, NULL, NULL, NULL, error); if (rev == NULL && error != NULL && *error == NULL) flatpak_fail_error (error, FLATPAK_ERROR_REF_NOT_FOUND, _("Couldn't find latest checksum for ref %s in remote %s"), ref, state->remote_name); if (rev == NULL) { g_assert (error == NULL || *error != NULL); return FALSE; } } g_debug ("%s: Using commit %s for pull of ref %s from remote %s%s%s", G_STRFUNC, rev, ref, state->remote_name, sideload_repo ? "sideloaded from " : "", sideload_repo ? flatpak_file_get_path_cached (sideload_repo) : "" ); if (repo == NULL) repo = self->repo; /* Past this we must use goto out, so we clean up console and abort the transaction on error */ if (subpaths != NULL && subpaths[0] != NULL) { subdirs_arg = g_ptr_array_new_with_free_func (g_free); int i; g_ptr_array_add (subdirs_arg, g_strdup ("/metadata")); for (i = 0; subpaths[i] != NULL; i++) g_ptr_array_add (subdirs_arg, g_build_filename ("/files", subpaths[i], NULL)); g_ptr_array_add (subdirs_arg, NULL); } /* Setup extra data information before starting to pull, so we can have precise * progress reports */ if (!flatpak_dir_setup_extra_data (self, state, repo, ref, rev, sideload_repo, token, flatpak_flags, progress, cancellable, error)) goto out; if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error)) goto out; flatpak_repo_resolve_rev (repo, NULL, state->remote_name, ref, TRUE, &current_checksum, NULL, NULL); if (!repo_pull (repo, state, subdirs_arg ? (const char **) subdirs_arg->pdata : NULL, ref, rev, sideload_repo, token, flatpak_flags, flags, progress, cancellable, error)) { g_prefix_error (error, _("While pulling %s from remote %s: "), ref, state->remote_name); goto out; } if (require_metadata) { g_autoptr(GVariant) commit_data = NULL; if (!ostree_repo_load_commit (repo, rev, &commit_data, NULL, error) || !validate_commit_metadata (commit_data, ref, (const char *)g_bytes_get_data (require_metadata, NULL), g_bytes_get_size (require_metadata), TRUE, error)) goto out; } if (!flatpak_dir_pull_extra_data (self, repo, state->remote_name, ref, rev, flatpak_flags, progress, cancellable, error)) goto out; if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error)) goto out; ret = TRUE; if (repo == self->repo) name = flatpak_dir_get_name (self); else { GFile *file = ostree_repo_get_path (repo); name = g_file_get_path (file); } (flatpak_dir_log) (self, __FILE__, __LINE__, __FUNCTION__, name, "pull", state->remote_name, ref, rev, current_checksum, NULL, "Pulled %s from %s", ref, state->remote_name); out: if (!ret) { ostree_repo_abort_transaction (repo, cancellable, NULL); g_assert (error == NULL || *error != NULL); } return ret; }
780
True
1
CVE-2021-43860
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
LOCAL
LOW
NONE
REQUIRED
CHANGED
HIGH
HIGH
HIGH
8.6
HIGH
1.8
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'name': 'https://github.com/flatpak/flatpak/commit/d9a8f9d8ccc0b7c1135d0ecde006a75d25f66aee', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'name': 'https://github.com/flatpak/flatpak/commit/65cbfac982cb1c83993a9e19aa424daee8e9f042', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'name': 'https://github.com/flatpak/flatpak/commit/93357d357119093804df05acc32ff335839c6451', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'name': 'https://github.com/flatpak/flatpak/commit/ba818f504c926baaf6e362be8159cfacf994310e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'name': 'https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'name': 'https://github.com/flatpak/flatpak/commit/54ec1a482dfc668127eaae57f135e6a8e0bc52da', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.12.3', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'name': 'https://github.com/flatpak/flatpak/releases/tag/1.10.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/APFTBYGJJVJPFVHRXUW5PII5XOAFI4KH/', 'name': 'FEDORA-2022-825ca6bf2b', 'refsource': 'FEDORA', 'tags': ['Third Party Advisory']}, {'url': 'https://www.debian.org/security/2022/dsa-5049', 'name': 'DSA-5049', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-276'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.10.6', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '1.11.1', 'versionEndIncluding': '1.12.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn\'t properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there\'s a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn\'t lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.'}]
2022-02-10T15:03Z
2022-01-12T22:15Z
Incorrect Default Permissions
During installation, installed file permissions are set to allow anyone to modify those files.
https://cwe.mitre.org/data/definitions/276.html
0
Alexander Larsson
2022-01-11 10:27:46+01:00
Require metadata in commit also for OCI remotes This was disables a long time ago because the fedora remotes didn't contain metadata, but that has been added since then. Requiring fixes a security concern where an app claims to require no permissions (by having no metadata in commit) but then actually requires permissions in the installed app.
93357d357119093804df05acc32ff335839c6451
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
validate_commit_metadata
validate_commit_metadata( GVariant * commit_data , const char * ref , const char * required_metadata , gsize required_metadata_size , gboolean require_xa_metadata , GError ** error)
['commit_data', 'ref', 'required_metadata', 'required_metadata_size', 'require_xa_metadata', 'error']
validate_commit_metadata (GVariant *commit_data, const char *ref, const char *required_metadata, gsize required_metadata_size, gboolean require_xa_metadata, GError **error) { g_autoptr(GVariant) commit_metadata = NULL; g_autoptr(GVariant) xa_metadata_v = NULL; const char *xa_metadata = NULL; gsize xa_metadata_size = 0; commit_metadata = g_variant_get_child_value (commit_data, 0); if (commit_metadata != NULL) { xa_metadata_v = g_variant_lookup_value (commit_metadata, "xa.metadata", G_VARIANT_TYPE_STRING); if (xa_metadata_v) xa_metadata = g_variant_get_string (xa_metadata_v, &xa_metadata_size); } if ((xa_metadata == NULL && require_xa_metadata) || (xa_metadata != NULL && (xa_metadata_size != required_metadata_size || memcmp (xa_metadata, required_metadata, xa_metadata_size) != 0))) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, _("Commit metadata for %s not matching expected metadata"), ref); return FALSE; } return TRUE; }
155
True
1
CVE-2018-6560
False
False
False
False
AV:L/AC:L/Au:N/C:P/I:P/A:P
LOCAL
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
4.6
CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
LOCAL
LOW
LOW
NONE
CHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.0
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/releases/tag/0.8.9', 'name': 'https://github.com/flatpak/flatpak/releases/tag/0.8.9', 'refsource': 'CONFIRM', 'tags': ['Release Notes']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/0.10.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/0.10.3', 'refsource': 'CONFIRM', 'tags': ['Release Notes']}, {'url': 'https://github.com/flatpak/flatpak/commit/52346bf187b5a7f1c0fe9075b328b7ad6abe78f6', 'name': 'https://github.com/flatpak/flatpak/commit/52346bf187b5a7f1c0fe9075b328b7ad6abe78f6', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Vendor Advisory']}, {'url': 'https://access.redhat.com/errata/RHSA-2018:2766', 'name': 'RHSA-2018:2766', 'refsource': 'REDHAT', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-436'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '0.8.9', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.9.1', 'versionEndIncluding': '0.9.99', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.10.0', 'versionEndExcluding': '0.10.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_desktop:7.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_workstation:7.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server:7.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_eus:7.5:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_tus:7.6:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_eus:7.6:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_aus:7.6:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In dbus-proxy/flatpak-proxy.c in Flatpak before 0.8.9, and 0.9.x and 0.10.x before 0.10.3, crafted D-Bus messages to the host can be used to break out of the sandbox, because whitespace handling in the proxy is not identical to whitespace handling in the daemon.'}]
2019-10-03T00:03Z
2018-02-02T14:29Z
Interpretation Conflict
Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.
This is generally found in proxies, firewalls, anti-virus software, and other intermediary devices that monitor, allow, deny, or modify traffic based on how the client or server is expected to behave.
https://cwe.mitre.org/data/definitions/436.html
0
Alexander Larsson
2018-01-28 20:51:54+01:00
Fix vulnerability in dbus proxy During the authentication all client data is directly forwarded to the dbus daemon as is, until we detect the BEGIN command after which we start filtering the binary dbus protocol. Unfortunately the detection of the BEGIN command in the proxy did not exactly match the detection in the dbus daemon. A BEGIN followed by a space or tab was considered ok in the daemon but not by the proxy. This could be exploited to send arbitrary dbus messages to the host, which can be used to break out of the sandbox. This was noticed by Gabriel Campana of The Google Security Team. This fix makes the detection of the authentication phase end match the dbus code. In addition we duplicate the authentication line validation from dbus, which includes ensuring all data is ASCII, and limiting the size of a line to 16k. In fact, we add some extra stringent checks, disallowing ASCII control chars and requiring that auth lines start with a capital letter.
52346bf187b5a7f1c0fe9075b328b7ad6abe78f6
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
find_auth_end
find_auth_end( FlatpakProxyClient * client , Buffer * buffer)
['client', 'buffer']
find_auth_end (FlatpakProxyClient *client, Buffer *buffer) { guchar *match; int i; /* First try to match any leftover at the start */ if (client->auth_end_offset > 0) { gsize left = strlen (AUTH_END_STRING) - client->auth_end_offset; gsize to_match = MIN (left, buffer->pos); /* Matched at least up to to_match */ if (memcmp (buffer->data, &AUTH_END_STRING[client->auth_end_offset], to_match) == 0) { client->auth_end_offset += to_match; /* Matched all */ if (client->auth_end_offset == strlen (AUTH_END_STRING)) return to_match; /* Matched to end of buffer */ return -1; } /* Did not actually match at start */ client->auth_end_offset = -1; } /* Look for whole match inside buffer */ match = memmem (buffer, buffer->pos, AUTH_END_STRING, strlen (AUTH_END_STRING)); if (match != NULL) return match - buffer->data + strlen (AUTH_END_STRING); /* Record longest prefix match at the end */ for (i = MIN (strlen (AUTH_END_STRING) - 1, buffer->pos); i > 0; i--) { if (memcmp (buffer->data + buffer->pos - i, AUTH_END_STRING, i) == 0) { client->auth_end_offset = i; break; } } return -1; }
205
True
1
CVE-2018-6560
False
False
False
False
AV:L/AC:L/Au:N/C:P/I:P/A:P
LOCAL
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
4.6
CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
LOCAL
LOW
LOW
NONE
CHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.0
6.0
False
[{'url': 'https://github.com/flatpak/flatpak/releases/tag/0.8.9', 'name': 'https://github.com/flatpak/flatpak/releases/tag/0.8.9', 'refsource': 'CONFIRM', 'tags': ['Release Notes']}, {'url': 'https://github.com/flatpak/flatpak/releases/tag/0.10.3', 'name': 'https://github.com/flatpak/flatpak/releases/tag/0.10.3', 'refsource': 'CONFIRM', 'tags': ['Release Notes']}, {'url': 'https://github.com/flatpak/flatpak/commit/52346bf187b5a7f1c0fe9075b328b7ad6abe78f6', 'name': 'https://github.com/flatpak/flatpak/commit/52346bf187b5a7f1c0fe9075b328b7ad6abe78f6', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Vendor Advisory']}, {'url': 'https://access.redhat.com/errata/RHSA-2018:2766', 'name': 'RHSA-2018:2766', 'refsource': 'REDHAT', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-436'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionEndExcluding': '0.8.9', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.9.1', 'versionEndIncluding': '0.9.99', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:flatpak:flatpak:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.10.0', 'versionEndExcluding': '0.10.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_desktop:7.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_workstation:7.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server:7.0:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_eus:7.5:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_tus:7.6:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_eus:7.6:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:redhat:enterprise_linux_server_aus:7.6:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In dbus-proxy/flatpak-proxy.c in Flatpak before 0.8.9, and 0.9.x and 0.10.x before 0.10.3, crafted D-Bus messages to the host can be used to break out of the sandbox, because whitespace handling in the proxy is not identical to whitespace handling in the daemon.'}]
2019-10-03T00:03Z
2018-02-02T14:29Z
Interpretation Conflict
Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.
This is generally found in proxies, firewalls, anti-virus software, and other intermediary devices that monitor, allow, deny, or modify traffic based on how the client or server is expected to behave.
https://cwe.mitre.org/data/definitions/436.html
0
Alexander Larsson
2018-01-28 20:51:54+01:00
Fix vulnerability in dbus proxy During the authentication all client data is directly forwarded to the dbus daemon as is, until we detect the BEGIN command after which we start filtering the binary dbus protocol. Unfortunately the detection of the BEGIN command in the proxy did not exactly match the detection in the dbus daemon. A BEGIN followed by a space or tab was considered ok in the daemon but not by the proxy. This could be exploited to send arbitrary dbus messages to the host, which can be used to break out of the sandbox. This was noticed by Gabriel Campana of The Google Security Team. This fix makes the detection of the authentication phase end match the dbus code. In addition we duplicate the authentication line validation from dbus, which includes ensuring all data is ASCII, and limiting the size of a line to 16k. In fact, we add some extra stringent checks, disallowing ASCII control chars and requiring that auth lines start with a capital letter.
52346bf187b5a7f1c0fe9075b328b7ad6abe78f6
False
flatpak/flatpak
Linux application sandboxing and distribution framework
2016-05-19 14:19:21
2022-08-27 11:46:29
https://flatpak.org
flatpak
3293.0
337.0
flatpak_proxy_client_init
flatpak_proxy_client_init( FlatpakProxyClient * client)
['client']
flatpak_proxy_client_init (FlatpakProxyClient *client) { init_side (client, &client->client_side); init_side (client, &client->bus_side); client->auth_end_offset = AUTH_END_INIT_OFFSET; client->rewrite_reply = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); client->get_owner_reply = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); client->unique_id_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); }
79
True
1
CVE-2018-6758
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/unbit/uwsgi/commit/cb4636f7c0af2e97a4eef7a3cdcbd85a71247bfe', 'name': 'https://github.com/unbit/uwsgi/commit/cb4636f7c0af2e97a4eef7a3cdcbd85a71247bfe', 'refsource': 'MISC', 'tags': ['Patch', 'Vendor Advisory']}, {'url': 'http://lists.unbit.it/pipermail/uwsgi/2018-February/008835.html', 'name': 'http://lists.unbit.it/pipermail/uwsgi/2018-February/008835.html', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/02/msg00010.html', 'name': '[debian-lts-announce] 20180210 [SECURITY] [DLA 1275-1] uwsgi security update', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unbit:uwsgi:*:*:*:*:*:*:*:*', 'versionEndIncluding': '2.0.15', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The uwsgi_expand_path function in core/utils.c in Unbit uWSGI through 2.0.15 has a stack-based buffer overflow via a large directory length.'}]
2020-08-24T17:37Z
2018-02-06T18:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Unbit
2018-02-06 16:01:47+01:00
improve uwsgi_expand_path() to sanitize input, avoiding stack corruption and potential security issue
cb4636f7c0af2e97a4eef7a3cdcbd85a71247bfe
False
unbit/uwsgi
uWSGI application server container
2011-10-09 07:25:31
2022-08-01 14:31:37
http://projects.unbit.it/uwsgi
unbit
3177.0
657.0
uwsgi_expand_path
uwsgi_expand_path( char * dir , int dir_len , char * ptr)
['dir', 'dir_len', 'ptr']
char *uwsgi_expand_path(char *dir, int dir_len, char *ptr) { char src[PATH_MAX + 1]; memcpy(src, dir, dir_len); src[dir_len] = 0; char *dst = ptr; if (!dst) dst = uwsgi_malloc(PATH_MAX + 1); if (!realpath(src, dst)) { uwsgi_error_realpath(src); if (!ptr) free(dst); return NULL; } return dst; }
92
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
main
main( int argc , char ** argv)
['argc', 'argv']
int main(int argc, char **argv) { char *filein, *str, *tempfile, *prestring, *outprotos, *protostr; const char *spacestr = " "; char buf[L_BUF_SIZE]; l_uint8 *allheaders; l_int32 i, maxindex, in_line, nflags, protos_added, firstfile, len, ret; size_t nbytes; L_BYTEA *ba, *ba2; SARRAY *sa, *safirst; static char mainName[] = "xtractprotos"; if (argc == 1) { fprintf(stderr, "xtractprotos [-prestring=<string>] [-protos=<where>] " "[list of C files]\n" "where the prestring is prepended to each prototype, and \n" "protos can be either 'inline' or the name of an output " "prototype file\n"); return 1; } /* ---------------------------------------------------------------- */ /* Parse input flags and find prestring and outprotos, if requested */ /* ---------------------------------------------------------------- */ prestring = outprotos = NULL; in_line = FALSE; nflags = 0; maxindex = L_MIN(3, argc); for (i = 1; i < maxindex; i++) { if (argv[i][0] == '-') { if (!strncmp(argv[i], "-prestring", 10)) { nflags++; ret = sscanf(argv[i] + 1, "prestring=%s", buf); if (ret != 1) { fprintf(stderr, "parse failure for prestring\n"); return 1; } if ((len = strlen(buf)) > L_BUF_SIZE - 3) { L_WARNING("prestring too large; omitting!\n", mainName); } else { buf[len] = ' '; buf[len + 1] = '\0'; prestring = stringNew(buf); } } else if (!strncmp(argv[i], "-protos", 7)) { nflags++; ret = sscanf(argv[i] + 1, "protos=%s", buf); if (ret != 1) { fprintf(stderr, "parse failure for protos\n"); return 1; } outprotos = stringNew(buf); if (!strncmp(outprotos, "inline", 7)) in_line = TRUE; } } } if (argc - nflags < 2) { fprintf(stderr, "no files specified!\n"); return 1; } /* ---------------------------------------------------------------- */ /* Generate the prototype string */ /* ---------------------------------------------------------------- */ ba = l_byteaCreate(500); /* First the extern C head */ sa = sarrayCreate(0); sarrayAddString(sa, (char *)"/*", L_COPY); snprintf(buf, L_BUF_SIZE, " * These prototypes were autogen'd by xtractprotos, v. %s", version); sarrayAddString(sa, buf, L_COPY); sarrayAddString(sa, (char *)" */", L_COPY); sarrayAddString(sa, (char *)"#ifdef __cplusplus", L_COPY); sarrayAddString(sa, (char *)"extern \"C\" {", L_COPY); sarrayAddString(sa, (char *)"#endif /* __cplusplus */\n", L_COPY); str = sarrayToString(sa, 1); l_byteaAppendString(ba, str); lept_free(str); sarrayDestroy(&sa); /* Then the prototypes */ firstfile = 1 + nflags; protos_added = FALSE; if ((tempfile = l_makeTempFilename()) == NULL) { fprintf(stderr, "failure to make a writeable temp file\n"); return 1; } for (i = firstfile; i < argc; i++) { filein = argv[i]; len = strlen(filein); if (filein[len - 1] == 'h') /* skip .h files */ continue; snprintf(buf, L_BUF_SIZE, "cpp -ansi -DNO_PROTOS %s %s", filein, tempfile); ret = system(buf); /* cpp */ if (ret) { fprintf(stderr, "cpp failure for %s; continuing\n", filein); continue; } if ((str = parseForProtos(tempfile, prestring)) == NULL) { fprintf(stderr, "parse failure for %s; continuing\n", filein); continue; } if (strlen(str) > 1) { /* strlen(str) == 1 is a file without protos */ l_byteaAppendString(ba, str); protos_added = TRUE; } lept_free(str); } lept_rmfile(tempfile); lept_free(tempfile); /* Lastly the extern C tail */ sa = sarrayCreate(0); sarrayAddString(sa, (char *)"\n#ifdef __cplusplus", L_COPY); sarrayAddString(sa, (char *)"}", L_COPY); sarrayAddString(sa, (char *)"#endif /* __cplusplus */", L_COPY); str = sarrayToString(sa, 1); l_byteaAppendString(ba, str); lept_free(str); sarrayDestroy(&sa); protostr = (char *)l_byteaCopyData(ba, &nbytes); l_byteaDestroy(&ba); /* ---------------------------------------------------------------- */ /* Generate the output */ /* ---------------------------------------------------------------- */ if (!outprotos) { /* just write to stdout */ fprintf(stderr, "%s\n", protostr); lept_free(protostr); return 0; } /* If no protos were found, do nothing further */ if (!protos_added) { fprintf(stderr, "No protos found\n"); lept_free(protostr); return 1; } /* Make the output files */ ba = l_byteaInitFromFile("allheaders_top.txt"); if (!in_line) { snprintf(buf, sizeof(buf), "#include \"%s\"\n", outprotos); l_byteaAppendString(ba, buf); l_binaryWrite(outprotos, "w", protostr, nbytes); } else { l_byteaAppendString(ba, protostr); } ba2 = l_byteaInitFromFile("allheaders_bot.txt"); l_byteaJoin(ba, &ba2); l_byteaWrite("allheaders.h", ba, 0, 0); l_byteaDestroy(&ba); lept_free(protostr); return 0; }
904
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
gplotAddPlot
gplotAddPlot( GPLOT * gplot , NUMA * nax , NUMA * nay , l_int32 plotstyle , const char * plottitle)
['gplot', 'nax', 'nay', 'plotstyle', 'plottitle']
gplotAddPlot(GPLOT *gplot, NUMA *nax, NUMA *nay, l_int32 plotstyle, const char *plottitle) { char buf[L_BUF_SIZE]; char emptystring[] = ""; char *datastr, *title; l_int32 n, i; l_float32 valx, valy, startx, delx; SARRAY *sa; PROCNAME("gplotAddPlot"); if (!gplot) return ERROR_INT("gplot not defined", procName, 1); if (!nay) return ERROR_INT("nay not defined", procName, 1); if (plotstyle < 0 || plotstyle >= NUM_GPLOT_STYLES) return ERROR_INT("invalid plotstyle", procName, 1); if ((n = numaGetCount(nay)) == 0) return ERROR_INT("no points to plot", procName, 1); if (nax && (n != numaGetCount(nax))) return ERROR_INT("nax and nay sizes differ", procName, 1); if (n == 1 && plotstyle == GPLOT_LINES) { L_INFO("only 1 pt; changing style to points\n", procName); plotstyle = GPLOT_POINTS; } /* Save plotstyle and plottitle */ numaGetParameters(nay, &startx, &delx); numaAddNumber(gplot->plotstyles, plotstyle); if (plottitle) { title = stringNew(plottitle); sarrayAddString(gplot->plottitles, title, L_INSERT); } else { sarrayAddString(gplot->plottitles, emptystring, L_COPY); } /* Generate and save data filename */ gplot->nplots++; snprintf(buf, L_BUF_SIZE, "%s.data.%d", gplot->rootname, gplot->nplots); sarrayAddString(gplot->datanames, buf, L_COPY); /* Generate data and save as a string */ sa = sarrayCreate(n); for (i = 0; i < n; i++) { if (nax) numaGetFValue(nax, i, &valx); else valx = startx + i * delx; numaGetFValue(nay, i, &valy); snprintf(buf, L_BUF_SIZE, "%f %f\n", valx, valy); sarrayAddString(sa, buf, L_COPY); } datastr = sarrayToString(sa, 0); sarrayAddString(gplot->plotdata, datastr, L_INSERT); sarrayDestroy(&sa); return 0; }
383
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
gplotCreate
gplotCreate( const char * rootname , l_int32 outformat , const char * title , const char * xlabel , const char * ylabel)
['rootname', 'outformat', 'title', 'xlabel', 'ylabel']
gplotCreate(const char *rootname, l_int32 outformat, const char *title, const char *xlabel, const char *ylabel) { char *newroot; char buf[L_BUF_SIZE]; l_int32 badchar; GPLOT *gplot; PROCNAME("gplotCreate"); if (!rootname) return (GPLOT *)ERROR_PTR("rootname not defined", procName, NULL); if (outformat != GPLOT_PNG && outformat != GPLOT_PS && outformat != GPLOT_EPS && outformat != GPLOT_LATEX) return (GPLOT *)ERROR_PTR("outformat invalid", procName, NULL); stringCheckForChars(rootname, "`;&|><\"?*", &badchar); if (badchar) /* danger of command injection */ return (GPLOT *)ERROR_PTR("invalid rootname", procName, NULL); if ((gplot = (GPLOT *)LEPT_CALLOC(1, sizeof(GPLOT))) == NULL) return (GPLOT *)ERROR_PTR("gplot not made", procName, NULL); gplot->cmddata = sarrayCreate(0); gplot->datanames = sarrayCreate(0); gplot->plotdata = sarrayCreate(0); gplot->plottitles = sarrayCreate(0); gplot->plotstyles = numaCreate(0); /* Save title, labels, rootname, outformat, cmdname, outname */ newroot = genPathname(rootname, NULL); gplot->rootname = newroot; gplot->outformat = outformat; snprintf(buf, L_BUF_SIZE, "%s.cmd", rootname); gplot->cmdname = stringNew(buf); if (outformat == GPLOT_PNG) snprintf(buf, L_BUF_SIZE, "%s.png", newroot); else if (outformat == GPLOT_PS) snprintf(buf, L_BUF_SIZE, "%s.ps", newroot); else if (outformat == GPLOT_EPS) snprintf(buf, L_BUF_SIZE, "%s.eps", newroot); else if (outformat == GPLOT_LATEX) snprintf(buf, L_BUF_SIZE, "%s.tex", newroot); gplot->outname = stringNew(buf); if (title) gplot->title = stringNew(title); if (xlabel) gplot->xlabel = stringNew(xlabel); if (ylabel) gplot->ylabel = stringNew(ylabel); return gplot; }
372
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
gplotGenCommandFile
gplotGenCommandFile( GPLOT * gplot)
['gplot']
gplotGenCommandFile(GPLOT *gplot) { char buf[L_BUF_SIZE]; char *cmdstr, *plottitle, *dataname; l_int32 i, plotstyle, nplots; FILE *fp; PROCNAME("gplotGenCommandFile"); if (!gplot) return ERROR_INT("gplot not defined", procName, 1); /* Remove any previous command data */ sarrayClear(gplot->cmddata); /* Generate command data instructions */ if (gplot->title) { /* set title */ snprintf(buf, L_BUF_SIZE, "set title '%s'", gplot->title); sarrayAddString(gplot->cmddata, buf, L_COPY); } if (gplot->xlabel) { /* set xlabel */ snprintf(buf, L_BUF_SIZE, "set xlabel '%s'", gplot->xlabel); sarrayAddString(gplot->cmddata, buf, L_COPY); } if (gplot->ylabel) { /* set ylabel */ snprintf(buf, L_BUF_SIZE, "set ylabel '%s'", gplot->ylabel); sarrayAddString(gplot->cmddata, buf, L_COPY); } /* Set terminal type and output */ if (gplot->outformat == GPLOT_PNG) { snprintf(buf, L_BUF_SIZE, "set terminal png; set output '%s'", gplot->outname); } else if (gplot->outformat == GPLOT_PS) { snprintf(buf, L_BUF_SIZE, "set terminal postscript; set output '%s'", gplot->outname); } else if (gplot->outformat == GPLOT_EPS) { snprintf(buf, L_BUF_SIZE, "set terminal postscript eps; set output '%s'", gplot->outname); } else if (gplot->outformat == GPLOT_LATEX) { snprintf(buf, L_BUF_SIZE, "set terminal latex; set output '%s'", gplot->outname); } sarrayAddString(gplot->cmddata, buf, L_COPY); if (gplot->scaling == GPLOT_LOG_SCALE_X || gplot->scaling == GPLOT_LOG_SCALE_X_Y) { snprintf(buf, L_BUF_SIZE, "set logscale x"); sarrayAddString(gplot->cmddata, buf, L_COPY); } if (gplot->scaling == GPLOT_LOG_SCALE_Y || gplot->scaling == GPLOT_LOG_SCALE_X_Y) { snprintf(buf, L_BUF_SIZE, "set logscale y"); sarrayAddString(gplot->cmddata, buf, L_COPY); } nplots = sarrayGetCount(gplot->datanames); for (i = 0; i < nplots; i++) { plottitle = sarrayGetString(gplot->plottitles, i, L_NOCOPY); dataname = sarrayGetString(gplot->datanames, i, L_NOCOPY); numaGetIValue(gplot->plotstyles, i, &plotstyle); if (nplots == 1) { snprintf(buf, L_BUF_SIZE, "plot '%s' title '%s' %s", dataname, plottitle, gplotstylenames[plotstyle]); } else { if (i == 0) snprintf(buf, L_BUF_SIZE, "plot '%s' title '%s' %s, \\", dataname, plottitle, gplotstylenames[plotstyle]); else if (i < nplots - 1) snprintf(buf, L_BUF_SIZE, " '%s' title '%s' %s, \\", dataname, plottitle, gplotstylenames[plotstyle]); else snprintf(buf, L_BUF_SIZE, " '%s' title '%s' %s", dataname, plottitle, gplotstylenames[plotstyle]); } sarrayAddString(gplot->cmddata, buf, L_COPY); } /* Write command data to file */ cmdstr = sarrayToString(gplot->cmddata, 1); if ((fp = fopenWriteStream(gplot->cmdname, "w")) == NULL) { LEPT_FREE(cmdstr); return ERROR_INT("cmd stream not opened", procName, 1); } fwrite(cmdstr, 1, strlen(cmdstr), fp); fclose(fp); LEPT_FREE(cmdstr); return 0; }
580
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
gplotMakeOutput
gplotMakeOutput( GPLOT * gplot)
['gplot']
gplotMakeOutput(GPLOT *gplot) { char buf[L_BUF_SIZE]; char *cmdname; l_int32 ignore; PROCNAME("gplotMakeOutput"); if (!gplot) return ERROR_INT("gplot not defined", procName, 1); gplotGenCommandFile(gplot); gplotGenDataFiles(gplot); cmdname = genPathname(gplot->cmdname, NULL); #ifndef _WIN32 snprintf(buf, L_BUF_SIZE, "gnuplot %s", cmdname); #else snprintf(buf, L_BUF_SIZE, "wgnuplot %s", cmdname); #endif /* _WIN32 */ #ifndef OS_IOS /* iOS 11 does not support system() */ ignore = system(buf); /* gnuplot || wgnuplot */ #endif /* !OS_IOS */ LEPT_FREE(cmdname); return 0; }
99
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
gplotRead
gplotRead( const char * filename)
['filename']
gplotRead(const char *filename) { char buf[L_BUF_SIZE]; char *rootname, *title, *xlabel, *ylabel, *ignores; l_int32 outformat, ret, version, ignore; FILE *fp; GPLOT *gplot; PROCNAME("gplotRead"); if (!filename) return (GPLOT *)ERROR_PTR("filename not defined", procName, NULL); if ((fp = fopenReadStream(filename)) == NULL) return (GPLOT *)ERROR_PTR("stream not opened", procName, NULL); ret = fscanf(fp, "Gplot Version %d\n", &version); if (ret != 1) { fclose(fp); return (GPLOT *)ERROR_PTR("not a gplot file", procName, NULL); } if (version != GPLOT_VERSION_NUMBER) { fclose(fp); return (GPLOT *)ERROR_PTR("invalid gplot version", procName, NULL); } ignore = fscanf(fp, "Rootname: %s\n", buf); rootname = stringNew(buf); ignore = fscanf(fp, "Output format: %d\n", &outformat); ignores = fgets(buf, L_BUF_SIZE, fp); /* Title: ... */ title = stringNew(buf + 7); title[strlen(title) - 1] = '\0'; ignores = fgets(buf, L_BUF_SIZE, fp); /* X axis label: ... */ xlabel = stringNew(buf + 14); xlabel[strlen(xlabel) - 1] = '\0'; ignores = fgets(buf, L_BUF_SIZE, fp); /* Y axis label: ... */ ylabel = stringNew(buf + 14); ylabel[strlen(ylabel) - 1] = '\0'; gplot = gplotCreate(rootname, outformat, title, xlabel, ylabel); LEPT_FREE(rootname); LEPT_FREE(title); LEPT_FREE(xlabel); LEPT_FREE(ylabel); if (!gplot) { fclose(fp); return (GPLOT *)ERROR_PTR("gplot not made", procName, NULL); } sarrayDestroy(&gplot->cmddata); sarrayDestroy(&gplot->datanames); sarrayDestroy(&gplot->plotdata); sarrayDestroy(&gplot->plottitles); numaDestroy(&gplot->plotstyles); ignore = fscanf(fp, "Commandfile name: %s\n", buf); stringReplace(&gplot->cmdname, buf); ignore = fscanf(fp, "\nCommandfile data:"); gplot->cmddata = sarrayReadStream(fp); ignore = fscanf(fp, "\nDatafile names:"); gplot->datanames = sarrayReadStream(fp); ignore = fscanf(fp, "\nPlot data:"); gplot->plotdata = sarrayReadStream(fp); ignore = fscanf(fp, "\nPlot titles:"); gplot->plottitles = sarrayReadStream(fp); ignore = fscanf(fp, "\nPlot styles:"); gplot->plotstyles = numaReadStream(fp); ignore = fscanf(fp, "Number of plots: %d\n", &gplot->nplots); ignore = fscanf(fp, "Output file name: %s\n", buf); stringReplace(&gplot->outname, buf); ignore = fscanf(fp, "Axis scaling: %d\n", &gplot->scaling); fclose(fp); return gplot; }
560
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
ptaReadStream
ptaReadStream( FILE * fp)
['fp']
ptaReadStream(FILE *fp) { char typestr[128]; l_int32 i, n, ix, iy, type, version; l_float32 x, y; PTA *pta; PROCNAME("ptaReadStream"); if (!fp) return (PTA *)ERROR_PTR("stream not defined", procName, NULL); if (fscanf(fp, "\n Pta Version %d\n", &version) != 1) return (PTA *)ERROR_PTR("not a pta file", procName, NULL); if (version != PTA_VERSION_NUMBER) return (PTA *)ERROR_PTR("invalid pta version", procName, NULL); if (fscanf(fp, " Number of pts = %d; format = %s\n", &n, typestr) != 2) return (PTA *)ERROR_PTR("not a pta file", procName, NULL); if (!strcmp(typestr, "float")) type = 0; else /* typestr is "integer" */ type = 1; if ((pta = ptaCreate(n)) == NULL) return (PTA *)ERROR_PTR("pta not made", procName, NULL); for (i = 0; i < n; i++) { if (type == 0) { /* data is float */ if (fscanf(fp, " (%f, %f)\n", &x, &y) != 2) { ptaDestroy(&pta); return (PTA *)ERROR_PTR("error reading floats", procName, NULL); } ptaAddPt(pta, x, y); } else { /* data is integer */ if (fscanf(fp, " (%d, %d)\n", &ix, &iy) != 2) { ptaDestroy(&pta); return (PTA *)ERROR_PTR("error reading ints", procName, NULL); } ptaAddPt(pta, ix, iy); } } return pta; }
309
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
selReadStream
selReadStream( FILE * fp)
['fp']
selReadStream(FILE *fp) { char *selname; char linebuf[L_BUF_SIZE]; l_int32 sy, sx, cy, cx, i, j, version, ignore; SEL *sel; PROCNAME("selReadStream"); if (!fp) return (SEL *)ERROR_PTR("stream not defined", procName, NULL); if (fscanf(fp, " Sel Version %d\n", &version) != 1) return (SEL *)ERROR_PTR("not a sel file", procName, NULL); if (version != SEL_VERSION_NUMBER) return (SEL *)ERROR_PTR("invalid sel version", procName, NULL); if (fgets(linebuf, L_BUF_SIZE, fp) == NULL) return (SEL *)ERROR_PTR("error reading into linebuf", procName, NULL); selname = stringNew(linebuf); sscanf(linebuf, " ------ %s ------", selname); if (fscanf(fp, " sy = %d, sx = %d, cy = %d, cx = %d\n", &sy, &sx, &cy, &cx) != 4) { LEPT_FREE(selname); return (SEL *)ERROR_PTR("dimensions not read", procName, NULL); } if ((sel = selCreate(sy, sx, selname)) == NULL) { LEPT_FREE(selname); return (SEL *)ERROR_PTR("sel not made", procName, NULL); } selSetOrigin(sel, cy, cx); for (i = 0; i < sy; i++) { ignore = fscanf(fp, " "); for (j = 0; j < sx; j++) ignore = fscanf(fp, "%1d", &sel->data[i][j]); ignore = fscanf(fp, "\n"); } ignore = fscanf(fp, "\n"); LEPT_FREE(selname); return sel; }
328
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
selaComputeCompositeParameters
selaComputeCompositeParameters( const char * fileout)
['fileout']
selaComputeCompositeParameters(const char *fileout) { char *str, *nameh1, *nameh2, *namev1, *namev2; char buf[L_BUF_SIZE]; l_int32 size, size1, size2, len; SARRAY *sa; SELA *selabasic, *selacomb; selabasic = selaAddBasic(NULL); selacomb = selaAddDwaCombs(NULL); sa = sarrayCreate(64); for (size = 2; size < 64; size++) { selectComposableSizes(size, &size1, &size2); nameh1 = selaGetBrickName(selabasic, size1, 1); namev1 = selaGetBrickName(selabasic, 1, size1); if (size2 > 1) { nameh2 = selaGetCombName(selacomb, size1 * size2, L_HORIZ); namev2 = selaGetCombName(selacomb, size1 * size2, L_VERT); } else { nameh2 = stringNew(""); namev2 = stringNew(""); } snprintf(buf, L_BUF_SIZE, " { %d, %d, %d, \"%s\", \"%s\", \"%s\", \"%s\" },", size, size1, size2, nameh1, nameh2, namev1, namev2); sarrayAddString(sa, buf, L_COPY); LEPT_FREE(nameh1); LEPT_FREE(nameh2); LEPT_FREE(namev1); LEPT_FREE(namev2); } str = sarrayToString(sa, 1); len = strlen(str); l_binaryWrite(fileout, "w", str, len + 1); LEPT_FREE(str); sarrayDestroy(&sa); selaDestroy(&selabasic); selaDestroy(&selacomb); return; }
277
True
1
CVE-2018-7186
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
True
[{'url': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'name': 'https://lists.debian.org/debian-lts/2018/02/msg00054.html', 'refsource': 'MISC', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'name': 'https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.debian.org/890548', 'name': 'https://bugs.debian.org/890548', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00005.html', 'name': '[debian-lts-announce] 20180307 [SECURITY] [DLA 1302-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.75.3 does not limit the number of characters in a %s format argument to fscanf or sscanf, which allows remote attackers to cause a denial of service (stack-based buffer overflow) or possibly have unspecified other impact via a long string, as demonstrated by the gplotRead and ptaReadStream functions.'}]
2020-08-24T17:37Z
2018-02-16T16:29Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Dan Bloomberg
2018-02-15 15:19:04-08:00
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
ee301cb2029db8a6289c5295daa42bba7715e99a
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
selaGetCombName
selaGetCombName( SELA * sela , l_int32 size , l_int32 direction)
['sela', 'size', 'direction']
selaGetCombName(SELA *sela, l_int32 size, l_int32 direction) { char *selname; char combname[L_BUF_SIZE]; l_int32 i, nsels, sx, sy, found; SEL *sel; PROCNAME("selaGetCombName"); if (!sela) return (char *)ERROR_PTR("sela not defined", procName, NULL); if (direction != L_HORIZ && direction != L_VERT) return (char *)ERROR_PTR("invalid direction", procName, NULL); /* Derive the comb name we're looking for */ if (direction == L_HORIZ) snprintf(combname, L_BUF_SIZE, "sel_comb_%dh", size); else /* direction == L_VERT */ snprintf(combname, L_BUF_SIZE, "sel_comb_%dv", size); found = FALSE; nsels = selaGetCount(sela); for (i = 0; i < nsels; i++) { sel = selaGetSel(sela, i); selGetParameters(sel, &sy, &sx, NULL, NULL); if (sy != 1 && sx != 1) /* 2-D; not a comb */ continue; selname = selGetName(sel); if (!strcmp(selname, combname)) { found = TRUE; break; } } if (found) return stringNew(selname); else return (char *)ERROR_PTR("sel not found", procName, NULL); }
228
True
1
CVE-2018-7247
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/DanBloomberg/leptonica/commit/c1079bb8e77cdd426759e466729917ca37a3ed9f', 'name': 'https://github.com/DanBloomberg/leptonica/commit/c1079bb8e77cdd426759e466729917ca37a3ed9f', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.75.3', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'An issue was discovered in pixHtmlViewer in prog/htmlviewer.c in Leptonica before 1.75.3. Unsanitized input (rootname) can overflow a buffer, leading potentially to arbitrary code execution or possibly unspecified other impact.'}]
2018-03-14T18:27Z
2018-02-19T18:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Stefan Weil
2018-02-12 18:12:37+01:00
prog/htmlviewer: Catch unbound memory access (CID 1386222) rootname can have any size, so limit the amount of copied bytes. Signed-off-by: Stefan Weil <[email protected]>
c1079bb8e77cdd426759e466729917ca37a3ed9f
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
pixHtmlViewer
pixHtmlViewer( const char * dirin , const char * dirout , const char * rootname , l_int32 thumbwidth , l_int32 viewwidth)
['dirin', 'dirout', 'rootname', 'thumbwidth', 'viewwidth']
pixHtmlViewer(const char *dirin, const char *dirout, const char *rootname, l_int32 thumbwidth, l_int32 viewwidth) { char *fname, *fullname, *outname; char *mainname, *linkname, *linknameshort; char *viewfile, *thumbfile; char *shtml, *slink; char charbuf[512]; char htmlstring[] = "<html>"; char framestring[] = "</frameset></html>"; l_int32 i, nfiles, index, w, d, nimages, ret; l_float32 factor; PIX *pix, *pixthumb, *pixview; SARRAY *safiles, *sathumbs, *saviews, *sahtml, *salink; PROCNAME("pixHtmlViewer"); if (!dirin) return ERROR_INT("dirin not defined", procName, 1); if (!dirout) return ERROR_INT("dirout not defined", procName, 1); if (!rootname) return ERROR_INT("rootname not defined", procName, 1); if (thumbwidth == 0) thumbwidth = DEFAULT_THUMB_WIDTH; if (thumbwidth < MIN_THUMB_WIDTH) { L_WARNING("thumbwidth too small; using min value\n", procName); thumbwidth = MIN_THUMB_WIDTH; } if (viewwidth == 0) viewwidth = DEFAULT_VIEW_WIDTH; if (viewwidth < MIN_VIEW_WIDTH) { L_WARNING("viewwidth too small; using min value\n", procName); viewwidth = MIN_VIEW_WIDTH; } /* Make the output directory if it doesn't already exist */ #ifndef _WIN32 snprintf(charbuf, sizeof(charbuf), "mkdir -p %s", dirout); ret = system(charbuf); #else ret = CreateDirectory(dirout, NULL) ? 0 : 1; #endif /* !_WIN32 */ if (ret) { L_ERROR("output directory %s not made\n", procName, dirout); return 1; } /* Capture the filenames in the input directory */ if ((safiles = getFilenamesInDirectory(dirin)) == NULL) return ERROR_INT("safiles not made", procName, 1); /* Generate output text file names */ sprintf(charbuf, "%s/%s.html", dirout, rootname); mainname = stringNew(charbuf); sprintf(charbuf, "%s/%s-links.html", dirout, rootname); linkname = stringNew(charbuf); linknameshort = stringJoin(rootname, "-links.html"); /* Generate the thumbs and views */ sathumbs = sarrayCreate(0); saviews = sarrayCreate(0); nfiles = sarrayGetCount(safiles); index = 0; for (i = 0; i < nfiles; i++) { fname = sarrayGetString(safiles, i, L_NOCOPY); fullname = genPathname(dirin, fname); fprintf(stderr, "name: %s\n", fullname); if ((pix = pixRead(fullname)) == NULL) { fprintf(stderr, "file %s not a readable image\n", fullname); lept_free(fullname); continue; } lept_free(fullname); /* Make and store the thumbnail images */ pixGetDimensions(pix, &w, NULL, &d); factor = (l_float32)thumbwidth / (l_float32)w; pixthumb = pixScale(pix, factor, factor); sprintf(charbuf, "%s_thumb_%03d", rootname, index); sarrayAddString(sathumbs, charbuf, L_COPY); outname = genPathname(dirout, charbuf); WriteFormattedPix(outname, pixthumb); lept_free(outname); pixDestroy(&pixthumb); /* Make and store the view images */ factor = (l_float32)viewwidth / (l_float32)w; if (factor >= 1.0) pixview = pixClone(pix); /* no upscaling */ else pixview = pixScale(pix, factor, factor); snprintf(charbuf, sizeof(charbuf), "%s_view_%03d", rootname, index); sarrayAddString(saviews, charbuf, L_COPY); outname = genPathname(dirout, charbuf); WriteFormattedPix(outname, pixview); lept_free(outname); pixDestroy(&pixview); pixDestroy(&pix); index++; } /* Generate the main html file */ sahtml = sarrayCreate(0); sarrayAddString(sahtml, htmlstring, L_COPY); sprintf(charbuf, "<frameset cols=\"%d, *\">", thumbwidth + 30); sarrayAddString(sahtml, charbuf, L_COPY); sprintf(charbuf, "<frame name=\"thumbs\" src=\"%s\">", linknameshort); sarrayAddString(sahtml, charbuf, L_COPY); sprintf(charbuf, "<frame name=\"views\" src=\"%s\">", sarrayGetString(saviews, 0, L_NOCOPY)); sarrayAddString(sahtml, charbuf, L_COPY); sarrayAddString(sahtml, framestring, L_COPY); shtml = sarrayToString(sahtml, 1); l_binaryWrite(mainname, "w", shtml, strlen(shtml)); fprintf(stderr, "******************************************\n" "Writing html file: %s\n" "******************************************\n", mainname); lept_free(shtml); lept_free(mainname); /* Generate the link html file */ nimages = sarrayGetCount(saviews); fprintf(stderr, "num. images = %d\n", nimages); salink = sarrayCreate(0); for (i = 0; i < nimages; i++) { viewfile = sarrayGetString(saviews, i, L_NOCOPY); thumbfile = sarrayGetString(sathumbs, i, L_NOCOPY); sprintf(charbuf, "<a href=\"%s\" TARGET=views><img src=\"%s\"></a>", viewfile, thumbfile); sarrayAddString(salink, charbuf, L_COPY); } slink = sarrayToString(salink, 1); l_binaryWrite(linkname, "w", slink, strlen(slink)); lept_free(slink); lept_free(linkname); lept_free(linknameshort); sarrayDestroy(&safiles); sarrayDestroy(&sathumbs); sarrayDestroy(&saviews); sarrayDestroy(&sahtml); sarrayDestroy(&salink); return 0; }
922
True
1
CVE-2020-36281
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'name': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'refsource': 'MISC', 'tags': ['Patch', 'Release Notes', 'Third Party Advisory']}, {'url': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22140', 'name': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22140', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/5ee24b398bb67666f6d173763eaaedd9c36fb1e5', 'name': 'https://github.com/DanBloomberg/leptonica/commit/5ee24b398bb67666f6d173763eaaedd9c36fb1e5', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/03/msg00037.html', 'name': '[debian-lts-announce] 20210331 [SECURITY] [DLA 2612-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/JQUEA2X6UTH4DMYCMZAWE2QQLN5YANUA/', 'name': 'FEDORA-2021-f5f2803fff', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RD5AIWHWE334HGYZJR2U3I3JYKSSO2LW/', 'name': 'FEDORA-2021-977ebc82da', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202107-53', 'name': 'GLSA-202107-53', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.80.0', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.80.0 allows a heap-based buffer over-read in pixFewColorsOctcubeQuantMixed in colorquant1.c.'}]
2021-12-03T18:03Z
2021-03-12T01:15Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Dan Bloomberg
2020-05-11 11:17:30-07:00
Fixed issue 22140 in oss-fuzz: Heap-buffer-overflow * color quantized pix must be 8 bpp before extra colors are added.
5ee24b398bb67666f6d173763eaaedd9c36fb1e5
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
pixFewColorsOctcubeQuantMixed
pixFewColorsOctcubeQuantMixed( PIX * pixs , l_int32 level , l_int32 darkthresh , l_int32 lightthresh , l_int32 diffthresh , l_float32 minfract , l_int32 maxspan)
['pixs', 'level', 'darkthresh', 'lightthresh', 'diffthresh', 'minfract', 'maxspan']
pixFewColorsOctcubeQuantMixed(PIX *pixs, l_int32 level, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh, l_float32 minfract, l_int32 maxspan) { l_int32 i, j, w, h, wplc, wplm, wpld, ncolors, index; l_int32 rval, gval, bval, val, minval, maxval; l_int32 *lut; l_uint32 *datac, *datam, *datad, *linec, *linem, *lined; PIX *pixc, *pixm, *pixg, *pixd; PIXCMAP *cmap, *cmapd; PROCNAME("pixFewColorsOctcubeQuantMixed"); if (!pixs || pixGetDepth(pixs) != 32) return (PIX *)ERROR_PTR("pixs undefined or not 32 bpp", procName, NULL); if (level <= 0) level = 3; if (level > 6) return (PIX *)ERROR_PTR("invalid level", procName, NULL); if (darkthresh <= 0) darkthresh = 20; if (lightthresh <= 0) lightthresh = 244; if (diffthresh <= 0) diffthresh = 20; if (minfract <= 0.0) minfract = 0.05; if (maxspan <= 2) maxspan = 15; /* Start with a simple fixed octcube quantizer. */ if ((pixc = pixFewColorsOctcubeQuant1(pixs, level)) == NULL) return (PIX *)ERROR_PTR("too many colors", procName, NULL); /* Identify and save color entries in the colormap. Set up a LUT * that returns -1 for any gray pixel. */ cmap = pixGetColormap(pixc); ncolors = pixcmapGetCount(cmap); cmapd = pixcmapCreate(8); lut = (l_int32 *)LEPT_CALLOC(256, sizeof(l_int32)); for (i = 0; i < 256; i++) lut[i] = -1; for (i = 0, index = 0; i < ncolors; i++) { pixcmapGetColor(cmap, i, &rval, &gval, &bval); minval = L_MIN(rval, gval); minval = L_MIN(minval, bval); if (minval > lightthresh) /* near white */ continue; maxval = L_MAX(rval, gval); maxval = L_MAX(maxval, bval); if (maxval < darkthresh) /* near black */ continue; /* Use the max diff between components to test for color */ if (maxval - minval >= diffthresh) { pixcmapAddColor(cmapd, rval, gval, bval); lut[i] = index; index++; } } /* Generate dest pix with just the color pixels set to their * colormap indices. At the same time, make a 1 bpp mask * of the non-color pixels */ pixGetDimensions(pixs, &w, &h, NULL); pixd = pixCreate(w, h, 8); pixSetColormap(pixd, cmapd); pixm = pixCreate(w, h, 1); datac = pixGetData(pixc); datam = pixGetData(pixm); datad = pixGetData(pixd); wplc = pixGetWpl(pixc); wplm = pixGetWpl(pixm); wpld = pixGetWpl(pixd); for (i = 0; i < h; i++) { linec = datac + i * wplc; linem = datam + i * wplm; lined = datad + i * wpld; for (j = 0; j < w; j++) { val = GET_DATA_BYTE(linec, j); if (lut[val] == -1) SET_DATA_BIT(linem, j); else SET_DATA_BYTE(lined, j, lut[val]); } } /* Fill in the gray values. Use a grayscale version of pixs * as input, along with the mask over the actual gray pixels. */ pixg = pixConvertTo8(pixs, 0); pixGrayQuantFromHisto(pixd, pixg, pixm, minfract, maxspan); LEPT_FREE(lut); pixDestroy(&pixc); pixDestroy(&pixm); pixDestroy(&pixg); return pixd; }
646
True
1
CVE-2020-36279
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'name': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'refsource': 'MISC', 'tags': ['Patch', 'Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/3c18c43b6a3f753f0dfff99610d46ad46b8bfac4', 'name': 'https://github.com/DanBloomberg/leptonica/commit/3c18c43b6a3f753f0dfff99610d46ad46b8bfac4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22512', 'name': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22512', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/03/msg00037.html', 'name': '[debian-lts-announce] 20210331 [SECURITY] [DLA 2612-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/JQUEA2X6UTH4DMYCMZAWE2QQLN5YANUA/', 'name': 'FEDORA-2021-f5f2803fff', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RD5AIWHWE334HGYZJR2U3I3JYKSSO2LW/', 'name': 'FEDORA-2021-977ebc82da', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202107-53', 'name': 'GLSA-202107-53', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.80.0', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.80.0 allows a heap-based buffer over-read in rasteropGeneralLow, related to adaptmap_reg.c and adaptmap.c.'}]
2021-12-03T17:38Z
2021-03-12T00:15Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Dan Bloomberg
2020-05-26 22:24:40-07:00
Fixing oss-fuzz issue 22512: Heap-buffer-overflow in rasteropGeneralLow() * Simplified the hole-filling function `
3c18c43b6a3f753f0dfff99610d46ad46b8bfac4
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
main
main( int argc , char ** argv)
['argc', 'argv']
int main(int argc, char **argv) { l_int32 w, h; PIX *pixs, *pixg, *pixim, *pixgm, *pixmi, *pix1, *pix2; PIX *pixmr, *pixmg, *pixmb, *pixmri, *pixmgi, *pixmbi; PIXA *pixa; L_REGPARAMS *rp; if (regTestSetup(argc, argv, &rp)) return 1; lept_mkdir("lept/adapt"); // REMOVE? pixs = pixRead("wet-day.jpg"); pixa = pixaCreate(0); pixg = pixConvertRGBToGray(pixs, 0.33, 0.34, 0.33); pixaAddPix(pixa, pixs, L_INSERT); pixaAddPix(pixa, pixg, L_INSERT); pixGetDimensions(pixs, &w, &h, NULL); /* Process in grayscale */ startTimer(); pixim = pixCreate(w, h, 1); pixRasterop(pixim, XS, YS, WS, HS, PIX_SET, NULL, 0, 0); pixGetBackgroundGrayMap(pixg, pixim, SIZE_X, SIZE_Y, BINTHRESH, MINCOUNT, &pixgm); fprintf(stderr, "Time for gray adaptmap gen: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pixgm, IFF_PNG); /* 0 */ pixaAddPix(pixa, pixgm, L_INSERT); startTimer(); pixmi = pixGetInvBackgroundMap(pixgm, BGVAL, SMOOTH_X, SMOOTH_Y); fprintf(stderr, "Time for gray inv map generation: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pixmi, IFF_PNG); /* 1 */ pixaAddPix(pixa, pixmi, L_INSERT); startTimer(); pix1 = pixApplyInvBackgroundGrayMap(pixg, pixmi, SIZE_X, SIZE_Y); fprintf(stderr, "Time to apply gray inv map: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pix1, IFF_JFIF_JPEG); /* 2 */ pixaAddPix(pixa, pix1, L_INSERT); pix2 = pixGammaTRCMasked(NULL, pix1, pixim, 1.0, 0, 190); pixInvert(pixim, pixim); pixGammaTRCMasked(pix2, pix2, pixim, 1.0, 60, 190); regTestWritePixAndCheck(rp, pix2, IFF_JFIF_JPEG); /* 3 */ pixaAddPix(pixa, pix2, L_INSERT); pixDestroy(&pixim); /* Process in color */ startTimer(); pixim = pixCreate(w, h, 1); pixRasterop(pixim, XS, YS, WS, HS, PIX_SET, NULL, 0, 0); pixGetBackgroundRGBMap(pixs, pixim, NULL, SIZE_X, SIZE_Y, BINTHRESH, MINCOUNT, &pixmr, &pixmg, &pixmb); fprintf(stderr, "Time for color adaptmap gen: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pixmr, IFF_PNG); /* 4 */ regTestWritePixAndCheck(rp, pixmg, IFF_PNG); /* 5 */ regTestWritePixAndCheck(rp, pixmb, IFF_PNG); /* 6 */ pixaAddPix(pixa, pixmr, L_INSERT); pixaAddPix(pixa, pixmg, L_INSERT); pixaAddPix(pixa, pixmb, L_INSERT); startTimer(); pixmri = pixGetInvBackgroundMap(pixmr, BGVAL, SMOOTH_X, SMOOTH_Y); pixmgi = pixGetInvBackgroundMap(pixmg, BGVAL, SMOOTH_X, SMOOTH_Y); pixmbi = pixGetInvBackgroundMap(pixmb, BGVAL, SMOOTH_X, SMOOTH_Y); fprintf(stderr, "Time for color inv map generation: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pixmri, IFF_PNG); /* 7 */ regTestWritePixAndCheck(rp, pixmgi, IFF_PNG); /* 8 */ regTestWritePixAndCheck(rp, pixmbi, IFF_PNG); /* 9 */ pixaAddPix(pixa, pixmri, L_INSERT); pixaAddPix(pixa, pixmgi, L_INSERT); pixaAddPix(pixa, pixmbi, L_INSERT); startTimer(); pix1 = pixApplyInvBackgroundRGBMap(pixs, pixmri, pixmgi, pixmbi, SIZE_X, SIZE_Y); fprintf(stderr, "Time to apply color inv maps: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pix1, IFF_JFIF_JPEG); /* 10 */ pixaAddPix(pixa, pix1, L_INSERT); pix2 = pixGammaTRCMasked(NULL, pix1, pixim, 1.0, 0, 190); pixInvert(pixim, pixim); pixGammaTRCMasked(pix2, pix2, pixim, 1.0, 60, 190); regTestWritePixAndCheck(rp, pix2, IFF_JFIF_JPEG); /* 11 */ pixaAddPix(pixa, pix2, L_INSERT); pixDestroy(&pixim); /* Process at higher level in color */ startTimer(); pixim = pixCreate(w, h, 1); pixRasterop(pixim, XS, YS, WS, HS, PIX_SET, NULL, 0, 0); pix1 = pixBackgroundNorm(pixs, pixim, NULL, 5, 10, BINTHRESH, 20, BGVAL, SMOOTH_X, SMOOTH_Y); fprintf(stderr, "Time for bg normalization: %7.3f\n", stopTimer()); regTestWritePixAndCheck(rp, pix1, IFF_JFIF_JPEG); /* 12 */ pixaAddPix(pixa, pix1, L_INSERT); pix2 = pixGammaTRCMasked(NULL, pix1, pixim, 1.0, 0, 190); pixInvert(pixim, pixim); pixGammaTRCMasked(pix2, pix2, pixim, 1.0, 60, 190); regTestWritePixAndCheck(rp, pix2, IFF_JFIF_JPEG); /* 13 */ pixaAddPix(pixa, pix2, L_INSERT); pixDestroy(&pixim); /* Display results */ pix1 = pixaDisplayTiledAndScaled(pixa, 32, 400, 4, 0, 20, 2); pixWrite("/tmp/lept/adapt/results.jpg", pix1, IFF_JFIF_JPEG); pixDisplayWithTitle(pix1, 100, 0, NULL, rp->display); pixDestroy(&pix1); pixaDestroy(&pixa); return regTestCleanup(rp); }
961
True
1
CVE-2020-36279
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'name': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'refsource': 'MISC', 'tags': ['Patch', 'Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/3c18c43b6a3f753f0dfff99610d46ad46b8bfac4', 'name': 'https://github.com/DanBloomberg/leptonica/commit/3c18c43b6a3f753f0dfff99610d46ad46b8bfac4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22512', 'name': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22512', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/03/msg00037.html', 'name': '[debian-lts-announce] 20210331 [SECURITY] [DLA 2612-1] leptonlib security update', 'refsource': 'MLIST', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/JQUEA2X6UTH4DMYCMZAWE2QQLN5YANUA/', 'name': 'FEDORA-2021-f5f2803fff', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RD5AIWHWE334HGYZJR2U3I3JYKSSO2LW/', 'name': 'FEDORA-2021-977ebc82da', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202107-53', 'name': 'GLSA-202107-53', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.80.0', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.80.0 allows a heap-based buffer over-read in rasteropGeneralLow, related to adaptmap_reg.c and adaptmap.c.'}]
2021-12-03T17:38Z
2021-03-12T00:15Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Dan Bloomberg
2020-05-26 22:24:40-07:00
Fixing oss-fuzz issue 22512: Heap-buffer-overflow in rasteropGeneralLow() * Simplified the hole-filling function `
3c18c43b6a3f753f0dfff99610d46ad46b8bfac4
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
pixFillMapHoles
pixFillMapHoles( PIX * pix , l_int32 nx , l_int32 ny , l_int32 filltype)
['pix', 'nx', 'ny', 'filltype']
pixFillMapHoles(PIX *pix, l_int32 nx, l_int32 ny, l_int32 filltype) { l_int32 w, h, y, nmiss, goodcol, i, j, found, ival, valtest; l_uint32 val, lastval; NUMA *na; /* indicates if there is any data in the column */ PIX *pixt; PROCNAME("pixFillMapHoles"); if (!pix || pixGetDepth(pix) != 8) return ERROR_INT("pix not defined or not 8 bpp", procName, 1); if (pixGetColormap(pix)) return ERROR_INT("pix is colormapped", procName, 1); /* ------------- Fill holes in the mapping image columns ----------- */ pixGetDimensions(pix, &w, &h, NULL); na = numaCreate(0); /* holds flag for which columns have data */ nmiss = 0; valtest = (filltype == L_FILL_WHITE) ? 255 : 0; for (j = 0; j < nx; j++) { /* do it by columns */ found = FALSE; for (i = 0; i < ny; i++) { pixGetPixel(pix, j, i, &val); if (val != valtest) { y = i; found = TRUE; break; } } if (found == FALSE) { numaAddNumber(na, 0); /* no data in the column */ nmiss++; } else { numaAddNumber(na, 1); /* data in the column */ for (i = y - 1; i >= 0; i--) /* replicate upwards to top */ pixSetPixel(pix, j, i, val); pixGetPixel(pix, j, 0, &lastval); for (i = 1; i < h; i++) { /* set going down to bottom */ pixGetPixel(pix, j, i, &val); if (val == valtest) pixSetPixel(pix, j, i, lastval); else lastval = val; } } } numaAddNumber(na, 0); /* last column */ if (nmiss == nx) { /* no data in any column! */ numaDestroy(&na); L_WARNING("no bg found; no data in any column\n", procName); return 1; } /* ---------- Fill in missing columns by replication ----------- */ if (nmiss > 0) { /* replicate columns */ pixt = pixCopy(NULL, pix); /* Find the first good column */ goodcol = 0; for (j = 0; j < w; j++) { numaGetIValue(na, j, &ival); if (ival == 1) { goodcol = j; break; } } if (goodcol > 0) { /* copy cols backward */ for (j = goodcol - 1; j >= 0; j--) { pixRasterop(pix, j, 0, 1, h, PIX_SRC, pixt, j + 1, 0); pixRasterop(pixt, j, 0, 1, h, PIX_SRC, pix, j, 0); } } for (j = goodcol + 1; j < w; j++) { /* copy cols forward */ numaGetIValue(na, j, &ival); if (ival == 0) { /* Copy the column to the left of j */ pixRasterop(pix, j, 0, 1, h, PIX_SRC, pixt, j - 1, 0); pixRasterop(pixt, j, 0, 1, h, PIX_SRC, pix, j, 0); } } pixDestroy(&pixt); } if (w > nx) { /* replicate the last column */ for (i = 0; i < h; i++) { pixGetPixel(pix, w - 2, i, &val); pixSetPixel(pix, w - 1, i, val); } } numaDestroy(&na); return 0; }
614
True
1
CVE-2020-36280
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'name': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'refsource': 'MISC', 'tags': ['Patch', 'Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/5ba34b1fe741d69d43a6c8cf767756997eadd87c', 'name': 'https://github.com/DanBloomberg/leptonica/commit/5ba34b1fe741d69d43a6c8cf767756997eadd87c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23654', 'name': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23654', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/JQUEA2X6UTH4DMYCMZAWE2QQLN5YANUA/', 'name': 'FEDORA-2021-f5f2803fff', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RD5AIWHWE334HGYZJR2U3I3JYKSSO2LW/', 'name': 'FEDORA-2021-977ebc82da', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202107-53', 'name': 'GLSA-202107-53', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.80.0', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.80.0 allows a heap-based buffer over-read in pixReadFromTiffStream, related to tiffio.c.'}]
2021-12-03T17:38Z
2021-03-12T00:15Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Dan Bloomberg
2020-06-22 23:02:43-07:00
Issue 23654 in oss-fuzz: Heap-buffer-overflow in pixReadFromTiffStream * Increase scanline buffer for reading gray+alpha and converting to RGBA
5ba34b1fe741d69d43a6c8cf767756997eadd87c
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
main
main( int argc , char ** argv)
['argc', 'argv']
l_int32 main(int argc, char **argv) { L_DEWARP *dew1, *dew2; L_DEWARPA *dewa; PIX *pixs, *pixn, *pixg, *pixb, *pixd, *pixt1, *pixt2; PIX *pixs2, *pixn2, *pixg2, *pixb2, *pixd2; setLeptDebugOK(1); lept_mkdir("lept/model"); /* pixs = pixRead("1555.007.jpg"); */ pixs = pixRead("cat.035.jpg"); /* pixs = pixRead("cat.010.jpg"); */ /* Normalize for varying background and binarize */ pixn = pixBackgroundNormSimple(pixs, NULL, NULL); pixg = pixConvertRGBToGray(pixn, 0.5, 0.3, 0.2); pixb = pixThresholdToBinary(pixg, 130); /* Run the basic functions */ dewa = dewarpaCreate(2, 30, 1, 10, 30); dewarpaUseBothArrays(dewa, 1); dew1 = dewarpCreate(pixb, 35); dewarpaInsertDewarp(dewa, dew1); dewarpBuildPageModel(dew1, "/tmp/lept/model/dewarp_model1.pdf"); dewarpaApplyDisparity(dewa, 35, pixg, 200, 0, 0, &pixd, "/tmp/lept/model/dewarp_apply1.pdf"); /* Write out some of the files to be imaged */ lept_rmdir("lept/dewtest"); lept_mkdir("lept/dewtest"); pixWrite("/tmp/lept/dewtest/001.jpg", pixs, IFF_JFIF_JPEG); pixWrite("/tmp/lept/dewtest/002.jpg", pixn, IFF_JFIF_JPEG); pixWrite("/tmp/lept/dewtest/003.jpg", pixg, IFF_JFIF_JPEG); pixWrite("/tmp/lept/dewtest/004.png", pixb, IFF_TIFF_G4); pixWrite("/tmp/lept/dewtest/005.jpg", pixd, IFF_JFIF_JPEG); pixt1 = pixRead("/tmp/lept/dewmod/0020.png"); pixWrite("/tmp/lept/dewtest/006.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewmod/0030.png"); pixWrite("/tmp/lept/dewtest/007.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewmod/0060.png"); pixWrite("/tmp/lept/dewtest/008.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewmod/0070.png"); pixWrite("/tmp/lept/dewtest/009.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewapply/002.png"); pixWrite("/tmp/lept/dewtest/010.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewapply/003.png"); pixWrite("/tmp/lept/dewtest/011.png", pixt1, IFF_PNG); pixt2 = pixThresholdToBinary(pixt1, 130); pixWrite("/tmp/lept/dewtest/012.png", pixt2, IFF_TIFF_G4); pixDestroy(&pixt1); pixDestroy(&pixt2); pixt1 = pixRead("/tmp/lept/dewmod/0041.png"); pixWrite("/tmp/lept/dewtest/013.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewmod/0042.png"); pixWrite("/tmp/lept/dewtest/014.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewmod/0051.png"); pixWrite("/tmp/lept/dewtest/015.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewmod/0052.png"); pixWrite("/tmp/lept/dewtest/016.png", pixt1, IFF_PNG); pixDestroy(&pixt1); /* Normalize another image, that may not have enough textlines * to build an accurate model */ /* pixs2 = pixRead("1555.003.jpg"); */ pixs2 = pixRead("cat.007.jpg"); /* pixs2 = pixRead("cat.014.jpg"); */ pixn2 = pixBackgroundNormSimple(pixs2, NULL, NULL); pixg2 = pixConvertRGBToGray(pixn2, 0.5, 0.3, 0.2); pixb2 = pixThresholdToBinary(pixg2, 130); /* Apply the previous disparity model to this image */ dew2 = dewarpCreate(pixb2, 7); dewarpaInsertDewarp(dewa, dew2); dewarpaInsertRefModels(dewa, 0, 1); dewarpaInfo(stderr, dewa); dewarpaApplyDisparity(dewa, 7, pixg2, 200, 0, 0, &pixd2, "/tmp/lept/model/dewarp_apply2.pdf"); dewarpaDestroy(&dewa); /* Write out files for the second image */ pixWrite("/tmp/lept/dewtest/017.jpg", pixs2, IFF_JFIF_JPEG); pixWrite("/tmp/lept/dewtest/018.jpg", pixg2, IFF_JFIF_JPEG); pixWrite("/tmp/lept/dewtest/019.png", pixb2, IFF_TIFF_G4); pixWrite("/tmp/lept/dewtest/020.jpg", pixd2, IFF_JFIF_JPEG); pixt1 = pixRead("/tmp/lept/dewmod/0060.png"); pixWrite("/tmp/lept/dewtest/021.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewapply/002.png"); pixWrite("/tmp/lept/dewtest/022.png", pixt1, IFF_PNG); pixt2 = pixThresholdToBinary(pixt1, 130); pixWrite("/tmp/lept/dewtest/023.png", pixt2, IFF_TIFF_G4); pixDestroy(&pixt1); pixDestroy(&pixt2); pixt1 = pixRead("/tmp/lept/dewmod/0070.png"); pixWrite("/tmp/lept/dewtest/024.png", pixt1, IFF_PNG); pixDestroy(&pixt1); pixt1 = pixRead("/tmp/lept/dewapply/003.png"); pixWrite("/tmp/lept/dewtest/025.png", pixt1, IFF_PNG); pixt2 = pixThresholdToBinary(pixt1, 130); pixWrite("/tmp/lept/dewtest/026.png", pixt2, IFF_TIFF_G4); pixDestroy(&pixt1); pixDestroy(&pixt2); /* Generate the big pdf file */ convertFilesToPdf("/tmp/lept/dewtest", NULL, 135, 1.0, 0, 0, "Dewarp Test", "/tmp/lept/dewarptest1.pdf"); lept_stderr("pdf file made: /tmp/lept/model/dewarptest1.pdf\n"); lept_rmdir("lept/dewmod"); lept_rmdir("lept/dewtest"); pixDestroy(&pixs); pixDestroy(&pixn); pixDestroy(&pixg); pixDestroy(&pixb); pixDestroy(&pixd); pixDestroy(&pixs2); pixDestroy(&pixn2); pixDestroy(&pixg2); pixDestroy(&pixb2); pixDestroy(&pixd2); return 0; }
855
True
1
CVE-2020-36280
False
False
False
False
AV:N/AC:L/Au:N/C:N/I:N/A:P
NETWORK
LOW
NONE
NONE
NONE
PARTIAL
5.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
NONE
NONE
HIGH
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'name': 'https://github.com/DanBloomberg/leptonica/compare/1.79.0...1.80.0', 'refsource': 'MISC', 'tags': ['Patch', 'Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/DanBloomberg/leptonica/commit/5ba34b1fe741d69d43a6c8cf767756997eadd87c', 'name': 'https://github.com/DanBloomberg/leptonica/commit/5ba34b1fe741d69d43a6c8cf767756997eadd87c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23654', 'name': 'https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23654', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/JQUEA2X6UTH4DMYCMZAWE2QQLN5YANUA/', 'name': 'FEDORA-2021-f5f2803fff', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RD5AIWHWE334HGYZJR2U3I3JYKSSO2LW/', 'name': 'FEDORA-2021-977ebc82da', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202107-53', 'name': 'GLSA-202107-53', 'refsource': 'GENTOO', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:leptonica:leptonica:*:*:*:*:*:*:*:*', 'versionEndExcluding': '1.80.0', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Leptonica before 1.80.0 allows a heap-based buffer over-read in pixReadFromTiffStream, related to tiffio.c.'}]
2021-12-03T17:38Z
2021-03-12T00:15Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Dan Bloomberg
2020-06-22 23:02:43-07:00
Issue 23654 in oss-fuzz: Heap-buffer-overflow in pixReadFromTiffStream * Increase scanline buffer for reading gray+alpha and converting to RGBA
5ba34b1fe741d69d43a6c8cf767756997eadd87c
False
DanBloomberg/leptonica
Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation and recent releases.
2016-01-13 17:20:02
2022-08-24 19:14:56
DanBloomberg
1265.0
344.0
pixReadFromTiffStream
pixReadFromTiffStream( TIFF * tif)
['tif']
pixReadFromTiffStream(TIFF *tif) { char *text; l_uint8 *linebuf, *data, *rowptr; l_uint16 spp, bps, photometry, tiffcomp, orientation, sample_fmt; l_uint16 *redmap, *greenmap, *bluemap; l_int32 d, wpl, bpl, comptype, i, j, k, ncolors, rval, gval, bval, aval; l_int32 xres, yres, tiffbpl, packedbpl, halfsize; l_uint32 w, h, tiffword, read_oriented; l_uint32 *line, *ppixel, *tiffdata, *pixdata; PIX *pix, *pix1; PIXCMAP *cmap; PROCNAME("pixReadFromTiffStream"); if (!tif) return (PIX *)ERROR_PTR("tif not defined", procName, NULL); read_oriented = 0; /* Only accept uint image data: * SAMPLEFORMAT_UINT = 1; * SAMPLEFORMAT_INT = 2; * SAMPLEFORMAT_IEEEFP = 3; * SAMPLEFORMAT_VOID = 4; */ TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLEFORMAT, &sample_fmt); if (sample_fmt != SAMPLEFORMAT_UINT) { L_ERROR("sample format = %d is not uint\n", procName, sample_fmt); return NULL; } /* Can't read tiff in tiled format. For what is involved, see, e.g: * https://www.cs.rochester.edu/~nelson/courses/vision/\ * resources/tiff/libtiff.html#Tiles * A tiled tiff can be converted to a normal (strip) tif: * tiffcp -s <input-tiled-tif> <output-strip-tif> */ if (TIFFIsTiled(tif)) { L_ERROR("tiled format is not supported\n", procName); return NULL; } /* Old style jpeg is not supported. We tried supporting 8 bpp. * TIFFReadScanline() fails on this format, so we used RGBA * reading, which generates a 4 spp image, and pulled out the * red component. However, there were problems with double-frees * in cleanup. For RGB, tiffbpl is exactly half the size that * you would expect for the raster data in a scanline, which * is 3 * w. */ TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &tiffcomp); if (tiffcomp == COMPRESSION_OJPEG) { L_ERROR("old style jpeg format is not supported\n", procName); return NULL; } /* Use default fields for bps and spp */ TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &bps); TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp); if (bps != 1 && bps != 2 && bps != 4 && bps != 8 && bps != 16) { L_ERROR("invalid bps = %d\n", procName, bps); return NULL; } if (spp == 2 && bps != 8) { L_WARNING("for 2 spp, only handle 8 bps\n", procName); return NULL; } if (spp == 1) d = bps; else if (spp == 2) /* gray plus alpha */ d = 32; /* will convert to RGBA */ else if (spp == 3 || spp == 4) d = 32; else return (PIX *)ERROR_PTR("spp not in set {1,2,3,4}", procName, NULL); TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); if (w > MaxTiffWidth) { L_ERROR("width = %d pixels; too large\n", procName, w); return NULL; } if (h > MaxTiffHeight) { L_ERROR("height = %d pixels; too large\n", procName, h); return NULL; } /* The relation between the size of a byte buffer required to hold a raster of image pixels (packedbpl) and the size of the tiff buffer (tiffbuf) is either 1:1 or approximately 2:1, depending on how the data is stored and subsampled. Allow some slop when validating the relation between buffer size and the image parameters w, spp and bps. */ tiffbpl = TIFFScanlineSize(tif); packedbpl = (bps * spp * w + 7) / 8; halfsize = L_ABS(2 * tiffbpl - packedbpl) <= 8; #if 0 if (halfsize) L_INFO("packedbpl = %d is approx. twice tiffbpl = %d\n", procName, packedbpl, tiffbpl); #endif if (tiffbpl != packedbpl && !halfsize) { L_ERROR("invalid tiffbpl: tiffbpl = %d, packedbpl = %d, " "bps = %d, spp = %d, w = %d\n", procName, tiffbpl, packedbpl, bps, spp, w); return NULL; } if ((pix = pixCreate(w, h, d)) == NULL) return (PIX *)ERROR_PTR("pix not made", procName, NULL); pixSetInputFormat(pix, IFF_TIFF); data = (l_uint8 *)pixGetData(pix); wpl = pixGetWpl(pix); bpl = 4 * wpl; if (spp == 1) { linebuf = (l_uint8 *)LEPT_CALLOC(tiffbpl + 1, sizeof(l_uint8)); for (i = 0; i < h; i++) { if (TIFFReadScanline(tif, linebuf, i, 0) < 0) { LEPT_FREE(linebuf); pixDestroy(&pix); return (PIX *)ERROR_PTR("line read fail", procName, NULL); } memcpy(data, linebuf, tiffbpl); data += bpl; } if (bps <= 8) pixEndianByteSwap(pix); else /* bps == 16 */ pixEndianTwoByteSwap(pix); LEPT_FREE(linebuf); } else if (spp == 2 && bps == 8) { /* gray plus alpha */ L_INFO("gray+alpha is not supported; converting to RGBA\n", procName); pixSetSpp(pix, 4); linebuf = (l_uint8 *)LEPT_CALLOC(tiffbpl + 1, sizeof(l_uint8)); pixdata = pixGetData(pix); for (i = 0; i < h; i++) { if (TIFFReadScanline(tif, linebuf, i, 0) < 0) { LEPT_FREE(linebuf); pixDestroy(&pix); return (PIX *)ERROR_PTR("line read fail", procName, NULL); } rowptr = linebuf; ppixel = pixdata + i * wpl; for (j = k = 0; j < w; j++) { /* Copy gray value into r, g and b */ SET_DATA_BYTE(ppixel, COLOR_RED, rowptr[k]); SET_DATA_BYTE(ppixel, COLOR_GREEN, rowptr[k]); SET_DATA_BYTE(ppixel, COLOR_BLUE, rowptr[k++]); SET_DATA_BYTE(ppixel, L_ALPHA_CHANNEL, rowptr[k++]); ppixel++; } } LEPT_FREE(linebuf); } else { /* rgb and rgba */ if ((tiffdata = (l_uint32 *)LEPT_CALLOC((size_t)w * h, sizeof(l_uint32))) == NULL) { pixDestroy(&pix); return (PIX *)ERROR_PTR("calloc fail for tiffdata", procName, NULL); } /* TIFFReadRGBAImageOriented() converts to 8 bps */ if (!TIFFReadRGBAImageOriented(tif, w, h, tiffdata, ORIENTATION_TOPLEFT, 0)) { LEPT_FREE(tiffdata); pixDestroy(&pix); return (PIX *)ERROR_PTR("failed to read tiffdata", procName, NULL); } else { read_oriented = 1; } if (spp == 4) pixSetSpp(pix, 4); line = pixGetData(pix); for (i = 0; i < h; i++, line += wpl) { for (j = 0, ppixel = line; j < w; j++) { /* TIFFGet* are macros */ tiffword = tiffdata[i * w + j]; rval = TIFFGetR(tiffword); gval = TIFFGetG(tiffword); bval = TIFFGetB(tiffword); if (spp == 3) { composeRGBPixel(rval, gval, bval, ppixel); } else { /* spp == 4 */ aval = TIFFGetA(tiffword); composeRGBAPixel(rval, gval, bval, aval, ppixel); } ppixel++; } } LEPT_FREE(tiffdata); } if (getTiffStreamResolution(tif, &xres, &yres) == 0) { pixSetXRes(pix, xres); pixSetYRes(pix, yres); } /* Find and save the compression type */ comptype = getTiffCompressedFormat(tiffcomp); pixSetInputFormat(pix, comptype); if (TIFFGetField(tif, TIFFTAG_COLORMAP, &redmap, &greenmap, &bluemap)) { /* Save the colormap as a pix cmap. Because the * tiff colormap components are 16 bit unsigned, * and go from black (0) to white (0xffff), the * the pix cmap takes the most significant byte. */ if (bps > 8) { pixDestroy(&pix); return (PIX *)ERROR_PTR("colormap size > 256", procName, NULL); } if ((cmap = pixcmapCreate(bps)) == NULL) { pixDestroy(&pix); return (PIX *)ERROR_PTR("colormap not made", procName, NULL); } ncolors = 1 << bps; for (i = 0; i < ncolors; i++) pixcmapAddColor(cmap, redmap[i] >> 8, greenmap[i] >> 8, bluemap[i] >> 8); if (pixSetColormap(pix, cmap)) { pixDestroy(&pix); return (PIX *)ERROR_PTR("invalid colormap", procName, NULL); } /* Remove the colormap for 1 bpp. */ if (bps == 1) { pix1 = pixRemoveColormap(pix, REMOVE_CMAP_BASED_ON_SRC); pixDestroy(&pix); pix = pix1; } } else { /* No colormap: check photometry and invert if necessary */ if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometry)) { /* Guess default photometry setting. Assume min_is_white * if compressed 1 bpp; min_is_black otherwise. */ if (tiffcomp == COMPRESSION_CCITTFAX3 || tiffcomp == COMPRESSION_CCITTFAX4 || tiffcomp == COMPRESSION_CCITTRLE || tiffcomp == COMPRESSION_CCITTRLEW) { photometry = PHOTOMETRIC_MINISWHITE; } else { photometry = PHOTOMETRIC_MINISBLACK; } } if ((d == 1 && photometry == PHOTOMETRIC_MINISBLACK) || (d == 8 && photometry == PHOTOMETRIC_MINISWHITE)) pixInvert(pix, pix); } if (TIFFGetField(tif, TIFFTAG_ORIENTATION, &orientation)) { if (orientation >= 1 && orientation <= 8) { struct tiff_transform *transform = (read_oriented) ? &tiff_partial_orientation_transforms[orientation - 1] : &tiff_orientation_transforms[orientation - 1]; if (transform->vflip) pixFlipTB(pix, pix); if (transform->hflip) pixFlipLR(pix, pix); if (transform->rotate) { PIX *oldpix = pix; pix = pixRotate90(oldpix, transform->rotate); pixDestroy(&oldpix); } } } text = NULL; TIFFGetField(tif, TIFFTAG_IMAGEDESCRIPTION, &text); if (text) pixSetText(pix, text); return pix; }
1558
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
SQLSetDescField
SQLSetDescField( SQLHDESC descriptor_handle , SQLSMALLINT rec_number , SQLSMALLINT field_identifier , SQLPOINTER value , SQLINTEGER buffer_length)
['descriptor_handle', 'rec_number', 'field_identifier', 'value', 'buffer_length']
SQLRETURN SQLSetDescField( SQLHDESC descriptor_handle, SQLSMALLINT rec_number, SQLSMALLINT field_identifier, SQLPOINTER value, SQLINTEGER buffer_length ) { /* * not quite sure how the descriptor can be * allocated to a statement, all the documentation talks * about state transitions on statement states, but the * descriptor may be allocated with more than one statement * at one time. Which one should I check ? */ DMHDESC descriptor = (DMHDESC) descriptor_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; int isStrField = 0; /* * check descriptor */ if ( !__validate_desc( descriptor )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( descriptor ); if ( log_info.log_flag ) { sprintf( descriptor -> msg, "\n\t\tEntry:\ \n\t\t\tDescriptor = %p\ \n\t\t\tRec Number = %d\ \n\t\t\tField Ident = %s\ \n\t\t\tValue = %p\ \n\t\t\tBuffer Length = %d", descriptor, rec_number, __desc_attr_as_string( s1, field_identifier ), value, (int)buffer_length ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } thread_protect( SQL_HANDLE_DESC, descriptor ); if ( descriptor -> connection -> state < STATE_C4 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } /* * check status of statements associated with this descriptor */ if( __check_stmt_from_desc( descriptor, STATE_S8 ) || __check_stmt_from_desc( descriptor, STATE_S9 ) || __check_stmt_from_desc( descriptor, STATE_S10 ) || __check_stmt_from_desc( descriptor, STATE_S11 ) || __check_stmt_from_desc( descriptor, STATE_S12 ) || __check_stmt_from_desc( descriptor, STATE_S13 ) || __check_stmt_from_desc( descriptor, STATE_S14 ) || __check_stmt_from_desc( descriptor, STATE_S15 )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( rec_number < 0 ) { __post_internal_error( &descriptor -> error, ERROR_07009, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } switch ( field_identifier ) { /* Fixed-length fields: buffer_length is ignored */ case SQL_DESC_ALLOC_TYPE: case SQL_DESC_ARRAY_SIZE: case SQL_DESC_ARRAY_STATUS_PTR: case SQL_DESC_BIND_OFFSET_PTR: case SQL_DESC_BIND_TYPE: case SQL_DESC_COUNT: case SQL_DESC_ROWS_PROCESSED_PTR: case SQL_DESC_AUTO_UNIQUE_VALUE: case SQL_DESC_CASE_SENSITIVE: case SQL_DESC_CONCISE_TYPE: case SQL_DESC_DATA_PTR: case SQL_DESC_DATETIME_INTERVAL_CODE: case SQL_DESC_DATETIME_INTERVAL_PRECISION: case SQL_DESC_DISPLAY_SIZE: case SQL_DESC_FIXED_PREC_SCALE: case SQL_DESC_INDICATOR_PTR: case SQL_DESC_LENGTH: case SQL_DESC_NULLABLE: case SQL_DESC_NUM_PREC_RADIX: case SQL_DESC_OCTET_LENGTH: case SQL_DESC_OCTET_LENGTH_PTR: case SQL_DESC_PARAMETER_TYPE: case SQL_DESC_PRECISION: case SQL_DESC_ROWVER: case SQL_DESC_SCALE: case SQL_DESC_SEARCHABLE: case SQL_DESC_TYPE: case SQL_DESC_UNNAMED: case SQL_DESC_UNSIGNED: case SQL_DESC_UPDATABLE: isStrField = 0; break; /* Pointer to data: buffer_length must be valid */ case SQL_DESC_BASE_COLUMN_NAME: case SQL_DESC_BASE_TABLE_NAME: case SQL_DESC_CATALOG_NAME: case SQL_DESC_LABEL: case SQL_DESC_LITERAL_PREFIX: case SQL_DESC_LITERAL_SUFFIX: case SQL_DESC_LOCAL_TYPE_NAME: case SQL_DESC_NAME: case SQL_DESC_SCHEMA_NAME: case SQL_DESC_TABLE_NAME: case SQL_DESC_TYPE_NAME: isStrField = 1; break; default: isStrField = buffer_length != SQL_IS_POINTER && buffer_length != SQL_IS_INTEGER && buffer_length != SQL_IS_UINTEGER && buffer_length != SQL_IS_SMALLINT && buffer_length != SQL_IS_USMALLINT; } if ( isStrField && buffer_length < 0 && buffer_length != SQL_NTS) { __post_internal_error( &descriptor -> error, ERROR_HY090, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( field_identifier == SQL_DESC_COUNT && (SQLINTEGER)value < 0 ) { __post_internal_error( &descriptor -> error, ERROR_07009, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( field_identifier == SQL_DESC_PARAMETER_TYPE && value != SQL_PARAM_INPUT && value != SQL_PARAM_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT_STREAM && value != SQL_PARAM_OUTPUT_STREAM ) { __post_internal_error( &descriptor -> error, ERROR_HY105, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( CHECK_SQLSETDESCFIELD( descriptor -> connection )) { ret = SQLSETDESCFIELD( descriptor -> connection, descriptor -> driver_desc, rec_number, field_identifier, value, buffer_length ); } else if ( CHECK_SQLSETDESCFIELDW( descriptor -> connection )) { SQLWCHAR *s1 = NULL; if (isStrField) { s1 = ansi_to_unicode_alloc( value, buffer_length, descriptor -> connection, NULL ); if (SQL_NTS != buffer_length) { buffer_length *= sizeof(SQLWCHAR); } } else { s1 = value; } ret = SQLSETDESCFIELDW( descriptor -> connection, descriptor -> driver_desc, rec_number, field_identifier, s1, buffer_length ); if (isStrField) { if (s1) free(s1); } } else { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &descriptor -> error, ERROR_IM001, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( log_info.log_flag ) { sprintf( descriptor -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s1 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } return function_return( SQL_HANDLE_DESC, descriptor, ret ); }
864
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
SQLSetDescFieldW
SQLSetDescFieldW( SQLHDESC descriptor_handle , SQLSMALLINT rec_number , SQLSMALLINT field_identifier , SQLPOINTER value , SQLINTEGER buffer_length)
['descriptor_handle', 'rec_number', 'field_identifier', 'value', 'buffer_length']
SQLRETURN SQLSetDescFieldW( SQLHDESC descriptor_handle, SQLSMALLINT rec_number, SQLSMALLINT field_identifier, SQLPOINTER value, SQLINTEGER buffer_length ) { /* * not quite sure how the descriptor can be * allocated to a statement, all the documentation talks * about state transitions on statement states, but the * descriptor may be allocated with more than one statement * at one time. Which one should I check ? */ DMHDESC descriptor = (DMHDESC) descriptor_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; int isStrField = 0; /* * check descriptor */ if ( !__validate_desc( descriptor )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHDESC parent_desc; parent_desc = find_parent_handle( descriptor, SQL_HANDLE_DESC ); if ( parent_desc ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLSETDESCFIELDW( parent_desc -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLSETDESCFIELDW( parent_desc -> connection, descriptor, rec_number, field_identifier, value, buffer_length ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( descriptor ); if ( log_info.log_flag ) { sprintf( descriptor -> msg, "\n\t\tEntry:\ \n\t\t\tDescriptor = %p\ \n\t\t\tRec Number = %d\ \n\t\t\tField Ident = %s\ \n\t\t\tValue = %p\ \n\t\t\tBuffer Length = %d", descriptor, rec_number, __desc_attr_as_string( s1, field_identifier ), value, (int)buffer_length ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } thread_protect( SQL_HANDLE_DESC, descriptor ); if ( descriptor -> connection -> state < STATE_C4 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } /* * check status of statements associated with this descriptor */ if( __check_stmt_from_desc( descriptor, STATE_S8 ) || __check_stmt_from_desc( descriptor, STATE_S9 ) || __check_stmt_from_desc( descriptor, STATE_S10 ) || __check_stmt_from_desc( descriptor, STATE_S11 ) || __check_stmt_from_desc( descriptor, STATE_S12 ) || __check_stmt_from_desc( descriptor, STATE_S13 ) || __check_stmt_from_desc( descriptor, STATE_S14 ) || __check_stmt_from_desc( descriptor, STATE_S15 )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( rec_number < 0 ) { __post_internal_error( &descriptor -> error, ERROR_07009, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } switch ( field_identifier ) { /* Fixed-length fields: buffer_length is ignored */ case SQL_DESC_ALLOC_TYPE: case SQL_DESC_ARRAY_SIZE: case SQL_DESC_ARRAY_STATUS_PTR: case SQL_DESC_BIND_OFFSET_PTR: case SQL_DESC_BIND_TYPE: case SQL_DESC_COUNT: case SQL_DESC_ROWS_PROCESSED_PTR: case SQL_DESC_AUTO_UNIQUE_VALUE: case SQL_DESC_CASE_SENSITIVE: case SQL_DESC_CONCISE_TYPE: case SQL_DESC_DATA_PTR: case SQL_DESC_DATETIME_INTERVAL_CODE: case SQL_DESC_DATETIME_INTERVAL_PRECISION: case SQL_DESC_DISPLAY_SIZE: case SQL_DESC_FIXED_PREC_SCALE: case SQL_DESC_INDICATOR_PTR: case SQL_DESC_LENGTH: case SQL_DESC_NULLABLE: case SQL_DESC_NUM_PREC_RADIX: case SQL_DESC_OCTET_LENGTH: case SQL_DESC_OCTET_LENGTH_PTR: case SQL_DESC_PARAMETER_TYPE: case SQL_DESC_PRECISION: case SQL_DESC_ROWVER: case SQL_DESC_SCALE: case SQL_DESC_SEARCHABLE: case SQL_DESC_TYPE: case SQL_DESC_UNNAMED: case SQL_DESC_UNSIGNED: case SQL_DESC_UPDATABLE: isStrField = 0; break; /* Pointer to data: buffer_length must be valid */ case SQL_DESC_BASE_COLUMN_NAME: case SQL_DESC_BASE_TABLE_NAME: case SQL_DESC_CATALOG_NAME: case SQL_DESC_LABEL: case SQL_DESC_LITERAL_PREFIX: case SQL_DESC_LITERAL_SUFFIX: case SQL_DESC_LOCAL_TYPE_NAME: case SQL_DESC_NAME: case SQL_DESC_SCHEMA_NAME: case SQL_DESC_TABLE_NAME: case SQL_DESC_TYPE_NAME: isStrField = 1; break; default: isStrField = buffer_length != SQL_IS_POINTER && buffer_length != SQL_IS_INTEGER && buffer_length != SQL_IS_UINTEGER && buffer_length != SQL_IS_SMALLINT && buffer_length != SQL_IS_USMALLINT; } if ( isStrField && buffer_length < 0 && buffer_length != SQL_NTS) { __post_internal_error( &descriptor -> error, ERROR_HY090, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( field_identifier == SQL_DESC_COUNT && (SQLINTEGER)value < 0 ) { __post_internal_error( &descriptor -> error, ERROR_07009, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( field_identifier == SQL_DESC_PARAMETER_TYPE && value != SQL_PARAM_INPUT && value != SQL_PARAM_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT_STREAM && value != SQL_PARAM_OUTPUT_STREAM ) { __post_internal_error( &descriptor -> error, ERROR_HY105, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( descriptor -> connection -> unicode_driver || CHECK_SQLSETDESCFIELDW( descriptor -> connection )) { if ( !CHECK_SQLSETDESCFIELDW( descriptor -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &descriptor -> error, ERROR_IM001, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } ret = SQLSETDESCFIELDW( descriptor -> connection, descriptor -> driver_desc, rec_number, field_identifier, value, buffer_length ); if ( log_info.log_flag ) { sprintf( descriptor -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s1 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } } else { SQLCHAR *ascii_str = NULL; if ( !CHECK_SQLSETDESCFIELD( descriptor -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &descriptor -> error, ERROR_IM001, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } /* * is it a char arg... */ switch ( field_identifier ) { case SQL_DESC_NAME: /* This is the only R/W SQLCHAR* type */ ascii_str = (SQLCHAR*) unicode_to_ansi_alloc( value, buffer_length, descriptor -> connection, NULL ); value = ascii_str; buffer_length = strlen((char*) ascii_str ); break; default: break; } ret = SQLSETDESCFIELD( descriptor -> connection, descriptor -> driver_desc, rec_number, field_identifier, value, buffer_length ); if ( log_info.log_flag ) { sprintf( descriptor -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s1 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } if ( ascii_str ) { free( ascii_str ); } } return function_return( SQL_HANDLE_DESC, descriptor, ret ); }
1040
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
ExecuteSQL
ExecuteSQL( SQLHDBC hDbc , char * szSQL , char cDelimiter , int bColumnNames , int bHTMLTable)
['hDbc', 'szSQL', 'cDelimiter', 'bColumnNames', 'bHTMLTable']
static int ExecuteSQL( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int bHTMLTable ) { SQLHSTMT hStmt; SQLTCHAR szSepLine[32001]; SQLTCHAR szUcSQL[32001]; SQLSMALLINT cols; SQLINTEGER ret; SQLLEN nRows = 0; szSepLine[ 0 ] = 0; ansi_to_unicode( szSQL, szUcSQL ); /**************************** * EXECUTE SQL ***************************/ if ( SQLAllocStmt( hDbc, &hStmt ) != SQL_SUCCESS ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, 0 ); fprintf( stderr, "[ISQL]ERROR: Could not SQLAllocStmt\n" ); return 0; } if ( buseED ) { ret = SQLExecDirect( hStmt, szUcSQL, SQL_NTS ); if ( ret == SQL_NO_DATA ) { fprintf( stderr, "[ISQL]INFO: SQLExecDirect returned SQL_NO_DATA\n" ); } else if ( ret == SQL_SUCCESS_WITH_INFO ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt ); fprintf( stderr, "[ISQL]INFO: SQLExecDirect returned SQL_SUCCESS_WITH_INFO\n" ); } else if ( ret != SQL_SUCCESS ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt ); fprintf( stderr, "[ISQL]ERROR: Could not SQLExecDirect\n" ); SQLFreeStmt( hStmt, SQL_DROP ); free(szSepLine); return 0; } } else { if ( SQLPrepare( hStmt, szUcSQL, SQL_NTS ) != SQL_SUCCESS ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt ); fprintf( stderr, "[ISQL]ERROR: Could not SQLPrepare\n" ); SQLFreeStmt( hStmt, SQL_DROP ); return 0; } ret = SQLExecute( hStmt ); if ( ret == SQL_NO_DATA ) { fprintf( stderr, "[ISQL]INFO: SQLExecute returned SQL_NO_DATA\n" ); } else if ( ret == SQL_SUCCESS_WITH_INFO ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt ); fprintf( stderr, "[ISQL]INFO: SQLExecute returned SQL_SUCCESS_WITH_INFO\n" ); } else if ( ret != SQL_SUCCESS ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt ); fprintf( stderr, "[ISQL]ERROR: Could not SQLExecute\n" ); SQLFreeStmt( hStmt, SQL_DROP ); return 0; } } do { /* * check to see if it has generated a result set */ if ( SQLNumResultCols( hStmt, &cols ) != SQL_SUCCESS ) { if ( bVerbose ) DumpODBCLog( hEnv, hDbc, hStmt ); fprintf( stderr, "[ISQL]ERROR: Could not SQLNumResultCols\n" ); SQLFreeStmt( hStmt, SQL_DROP ); return 0; } if ( cols > 0 ) { /**************************** * WRITE HEADER ***************************/ if ( bHTMLTable ) WriteHeaderHTMLTable( hStmt ); else if ( cDelimiter == 0 ) UWriteHeaderNormal( hStmt, szSepLine ); else if ( cDelimiter && bColumnNames ) WriteHeaderDelimited( hStmt, cDelimiter ); /**************************** * WRITE BODY ***************************/ if ( bHTMLTable ) WriteBodyHTMLTable( hStmt ); else if ( cDelimiter == 0 ) nRows = WriteBodyNormal( hStmt ); else WriteBodyDelimited( hStmt, cDelimiter ); } /**************************** * WRITE FOOTER ***************************/ if ( bHTMLTable ) WriteFooterHTMLTable( hStmt ); else if ( cDelimiter == 0 ) UWriteFooterNormal( hStmt, szSepLine, nRows ); } while ( SQL_SUCCEEDED( SQLMoreResults( hStmt ))); /**************************** * CLEANUP ***************************/ SQLFreeStmt( hStmt, SQL_DROP ); return 1; }
509
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
_multi_string_alloc_and_copy
_multi_string_alloc_and_copy( LPCWSTR in)
['in']
char* _multi_string_alloc_and_copy( LPCWSTR in ) { char *chr; int len = 0; if ( !in ) { return in; } while ( in[ len ] != 0 || in[ len + 1 ] != 0 ) { len ++; } chr = malloc( len + 2 ); len = 0; while ( in[ len ] != 0 || in[ len + 1 ] != 0 ) { chr[ len ] = 0xFF & in[ len ]; len ++; } chr[ len ++ ] = '\0'; chr[ len ++ ] = '\0'; return chr; }
116
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
_multi_string_alloc_and_expand
_multi_string_alloc_and_expand( LPCSTR in)
['in']
SQLWCHAR* _multi_string_alloc_and_expand( LPCSTR in ) { SQLWCHAR *chr; int len = 0; if ( !in ) { return in; } while ( in[ len ] != 0 || in[ len + 1 ] != 0 ) { len ++; } chr = malloc(sizeof( SQLWCHAR ) * ( len + 2 )); len = 0; while ( in[ len ] != 0 || in[ len + 1 ] != 0 ) { chr[ len ] = in[ len ]; len ++; } chr[ len ++ ] = 0; chr[ len ++ ] = 0; return chr; }
121
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
_single_string_alloc_and_copy
_single_string_alloc_and_copy( LPCWSTR in)
['in']
char* _single_string_alloc_and_copy( LPCWSTR in ) { char *chr; int len = 0; if ( !in ) { return in; } while ( in[ len ] != 0 ) { len ++; } chr = malloc( len + 1 ); len = 0; while ( in[ len ] != 0 ) { chr[ len ] = 0xFF & in[ len ]; len ++; } chr[ len ++ ] = '\0'; return chr; }
90
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
_single_string_alloc_and_expand
_single_string_alloc_and_expand( LPCSTR in)
['in']
SQLWCHAR* _single_string_alloc_and_expand( LPCSTR in ) { SQLWCHAR *chr; int len = 0; if ( !in ) { return in; } while ( in[ len ] != 0 ) { len ++; } chr = malloc( sizeof( SQLWCHAR ) * ( len + 1 )); len = 0; while ( in[ len ] != 0 ) { chr[ len ] = in[ len ]; len ++; } chr[ len ++ ] = 0; return chr; }
95
True
1
CVE-2018-7485
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
nan
[{'url': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'name': 'https://github.com/lurcher/unixODBC/commit/45ef78e037f578b15fc58938a3a3251655e71d6f#diff-d52750c7ba4e594410438569d8e2963aL24', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'http://www.securityfocus.com/bid/103193', 'name': '103193', 'refsource': 'BID', 'tags': ['Third Party Advisory', 'VDB Entry']}, {'url': 'https://access.redhat.com/errata/RHSA-2019:2336', 'name': 'RHSA-2019:2336', 'refsource': 'REDHAT', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:unixodbc:unixodbc:2.3.5:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'The SQLWriteFileDSN function in odbcinst/SQLWriteFileDSN.c in unixODBC 2.3.5 has strncpy arguments in the wrong order, which allows attackers to cause a denial of service or possibly have unspecified other impact.'}]
2019-08-06T15:15Z
2018-02-26T14:29Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Nick Gorham
2018-01-08 11:12:39+00:00
New Pre Source
45ef78e037f578b15fc58938a3a3251655e71d6f
False
lurcher/unixODBC
The unixODBC Project goals are to develop and promote unixODBC to be the definitive standard for ODBC on non MS Windows platforms.
2017-07-03 13:37:54
2022-07-12 07:28:26
null
lurcher
45.0
29.0
SQLWriteFileDSN
SQLWriteFileDSN( LPCSTR pszFileName , LPCSTR pszAppName , LPCSTR pszKeyName , LPCSTR pszString)
['pszFileName', 'pszAppName', 'pszKeyName', 'pszString']
BOOL SQLWriteFileDSN( LPCSTR pszFileName, LPCSTR pszAppName, LPCSTR pszKeyName, LPCSTR pszString ) { HINI hIni; char szFileName[ODBC_FILENAME_MAX+1]; if ( pszFileName[0] == '/' ) { strncpy( szFileName, sizeof(szFileName) - 5, pszFileName ); } else { char szPath[ODBC_FILENAME_MAX+1]; *szPath = '\0'; _odbcinst_FileINI( szPath ); snprintf( szFileName, sizeof(szFileName) - 5, "%s/%s", szPath, pszFileName ); } if ( strlen( szFileName ) < 4 || strcmp( szFileName + strlen( szFileName ) - 4, ".dsn" )) { strcat( szFileName, ".dsn" ); } #ifdef __OS2__ if ( iniOpen( &hIni, szFileName, "#;", '[', ']', '=', TRUE, 0L ) != INI_SUCCESS ) #else if ( iniOpen( &hIni, szFileName, "#;", '[', ']', '=', TRUE ) != INI_SUCCESS ) #endif { inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_INVALID_PATH, "" ); return FALSE; } /* delete section */ if ( pszString == NULL && pszKeyName == NULL ) { if ( iniObjectSeek( hIni, (char *)pszAppName ) == INI_SUCCESS ) { iniObjectDelete( hIni ); } } /* delete entry */ else if ( pszString == NULL ) { if ( iniPropertySeek( hIni, (char *)pszAppName, (char *)pszKeyName, "" ) == INI_SUCCESS ) { iniPropertyDelete( hIni ); } } else { /* add section */ if ( iniObjectSeek( hIni, (char *)pszAppName ) != INI_SUCCESS ) { iniObjectInsert( hIni, (char *)pszAppName ); } /* update entry */ if ( iniPropertySeek( hIni, (char *)pszAppName, (char *)pszKeyName, "" ) == INI_SUCCESS ) { iniObjectSeek( hIni, (char *)pszAppName ); iniPropertyUpdate( hIni, (char *)pszKeyName, (char *)pszString ); } /* add entry */ else { iniObjectSeek( hIni, (char *)pszAppName ); iniPropertyInsert( hIni, (char *)pszKeyName, (char *)pszString ); } } if ( iniCommit( hIni ) != INI_SUCCESS ) { iniClose( hIni ); inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_REQUEST_FAILED, "" ); return FALSE; } iniClose( hIni ); return TRUE; }
419
True
1
CVE-2018-7998
False
False
False
True
AV:N/AC:H/Au:N/C:P/I:P/A:P
NETWORK
HIGH
NONE
PARTIAL
PARTIAL
PARTIAL
5.1
CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
HIGH
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
7.5
HIGH
1.6
5.9
nan
[{'url': 'https://github.com/jcupitt/libvips/issues/893', 'name': 'https://github.com/jcupitt/libvips/issues/893', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/jcupitt/libvips/commit/20d840e6da15c1574b3ed998bc92f91d1e36c2a5', 'name': 'https://github.com/jcupitt/libvips/commit/20d840e6da15c1574b3ed998bc92f91d1e36c2a5', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00009.html', 'name': '[debian-lts-announce] 20180311 [SECURITY] [DLA 1306-1] vips security update', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-362'}, {'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:libvips_project:libvips:*:*:*:*:*:*:*:*', 'versionEndExcluding': '8.6.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libvips before 8.6.3, a NULL function pointer dereference vulnerability was found in the vips_region_generate function in region.c, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via a crafted image file. This occurs because of a race condition involving a failed delayed load and other worker threads.'}]
2018-03-27T16:34Z
2018-03-09T19:29Z
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
The program contains a code sequence that can run concurrently with other code, and the code sequence requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence that is operating concurrently.
This can have security implications when the expected synchronization is in security-critical code, such as recording whether a user is authenticated or modifying important state information that should not be influenced by an outsider. A race condition occurs within concurrent environments, and is effectively a property of a code sequence. Depending on the context, a code sequence may be in the form of a function call, a small number of instructions, a series of program invocations, etc. A race condition violates these properties, which are closely related: Exclusivity - the code sequence is given exclusive access to the shared resource, i.e., no other code sequence can modify properties of the shared resource before the original sequence has completed execution. Atomicity - the code sequence is behaviorally atomic, i.e., no other thread or process can concurrently execute the same sequence of instructions (or a subset) against the same resource. A race condition exists when an "interfering code sequence" can still access the shared resource, violating exclusivity. Programmers may assume that certain code sequences execute too quickly to be affected by an interfering code sequence; when they are not, this violates atomicity. For example, the single "x++" statement may appear atomic at the code layer, but it is actually non-atomic at the instruction layer, since it involves a read (the original value of x), followed by a computation (x+1), followed by a write (save the result to x). The interfering code sequence could be "trusted" or "untrusted." A trusted interfering code sequence occurs within the program; it cannot be modified by the attacker, and it can only be invoked indirectly. An untrusted interfering code sequence can be authored directly by the attacker, and typically it is external to the vulnerable program.
https://cwe.mitre.org/data/definitions/362.html
0
John Cupitt
2018-03-05 14:42:09+00:00
fix a crash with delayed load If a delayed load failed, it could leave the pipeline only half-set up. Sebsequent threads could then segv. Set a load-has-failed flag and test before generate. See https://github.com/jcupitt/libvips/issues/893
20d840e6da15c1574b3ed998bc92f91d1e36c2a5
False
jcupitt/libvips
A fast image processing library with low memory needs.
2021-07-16 11:11:06
2021-09-22 09:59:01
https://libvips.github.io/libvips/
jcupitt
23.0
5.0
vips_foreign_load_start
vips_foreign_load_start( VipsImage * out , void * a , void * b)
['out', 'a', 'b']
vips_foreign_load_start( VipsImage *out, void *a, void *b ) { VipsForeignLoad *load = VIPS_FOREIGN_LOAD( b ); VipsForeignLoadClass *class = VIPS_FOREIGN_LOAD_GET_CLASS( load ); if( !load->real ) { if( !(load->real = vips_foreign_load_temp( load )) ) return( NULL ); #ifdef DEBUG printf( "vips_foreign_load_start: triggering ->load()\n" ); #endif /*DEBUG*/ /* Read the image in. This may involve a long computation and * will finish with load->real holding the decompressed image. * * We want our caller to be able to see this computation on * @out, so eval signals on ->real need to appear on ->out. */ load->real->progress_signal = load->out; /* Note the load object on the image. Loaders can use * this to signal invalidate if they hit a load error. See * vips_foreign_load_invalidate() below. */ g_object_set_qdata( G_OBJECT( load->real ), vips__foreign_load_operation, load ); if( class->load( load ) || vips_image_pio_input( load->real ) ) return( NULL ); /* ->header() read the header into @out, load has read the * image into @real. They must match exactly in size, bands, * format and coding for the copy to work. * * Some versions of ImageMagick give different results between * Ping and Load for some formats, for example. */ if( !vips_foreign_load_iscompat( load->real, out ) ) return( NULL ); /* We have to tell vips that out depends on real. We've set * the demand hint below, but not given an input there. */ vips_image_pipelinev( load->out, load->out->dhint, load->real, NULL ); } return( vips_region_new( load->real ) ); }
158
True
1
CVE-2018-7998
False
False
False
True
AV:N/AC:H/Au:N/C:P/I:P/A:P
NETWORK
HIGH
NONE
PARTIAL
PARTIAL
PARTIAL
5.1
CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
HIGH
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
7.5
HIGH
1.6
5.9
nan
[{'url': 'https://github.com/jcupitt/libvips/issues/893', 'name': 'https://github.com/jcupitt/libvips/issues/893', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/jcupitt/libvips/commit/20d840e6da15c1574b3ed998bc92f91d1e36c2a5', 'name': 'https://github.com/jcupitt/libvips/commit/20d840e6da15c1574b3ed998bc92f91d1e36c2a5', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.debian.org/debian-lts-announce/2018/03/msg00009.html', 'name': '[debian-lts-announce] 20180311 [SECURITY] [DLA 1306-1] vips security update', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-362'}, {'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:libvips_project:libvips:*:*:*:*:*:*:*:*', 'versionEndExcluding': '8.6.3', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:7.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libvips before 8.6.3, a NULL function pointer dereference vulnerability was found in the vips_region_generate function in region.c, which allows remote attackers to cause a denial of service or possibly have unspecified other impact via a crafted image file. This occurs because of a race condition involving a failed delayed load and other worker threads.'}]
2018-03-27T16:34Z
2018-03-09T19:29Z
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
https://cwe.mitre.org/data/definitions/476.html
0
John Cupitt
2018-03-05 14:42:09+00:00
fix a crash with delayed load If a delayed load failed, it could leave the pipeline only half-set up. Sebsequent threads could then segv. Set a load-has-failed flag and test before generate. See https://github.com/jcupitt/libvips/issues/893
20d840e6da15c1574b3ed998bc92f91d1e36c2a5
False
jcupitt/libvips
A fast image processing library with low memory needs.
2021-07-16 11:11:06
2021-09-22 09:59:01
https://libvips.github.io/libvips/
jcupitt
23.0
5.0
vips_foreign_load_start
vips_foreign_load_start( VipsImage * out , void * a , void * b)
['out', 'a', 'b']
vips_foreign_load_start( VipsImage *out, void *a, void *b ) { VipsForeignLoad *load = VIPS_FOREIGN_LOAD( b ); VipsForeignLoadClass *class = VIPS_FOREIGN_LOAD_GET_CLASS( load ); if( !load->real ) { if( !(load->real = vips_foreign_load_temp( load )) ) return( NULL ); #ifdef DEBUG printf( "vips_foreign_load_start: triggering ->load()\n" ); #endif /*DEBUG*/ /* Read the image in. This may involve a long computation and * will finish with load->real holding the decompressed image. * * We want our caller to be able to see this computation on * @out, so eval signals on ->real need to appear on ->out. */ load->real->progress_signal = load->out; /* Note the load object on the image. Loaders can use * this to signal invalidate if they hit a load error. See * vips_foreign_load_invalidate() below. */ g_object_set_qdata( G_OBJECT( load->real ), vips__foreign_load_operation, load ); if( class->load( load ) || vips_image_pio_input( load->real ) ) return( NULL ); /* ->header() read the header into @out, load has read the * image into @real. They must match exactly in size, bands, * format and coding for the copy to work. * * Some versions of ImageMagick give different results between * Ping and Load for some formats, for example. */ if( !vips_foreign_load_iscompat( load->real, out ) ) return( NULL ); /* We have to tell vips that out depends on real. We've set * the demand hint below, but not given an input there. */ vips_image_pipelinev( load->out, load->out->dhint, load->real, NULL ); } return( vips_region_new( load->real ) ); }
158
True
1
CVE-2018-7999
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.8
5.9
nan
[{'url': 'https://github.com/silnrsi/graphite/issues/22', 'name': 'https://github.com/silnrsi/graphite/issues/22', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'name': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/LVWOKYZZDEMG6VSG53KAGUOHUIIQ7CND/', 'name': 'FEDORA-2019-644ef7ebec', 'refsource': 'FEDORA', 'tags': []}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/L5F3CK2IPXFCLQZEBEEXONWIABN2E7H2/', 'name': 'FEDORA-2019-d0b1feb995', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:sil:graphite2:1.3.11:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libgraphite2 in graphite2 1.3.11, a NULL pointer dereference vulnerability was found in Segment.cpp during a dumbRendering operation, which may allow attackers to cause a denial of service or possibly have unspecified other impact via a crafted .ttf file.'}]
2019-09-06T14:15Z
2018-03-09T19:29Z
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
https://cwe.mitre.org/data/definitions/476.html
0
Martin Hosken
2018-03-06 12:42:16+07:00
Deprecate and make ineffective gr_face_dumbRendering
db132b4731a9b4c9534144ba3a18e65b390e9ff6
False
silnrsi/graphite
Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
2015-10-12 04:05:00
2022-01-13 10:33:30
http://graphite.sil.org/
silnrsi
117.0
30.0
GlyphCache::GlyphCache
GlyphCache::GlyphCache( const Face & face , const uint32 face_options)
['face', 'face_options']
GlyphCache::GlyphCache(const Face & face, const uint32 face_options) : _glyph_loader(new Loader(face, bool(face_options & gr_face_dumbRendering))), _glyphs(_glyph_loader && *_glyph_loader && _glyph_loader->num_glyphs() ? grzeroalloc<const GlyphFace *>(_glyph_loader->num_glyphs()) : 0), _boxes(_glyph_loader && _glyph_loader->has_boxes() && _glyph_loader->num_glyphs() ? grzeroalloc<GlyphBox *>(_glyph_loader->num_glyphs()) : 0), _num_glyphs(_glyphs ? _glyph_loader->num_glyphs() : 0), _num_attrs(_glyphs ? _glyph_loader->num_attrs() : 0), _upem(_glyphs ? _glyph_loader->units_per_em() : 0) { if ((face_options & gr_face_preloadGlyphs) && _glyph_loader && _glyphs) { int numsubs = 0; GlyphFace * const glyphs = new GlyphFace [_num_glyphs]; if (!glyphs) return; // The 0 glyph is definately required. _glyphs[0] = _glyph_loader->read_glyph(0, glyphs[0], &numsubs); // glyphs[0] has the same address as the glyphs array just allocated, // thus assigning the &glyphs[0] to _glyphs[0] means _glyphs[0] points // to the entire array. const GlyphFace * loaded = _glyphs[0]; for (uint16 gid = 1; loaded && gid != _num_glyphs; ++gid) _glyphs[gid] = loaded = _glyph_loader->read_glyph(gid, glyphs[gid], &numsubs); if (!loaded) { _glyphs[0] = 0; delete [] glyphs; } else if (numsubs > 0 && _boxes) { GlyphBox * boxes = (GlyphBox *)gralloc<char>(_num_glyphs * sizeof(GlyphBox) + numsubs * 8 * sizeof(float)); GlyphBox * currbox = boxes; for (uint16 gid = 0; currbox && gid != _num_glyphs; ++gid) { _boxes[gid] = currbox; currbox = _glyph_loader->read_box(gid, currbox, *_glyphs[gid]); } if (!currbox) { free(boxes); _boxes[0] = 0; } } delete _glyph_loader; _glyph_loader = 0; } if (_glyphs && glyph(0) == 0) { free(_glyphs); _glyphs = 0; if (_boxes) { free(_boxes); _boxes = 0; } _num_glyphs = _num_attrs = _upem = 0; } }
416
True
1
CVE-2018-7999
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.8
5.9
nan
[{'url': 'https://github.com/silnrsi/graphite/issues/22', 'name': 'https://github.com/silnrsi/graphite/issues/22', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'name': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/LVWOKYZZDEMG6VSG53KAGUOHUIIQ7CND/', 'name': 'FEDORA-2019-644ef7ebec', 'refsource': 'FEDORA', 'tags': []}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/L5F3CK2IPXFCLQZEBEEXONWIABN2E7H2/', 'name': 'FEDORA-2019-d0b1feb995', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:sil:graphite2:1.3.11:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libgraphite2 in graphite2 1.3.11, a NULL pointer dereference vulnerability was found in Segment.cpp during a dumbRendering operation, which may allow attackers to cause a denial of service or possibly have unspecified other impact via a crafted .ttf file.'}]
2019-09-06T14:15Z
2018-03-09T19:29Z
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
https://cwe.mitre.org/data/definitions/476.html
0
Martin Hosken
2018-03-06 12:42:16+07:00
Deprecate and make ineffective gr_face_dumbRendering
db132b4731a9b4c9534144ba3a18e65b390e9ff6
False
silnrsi/graphite
Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
2015-10-12 04:05:00
2022-01-13 10:33:30
http://graphite.sil.org/
silnrsi
117.0
30.0
GlyphCache::Loader::Loader
GlyphCache::Loader::Loader( const Face & face , const bool dumb_font)
['face', 'dumb_font']
GlyphCache::Loader::Loader(const Face & face, const bool dumb_font) : _head(face, Tag::head), _hhea(face, Tag::hhea), _hmtx(face, Tag::hmtx), _glyf(face, Tag::glyf), _loca(face, Tag::loca), _long_fmt(false), _has_boxes(false), _num_glyphs_graphics(0), _num_glyphs_attributes(0), _num_attrs(0) { if (!operator bool()) return; const Face::Table maxp = Face::Table(face, Tag::maxp); if (!maxp) { _head = Face::Table(); return; } _num_glyphs_graphics = TtfUtil::GlyphCount(maxp); // This will fail if the number of glyphs is wildly out of range. if (_glyf && TtfUtil::LocaLookup(_num_glyphs_graphics-1, _loca, _loca.size(), _head) == size_t(-2)) { _head = Face::Table(); return; } if (!dumb_font) { if ((m_pGlat = Face::Table(face, Tag::Glat, 0x00030000)) == NULL || (m_pGloc = Face::Table(face, Tag::Gloc)) == NULL || m_pGloc.size() < 8) { _head = Face::Table(); return; } const byte * p = m_pGloc; int version = be::read<uint32>(p); const uint16 flags = be::read<uint16>(p); _num_attrs = be::read<uint16>(p); // We can accurately calculate the number of attributed glyphs by // subtracting the length of the attribids array (numAttribs long if present) // and dividing by either 2 or 4 depending on shor or lonf format _long_fmt = flags & 1; int tmpnumgattrs = (m_pGloc.size() - (p - m_pGloc) - sizeof(uint16)*(flags & 0x2 ? _num_attrs : 0)) / (_long_fmt ? sizeof(uint32) : sizeof(uint16)) - 1; if (version >= 0x00020000 || tmpnumgattrs < 0 || tmpnumgattrs > 65535 || _num_attrs == 0 || _num_attrs > 0x3000 // is this hard limit appropriate? || _num_glyphs_graphics > tmpnumgattrs || m_pGlat.size() < 4) { _head = Face::Table(); return; } _num_glyphs_attributes = static_cast<unsigned short>(tmpnumgattrs); p = m_pGlat; version = be::read<uint32>(p); if (version >= 0x00040000 || (version >= 0x00030000 && m_pGlat.size() < 8)) // reject Glat tables that are too new { _head = Face::Table(); return; } else if (version >= 0x00030000) { unsigned int glatflags = be::read<uint32>(p); _has_boxes = glatflags & 1; // delete this once the compiler is fixed _has_boxes = true; } } }
484
True
1
CVE-2018-7999
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.8
5.9
nan
[{'url': 'https://github.com/silnrsi/graphite/issues/22', 'name': 'https://github.com/silnrsi/graphite/issues/22', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'name': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/LVWOKYZZDEMG6VSG53KAGUOHUIIQ7CND/', 'name': 'FEDORA-2019-644ef7ebec', 'refsource': 'FEDORA', 'tags': []}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/L5F3CK2IPXFCLQZEBEEXONWIABN2E7H2/', 'name': 'FEDORA-2019-d0b1feb995', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:sil:graphite2:1.3.11:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libgraphite2 in graphite2 1.3.11, a NULL pointer dereference vulnerability was found in Segment.cpp during a dumbRendering operation, which may allow attackers to cause a denial of service or possibly have unspecified other impact via a crafted .ttf file.'}]
2019-09-06T14:15Z
2018-03-09T19:29Z
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
https://cwe.mitre.org/data/definitions/476.html
0
Martin Hosken
2018-03-06 12:42:16+07:00
Deprecate and make ineffective gr_face_dumbRendering
db132b4731a9b4c9534144ba3a18e65b390e9ff6
False
silnrsi/graphite
Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
2015-10-12 04:05:00
2022-01-13 10:33:30
http://graphite.sil.org/
silnrsi
117.0
30.0
load_face
load_face( Face & face , unsigned int options)
['face', 'options']
bool load_face(Face & face, unsigned int options) { #ifdef GRAPHITE2_TELEMETRY telemetry::category _misc_cat(face.tele.misc); #endif Face::Table silf(face, Tag::Silf, 0x00050000); if (silf) options &= ~gr_face_dumbRendering; else if (!(options & gr_face_dumbRendering)) return false; if (!face.readGlyphs(options)) return false; if (silf) { if (!face.readFeatures() || !face.readGraphite(silf)) { #if !defined GRAPHITE2_NTRACING if (global_log) { *global_log << json::object << "type" << "fontload" << "failure" << face.error() << "context" << face.error_context() << json::close; } #endif return false; } else return true; } else return options & gr_face_dumbRendering; }
155
True
1
CVE-2018-7999
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.8
5.9
nan
[{'url': 'https://github.com/silnrsi/graphite/issues/22', 'name': 'https://github.com/silnrsi/graphite/issues/22', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'name': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/LVWOKYZZDEMG6VSG53KAGUOHUIIQ7CND/', 'name': 'FEDORA-2019-644ef7ebec', 'refsource': 'FEDORA', 'tags': []}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/L5F3CK2IPXFCLQZEBEEXONWIABN2E7H2/', 'name': 'FEDORA-2019-d0b1feb995', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:sil:graphite2:1.3.11:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libgraphite2 in graphite2 1.3.11, a NULL pointer dereference vulnerability was found in Segment.cpp during a dumbRendering operation, which may allow attackers to cause a denial of service or possibly have unspecified other impact via a crafted .ttf file.'}]
2019-09-06T14:15Z
2018-03-09T19:29Z
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
https://cwe.mitre.org/data/definitions/476.html
0
Martin Hosken
2018-03-06 12:42:16+07:00
Deprecate and make ineffective gr_face_dumbRendering
db132b4731a9b4c9534144ba3a18e65b390e9ff6
False
silnrsi/graphite
Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
2015-10-12 04:05:00
2022-01-13 10:33:30
http://graphite.sil.org/
silnrsi
117.0
30.0
main
main( int argc , char * argv [ ])
['argc']
int main(int argc, char * argv[]) { gr_face * face = 0; try { if (argc != 2) throw std::length_error("not enough arguments: need a backing font"); dummyFace = face_handle(argv[1]); testFeatTable<FeatTableTestA>(testDataA, "A\n"); testFeatTable<FeatTableTestB>(testDataB, "B\n"); testFeatTable<FeatTableTestB>(testDataBunsorted, "Bu\n"); testFeatTable<FeatTableTestC>(testDataCunsorted, "C\n"); testFeatTable<FeatTableTestD>(testDataDunsorted, "D\n"); testFeatTable<FeatTableTestE>(testDataE, "E\n"); // test a bad settings offset stradling the end of the table FeatureMap testFeatureMap; dummyFace.replace_table(TtfUtil::Tag::Feat, &testBadOffset, sizeof testBadOffset); face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, gr_face_dumbRendering); bool readStatus = testFeatureMap.readFeats(*face); testAssert("fail gracefully on bad table", !readStatus); } catch (std::exception & e) { fprintf(stderr, "%s: %s\n", argv[0], e.what()); gr_face_destroy(face); return 1; } gr_face_destroy(face); return 0; }
204
True
1
CVE-2018-7999
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:P
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
PARTIAL
6.8
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
REQUIRED
UNCHANGED
HIGH
HIGH
HIGH
8.8
HIGH
2.8
5.9
nan
[{'url': 'https://github.com/silnrsi/graphite/issues/22', 'name': 'https://github.com/silnrsi/graphite/issues/22', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'name': 'https://github.com/silnrsi/graphite/commit/db132b4731a9b4c9534144ba3a18e65b390e9ff6', 'refsource': 'MISC', 'tags': ['Patch']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/LVWOKYZZDEMG6VSG53KAGUOHUIIQ7CND/', 'name': 'FEDORA-2019-644ef7ebec', 'refsource': 'FEDORA', 'tags': []}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/L5F3CK2IPXFCLQZEBEEXONWIABN2E7H2/', 'name': 'FEDORA-2019-d0b1feb995', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-476'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:sil:graphite2:1.3.11:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'In libgraphite2 in graphite2 1.3.11, a NULL pointer dereference vulnerability was found in Segment.cpp during a dumbRendering operation, which may allow attackers to cause a denial of service or possibly have unspecified other impact via a crafted .ttf file.'}]
2019-09-06T14:15Z
2018-03-09T19:29Z
NULL Pointer Dereference
A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit.
NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
https://cwe.mitre.org/data/definitions/476.html
0
Martin Hosken
2018-03-06 12:42:16+07:00
Deprecate and make ineffective gr_face_dumbRendering
db132b4731a9b4c9534144ba3a18e65b390e9ff6
False
silnrsi/graphite
Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
2015-10-12 04:05:00
2022-01-13 10:33:30
http://graphite.sil.org/
silnrsi
117.0
30.0
testFeatTable
testFeatTable( const T & table , const char * testName)
['table', 'testName']
template <class T> void testFeatTable(const T & table, const char * testName) { FeatureMap testFeatureMap; dummyFace.replace_table(TtfUtil::Tag::Feat, &table, sizeof(T)); gr_face * face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, gr_face_dumbRendering); if (!face) throw std::runtime_error("failed to load font"); bool readStatus = testFeatureMap.readFeats(*face); testAssert("readFeats", readStatus); fprintf(stderr, testName, NULL); testAssertEqual("test num features %hu,%hu\n", testFeatureMap.numFeats(), table.m_header.m_numFeat); for (size_t i = 0; i < sizeof(table.m_defs) / sizeof(FeatDefn); i++) { const FeatureRef * ref = testFeatureMap.findFeatureRef(table.m_defs[i].m_featId); testAssert("test feat\n", ref); testAssertEqual("test feat settings %hu %hu\n", ref->getNumSettings(), table.m_defs[i].m_numFeatSettings); testAssertEqual("test feat label %hu %hu\n", ref->getNameId(), table.m_defs[i].m_label); size_t settingsIndex = (table.m_defs[i].m_settingsOffset - sizeof(FeatHeader) - (sizeof(FeatDefn) * table.m_header.m_numFeat)) / sizeof(FeatSetting); for (size_t j = 0; j < table.m_defs[i].m_numFeatSettings; j++) { testAssertEqual("setting label %hu %hu\n", ref->getSettingName(j), table.m_settings[settingsIndex+j].m_label); } } gr_face_destroy(face); }
290
True
1
CVE-2018-8754
False
False
False
False
AV:L/AC:L/Au:N/C:N/I:N/A:P
LOCAL
LOW
NONE
NONE
NONE
PARTIAL
2.1
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
LOCAL
LOW
LOW
NONE
UNCHANGED
NONE
NONE
HIGH
5.5
MEDIUM
1.8
3.6
True
[{'url': 'https://www.debian.org/security/2018/dsa-4160', 'name': 'DSA-4160', 'refsource': 'DEBIAN', 'tags': ['Third Party Advisory']}, {'url': 'https://github.com/libyal/libevt/commit/9d2cc3ca0a1612a6b271abcacffc2e3eea42925e', 'name': 'https://github.com/libyal/libevt/commit/9d2cc3ca0a1612a6b271abcacffc2e3eea42925e', 'refsource': 'MISC', 'tags': ['Patch', 'Vendor Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-125'}]}]
LOW
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:libevt_project:libevt:*:*:*:*:*:*:*:*', 'versionEndExcluding': '20180317', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': '** DISPUTED ** The libevt_record_values_read_event() function in libevt_record_values.c in libevt before 2018-03-17 does not properly check for out-of-bounds values of user SID data size, strings size, or data size. NOTE: the vendor has disputed this as described in libyal/libevt issue 5 on GitHub.'}]
2020-10-14T18:14Z
2018-03-18T03:29Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Joachim Metz
2018-03-17 08:35:13+01:00
Applied updates and addition boundary checks for corrupted data
9d2cc3ca0a1612a6b271abcacffc2e3eea42925e
False
libyal/libevt
Library and tools to access the Windows Event Log (EVT) format
2014-09-28 16:58:01
2022-08-27 09:48:49
libyal
50.0
24.0
libevt_record_values_read_event
libevt_record_values_read_event( libevt_record_values_t * record_values , uint8_t * record_data , size_t record_data_size , uint8_t strict_mode , libcerror_error_t ** error)
['record_values', 'record_data', 'record_data_size', 'strict_mode', 'error']
int libevt_record_values_read_event( libevt_record_values_t *record_values, uint8_t *record_data, size_t record_data_size, uint8_t strict_mode, libcerror_error_t **error ) { static char *function = "libevt_record_values_read_event"; size_t record_data_offset = 0; size_t strings_data_offset = 0; ssize_t value_data_size = 0; uint32_t data_offset = 0; uint32_t data_size = 0; uint32_t members_data_size = 0; uint32_t size = 0; uint32_t size_copy = 0; uint32_t strings_offset = 0; uint32_t strings_size = 0; uint32_t user_sid_offset = 0; uint32_t user_sid_size = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint32_t value_32bit = 0; uint16_t value_16bit = 0; #endif if( record_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid record values.", function ); return( -1 ); } if( record_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid record data.", function ); return( -1 ); } if( record_data_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid record data size value exceeds maximum.", function ); return( -1 ); } if( record_data_size < ( sizeof( evt_record_event_header_t ) + 4 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: record data size value out of bounds.", function ); return( -1 ); } byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->size, size ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->record_number, record_values->number ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->creation_time, record_values->creation_time ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->written_time, record_values->written_time ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->event_identifier, record_values->event_identifier ); byte_stream_copy_to_uint16_little_endian( ( (evt_record_event_header_t *) record_data )->event_type, record_values->event_type ); byte_stream_copy_to_uint16_little_endian( ( (evt_record_event_header_t *) record_data )->event_category, record_values->event_category ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->strings_offset, strings_offset ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->user_sid_size, user_sid_size ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->user_sid_offset, user_sid_offset ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->data_size, data_size ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->data_offset, data_offset ); byte_stream_copy_to_uint32_little_endian( &( record_data[ record_data_size - 4 ] ), size_copy ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: size\t\t\t\t\t: %" PRIu32 "\n", function, size ); libcnotify_printf( "%s: signature\t\t\t\t: %c%c%c%c\n", function, ( (evt_record_event_header_t *) record_data )->signature[ 0 ], ( (evt_record_event_header_t *) record_data )->signature[ 1 ], ( (evt_record_event_header_t *) record_data )->signature[ 2 ], ( (evt_record_event_header_t *) record_data )->signature[ 3 ] ); libcnotify_printf( "%s: record number\t\t\t\t: %" PRIu32 "\n", function, record_values->number ); if( libevt_debug_print_posix_time_value( function, "creation time\t\t\t\t", ( (evt_record_event_header_t *) record_data )->creation_time, 4, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_POSIX_TIME_VALUE_TYPE_SECONDS_32BIT_SIGNED, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print POSIX time value.", function ); goto on_error; } if( libevt_debug_print_posix_time_value( function, "written time\t\t\t\t", ( (evt_record_event_header_t *) record_data )->written_time, 4, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_POSIX_TIME_VALUE_TYPE_SECONDS_32BIT_SIGNED, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print POSIX time value.", function ); goto on_error; } libcnotify_printf( "%s: event identifier\t\t\t: 0x%08" PRIx32 "\n", function, record_values->event_identifier ); libcnotify_printf( "%s: event identifier: code\t\t\t: %" PRIu32 "\n", function, record_values->event_identifier & 0x0000ffffUL ); libcnotify_printf( "%s: event identifier: facility\t\t: %" PRIu32 "\n", function, ( record_values->event_identifier & 0x0fff0000UL ) >> 16 ); libcnotify_printf( "%s: event identifier: reserved\t\t: %" PRIu32 "\n", function, ( record_values->event_identifier & 0x10000000UL ) >> 28 ); libcnotify_printf( "%s: event identifier: customer flags\t: %" PRIu32 "\n", function, ( record_values->event_identifier & 0x20000000UL ) >> 29 ); libcnotify_printf( "%s: event identifier: severity\t\t: %" PRIu32 " (", function, ( record_values->event_identifier & 0xc0000000UL ) >> 30 ); libevt_debug_print_event_identifier_severity( record_values->event_identifier ); libcnotify_printf( ")\n" ); libcnotify_printf( "%s: event type\t\t\t\t: %" PRIu16 " (", function, record_values->event_type ); libevt_debug_print_event_type( record_values->event_type ); libcnotify_printf( ")\n" ); byte_stream_copy_to_uint16_little_endian( ( (evt_record_event_header_t *) record_data )->number_of_strings, value_16bit ); libcnotify_printf( "%s: number of strings\t\t\t: %" PRIu16 "\n", function, value_16bit ); libcnotify_printf( "%s: event category\t\t\t\t: %" PRIu16 "\n", function, record_values->event_category ); byte_stream_copy_to_uint16_little_endian( ( (evt_record_event_header_t *) record_data )->event_flags, value_16bit ); libcnotify_printf( "%s: event flags\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); byte_stream_copy_to_uint32_little_endian( ( (evt_record_event_header_t *) record_data )->closing_record_number, value_32bit ); libcnotify_printf( "%s: closing record values number\t\t: %" PRIu32 "\n", function, value_32bit ); libcnotify_printf( "%s: strings offset\t\t\t\t: %" PRIu32 "\n", function, strings_offset ); libcnotify_printf( "%s: user security identifier (SID) size\t: %" PRIu32 "\n", function, user_sid_size ); libcnotify_printf( "%s: user security identifier (SID) offset\t: %" PRIu32 "\n", function, user_sid_offset ); libcnotify_printf( "%s: data size\t\t\t\t: %" PRIu32 "\n", function, data_size ); libcnotify_printf( "%s: data offset\t\t\t\t: %" PRIu32 "\n", function, data_offset ); } #endif record_data_offset = sizeof( evt_record_event_header_t ); if( ( user_sid_offset == 0 ) && ( user_sid_size != 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: user SID offset or size value out of bounds.", function ); goto on_error; } if( user_sid_offset != 0 ) { if( ( (size_t) user_sid_offset < record_data_offset ) || ( (size_t) user_sid_offset >= ( record_data_size - 4 ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: user SID offset value out of bounds.", function ); goto on_error; } if( user_sid_size != 0 ) { if( (size_t) ( user_sid_offset + user_sid_size ) > ( record_data_size - 4 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: user SID size value out of bounds.", function ); goto on_error; } } } /* If the strings offset is points at the offset at record data size - 4 * the strings are empty. For this to be sane the data offset should * be the same as the strings offset or the data size 0. */ if( ( (size_t) strings_offset < user_sid_offset ) || ( (size_t) strings_offset >= ( record_data_size - 4 ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: strings offset value out of bounds.", function ); goto on_error; } if( ( (size_t) data_offset < strings_offset ) || ( (size_t) data_offset >= ( record_data_size - 4 ) ) ) { if( data_size != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: data offset value out of bounds.", function ); goto on_error; } data_offset = (uint32_t) record_data_size - 4; } if( ( (size_t) strings_offset >= ( record_data_size - 4 ) ) && ( strings_offset != data_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: strings offset value out of bounds.", function ); goto on_error; } if( strings_offset != 0 ) { if( strings_offset < record_data_offset ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: strings offset value out of bounds.", function ); goto on_error; } } if( user_sid_offset != 0 ) { members_data_size = user_sid_offset - (uint32_t) record_data_offset; } else if( strings_offset != 0 ) { members_data_size = strings_offset - (uint32_t) record_data_offset; } if( strings_offset != 0 ) { strings_size = data_offset - strings_offset; } if( data_size != 0 ) { if( (size_t) ( data_offset + data_size ) > ( record_data_size - 4 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: data size value out of bounds.", function ); goto on_error; } } if( members_data_size != 0 ) { #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: members data:\n", function ); libcnotify_print_data( &( record_data[ record_data_offset ] ), members_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( libfvalue_value_type_initialize( &( record_values->source_name ), LIBFVALUE_VALUE_TYPE_STRING_UTF16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create source name value.", function ); goto on_error; } value_data_size = libfvalue_value_type_set_data_string( record_values->source_name, &( record_data[ record_data_offset ] ), members_data_size, LIBFVALUE_CODEPAGE_UTF16_LITTLE_ENDIAN, LIBFVALUE_VALUE_DATA_FLAG_MANAGED, error ); if( value_data_size == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set data of source name value.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: source name\t\t\t\t: ", function ); if( libfvalue_value_print( record_values->source_name, 0, 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print source name value.", function ); goto on_error; } libcnotify_printf( "\n" ); } #endif record_data_offset += value_data_size; members_data_size -= (uint32_t) value_data_size; if( libfvalue_value_type_initialize( &( record_values->computer_name ), LIBFVALUE_VALUE_TYPE_STRING_UTF16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create computer name value.", function ); goto on_error; } value_data_size = libfvalue_value_type_set_data_string( record_values->computer_name, &( record_data[ record_data_offset ] ), members_data_size, LIBFVALUE_CODEPAGE_UTF16_LITTLE_ENDIAN, LIBFVALUE_VALUE_DATA_FLAG_MANAGED, error ); if( value_data_size == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set data of computer name value.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: computer name\t\t\t\t: ", function ); if( libfvalue_value_print( record_values->computer_name, 0, 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print computer name value.", function ); goto on_error; } libcnotify_printf( "\n" ); } #endif record_data_offset += value_data_size; members_data_size -= (uint32_t) value_data_size; if( members_data_size > 0 ) { #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: members trailing data:\n", function ); libcnotify_print_data( &( record_data[ record_data_offset ] ), members_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif record_data_offset += members_data_size; } } if( user_sid_size != 0 ) { if( libfvalue_value_type_initialize( &( record_values->user_security_identifier ), LIBFVALUE_VALUE_TYPE_NT_SECURITY_IDENTIFIER, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create user security identifier (SID) value.", function ); goto on_error; } if( libfvalue_value_set_data( record_values->user_security_identifier, &( record_data[ user_sid_offset ] ), (size_t) user_sid_size, LIBFVALUE_ENDIAN_LITTLE, LIBFVALUE_VALUE_DATA_FLAG_MANAGED, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set data of user security identifier (SID) value.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: user security identifier (SID)\t\t: ", function ); if( libfvalue_value_print( record_values->user_security_identifier, 0, 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print user security identifier (SID) value.", function ); goto on_error; } libcnotify_printf( "\n" ); } #endif record_data_offset += user_sid_size; } if( strings_size != 0 ) { #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: strings data:\n", function ); libcnotify_print_data( &( record_data[ strings_offset ] ), strings_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( size_copy == 0 ) { /* If the strings data is truncated */ strings_data_offset = strings_offset + strings_size - 2; while( strings_data_offset > strings_offset ) { if( ( record_data[ strings_data_offset ] != 0 ) || ( record_data[ strings_data_offset + 1 ] != 0 ) ) { strings_size += 2; break; } strings_data_offset -= 2; strings_size -= 2; } } if( libfvalue_value_type_initialize( &( record_values->strings ), LIBFVALUE_VALUE_TYPE_STRING_UTF16, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create strings value.", function ); goto on_error; } value_data_size = libfvalue_value_type_set_data_strings_array( record_values->strings, &( record_data[ strings_offset ] ), strings_size, LIBFVALUE_CODEPAGE_UTF16_LITTLE_ENDIAN, error ); if( value_data_size == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set data of strings value.", function ); goto on_error; } record_data_offset += strings_size; } if( data_size != 0 ) { #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: data:\n", function ); libcnotify_print_data( &( record_data[ data_offset ] ), (size_t) data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( libfvalue_value_type_initialize( &( record_values->data ), LIBFVALUE_VALUE_TYPE_BINARY_DATA, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create data value.", function ); goto on_error; } if( libfvalue_value_set_data( record_values->data, &( record_data[ record_data_offset ] ), (size_t) data_size, LIBFVALUE_ENDIAN_LITTLE, LIBFVALUE_VALUE_DATA_FLAG_MANAGED, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set data of data value.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) record_data_offset += data_size; #endif } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( record_data_offset < ( record_data_size - 4 ) ) { libcnotify_printf( "%s: padding:\n", function ); libcnotify_print_data( &( record_data[ record_data_offset ] ), (size_t) record_data_size - record_data_offset - 4, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } libcnotify_printf( "%s: size copy\t\t\t\t: %" PRIu32 "\n", function, size_copy ); libcnotify_printf( "\n" ); } #endif if( ( strict_mode == 0 ) && ( size_copy == 0 ) ) { size_copy = size; } if( size != size_copy ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_INPUT, LIBCERROR_INPUT_ERROR_VALUE_MISMATCH, "%s: value mismatch for size and size copy.", function ); goto on_error; } if( record_data_size != (size_t) size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_INPUT, LIBCERROR_INPUT_ERROR_VALUE_MISMATCH, "%s: value mismatch for record_values data size and size.", function ); goto on_error; } return( 1 ); on_error: if( record_values->data != NULL ) { libfvalue_value_free( &( record_values->data ), NULL ); } if( record_values->strings != NULL ) { libfvalue_value_free( &( record_values->strings ), NULL ); } if( record_values->user_security_identifier != NULL ) { libfvalue_value_free( &( record_values->user_security_identifier ), NULL ); } if( record_values->computer_name != NULL ) { libfvalue_value_free( &( record_values->computer_name ), NULL ); } if( record_values->source_name != NULL ) { libfvalue_value_free( &( record_values->source_name ), NULL ); } return( -1 ); }
2415
True
1
CVE-2019-1010208
False
False
False
False
AV:L/AC:L/Au:N/C:P/I:N/A:N
LOCAL
LOW
NONE
PARTIAL
NONE
NONE
2.1
CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
LOCAL
LOW
LOW
NONE
UNCHANGED
LOW
NONE
NONE
3.3
LOW
1.8
1.4
False
[{'url': 'https://github.com/veracrypt/VeraCrypt/commit/f30f9339c9a0b9bbcc6f5ad38804af39db1f479e', 'name': 'https://github.com/veracrypt/VeraCrypt/commit/f30f9339c9a0b9bbcc6f5ad38804af39db1f479e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-119'}]}]
LOW
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:idrix:truecrypt:*:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:idrix:veracrypt:*:*:*:*:*:*:*:*', 'versionEndIncluding': '1.23', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'IDRIX, Truecrypt Veracrypt, Truecrypt Prior to 1.23-Hotfix-1 (Veracrypt), all versions (Truecrypt) is affected by: Buffer Overflow. The impact is: Minor information disclosure of kernel stack. The component is: Veracrypt NT Driver (veracrypt.sys). The attack vector is: Locally executed code, IOCTL request to driver. The fixed version is: 1.23-Hotfix-1.'}]
2019-08-05T15:38Z
2019-07-23T14:15Z
Improper Restriction of Operations within the Bounds of a Memory Buffer
The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer.
Certain languages allow direct addressing of memory locations and do not automatically ensure that these locations are valid for the memory buffer that is being referenced. This can cause read or write operations to be performed on memory locations that may be associated with other variables, data structures, or internal program data. As a result, an attacker may be able to execute arbitrary code, alter the intended control flow, read sensitive information, or cause the system to crash.
https://cwe.mitre.org/data/definitions/119.html
0
Mounir IDRASSI
2018-09-19 18:26:01+02:00
Windows: fix low severity vulnerability in driver that allowed reading 3 bytes of kernel stack memory (with a rare possibility of 25 additional bytes). Reported by Tim Harrison.
f30f9339c9a0b9bbcc6f5ad38804af39db1f479e
False
veracrypt/VeraCrypt
Disk encryption with strong security based on TrueCrypt
2014-11-08 22:12:36
2022-08-26 02:30:59
https://www.veracrypt.fr
veracrypt
4262.0
680.0
ProcessMainDeviceControlIrp
ProcessMainDeviceControlIrp( PDEVICE_OBJECT DeviceObject , PEXTENSION Extension , PIRP Irp)
['DeviceObject', 'Extension', 'Irp']
NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, PIRP Irp) { PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (Irp); NTSTATUS ntStatus; switch (irpSp->Parameters.DeviceIoControl.IoControlCode) { case TC_IOCTL_GET_DRIVER_VERSION: case TC_IOCTL_LEGACY_GET_DRIVER_VERSION: if (ValidateIOBufferSize (Irp, sizeof (LONG), ValidateOutput)) { LONG tmp = VERSION_NUM; memcpy (Irp->AssociatedIrp.SystemBuffer, &tmp, 4); Irp->IoStatus.Information = sizeof (LONG); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_GET_DEVICE_REFCOUNT: if (ValidateIOBufferSize (Irp, sizeof (int), ValidateOutput)) { *(int *) Irp->AssociatedIrp.SystemBuffer = DeviceObject->ReferenceCount; Irp->IoStatus.Information = sizeof (int); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_IS_DRIVER_UNLOAD_DISABLED: if (ValidateIOBufferSize (Irp, sizeof (int), ValidateOutput)) { LONG deviceObjectCount = 0; *(int *) Irp->AssociatedIrp.SystemBuffer = DriverUnloadDisabled; if (IoEnumerateDeviceObjectList (TCDriverObject, NULL, 0, &deviceObjectCount) == STATUS_BUFFER_TOO_SMALL && deviceObjectCount > 1) *(int *) Irp->AssociatedIrp.SystemBuffer = TRUE; Irp->IoStatus.Information = sizeof (int); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_IS_ANY_VOLUME_MOUNTED: if (ValidateIOBufferSize (Irp, sizeof (int), ValidateOutput)) { int drive; *(int *) Irp->AssociatedIrp.SystemBuffer = 0; for (drive = MIN_MOUNTED_VOLUME_DRIVE_NUMBER; drive <= MAX_MOUNTED_VOLUME_DRIVE_NUMBER; ++drive) { if (GetVirtualVolumeDeviceObject (drive)) { *(int *) Irp->AssociatedIrp.SystemBuffer = 1; break; } } if (IsBootDriveMounted()) *(int *) Irp->AssociatedIrp.SystemBuffer = 1; Irp->IoStatus.Information = sizeof (int); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_OPEN_TEST: { OPEN_TEST_STRUCT *opentest = (OPEN_TEST_STRUCT *) Irp->AssociatedIrp.SystemBuffer; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE NtFileHandle; UNICODE_STRING FullFileName; IO_STATUS_BLOCK IoStatus; LARGE_INTEGER offset; ACCESS_MASK access = FILE_READ_ATTRIBUTES; if (!ValidateIOBufferSize (Irp, sizeof (OPEN_TEST_STRUCT), ValidateInputOutput)) break; EnsureNullTerminatedString (opentest->wszFileName, sizeof (opentest->wszFileName)); RtlInitUnicodeString (&FullFileName, opentest->wszFileName); InitializeObjectAttributes (&ObjectAttributes, &FullFileName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL); if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem || opentest->bComputeVolumeIDs) access |= FILE_READ_DATA; ntStatus = ZwCreateFile (&NtFileHandle, SYNCHRONIZE | access, &ObjectAttributes, &IoStatus, NULL, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0); if (NT_SUCCESS (ntStatus)) { opentest->TCBootLoaderDetected = FALSE; opentest->FilesystemDetected = FALSE; memset (opentest->VolumeIDComputed, 0, sizeof (opentest->VolumeIDComputed)); memset (opentest->volumeIDs, 0, sizeof (opentest->volumeIDs)); if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem || opentest->bComputeVolumeIDs) { byte *readBuffer = TCalloc (TC_MAX_VOLUME_SECTOR_SIZE); if (!readBuffer) { ntStatus = STATUS_INSUFFICIENT_RESOURCES; } else { if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem) { // Determine if the first sector contains a portion of the VeraCrypt Boot Loader offset.QuadPart = 0; ntStatus = ZwReadFile (NtFileHandle, NULL, NULL, NULL, &IoStatus, readBuffer, TC_MAX_VOLUME_SECTOR_SIZE, &offset, NULL); if (NT_SUCCESS (ntStatus)) { size_t i; if (opentest->bDetectTCBootLoader && IoStatus.Information >= TC_SECTOR_SIZE_BIOS) { // Search for the string "VeraCrypt" for (i = 0; i < TC_SECTOR_SIZE_BIOS - strlen (TC_APP_NAME); ++i) { if (memcmp (readBuffer + i, TC_APP_NAME, strlen (TC_APP_NAME)) == 0) { opentest->TCBootLoaderDetected = TRUE; break; } } } if (opentest->DetectFilesystem && IoStatus.Information >= sizeof (int64)) { switch (BE64 (*(uint64 *) readBuffer)) { case 0xEB52904E54465320ULL: // NTFS case 0xEB3C904D53444F53ULL: // FAT16/FAT32 case 0xEB58904D53444F53ULL: // FAT32 case 0xEB76904558464154ULL: // exFAT case 0x0000005265465300ULL: // ReFS case 0xEB58906D6B66732EULL: // FAT32 mkfs.fat case 0xEB58906D6B646F73ULL: // FAT32 mkfs.vfat/mkdosfs case 0xEB3C906D6B66732EULL: // FAT16/FAT12 mkfs.fat case 0xEB3C906D6B646F73ULL: // FAT16/FAT12 mkfs.vfat/mkdosfs opentest->FilesystemDetected = TRUE; break; case 0x0000000000000000ULL: // all 512 bytes are zeroes => unencrypted filesystem like Microsoft reserved partition if (IsAllZeroes (readBuffer + 8, TC_VOLUME_HEADER_EFFECTIVE_SIZE - 8)) opentest->FilesystemDetected = TRUE; break; } } } } if (opentest->bComputeVolumeIDs && (!opentest->DetectFilesystem || !opentest->FilesystemDetected)) { int volumeType; // Go through all volume types (e.g., normal, hidden) for (volumeType = TC_VOLUME_TYPE_NORMAL; volumeType < TC_VOLUME_TYPE_COUNT; volumeType++) { /* Read the volume header */ switch (volumeType) { case TC_VOLUME_TYPE_NORMAL: offset.QuadPart = TC_VOLUME_HEADER_OFFSET; break; case TC_VOLUME_TYPE_HIDDEN: offset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET; break; } ntStatus = ZwReadFile (NtFileHandle, NULL, NULL, NULL, &IoStatus, readBuffer, TC_MAX_VOLUME_SECTOR_SIZE, &offset, NULL); if (NT_SUCCESS (ntStatus)) { /* compute the ID of this volume: SHA-256 of the effective header */ sha256 (opentest->volumeIDs[volumeType], readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE); opentest->VolumeIDComputed[volumeType] = TRUE; } } } TCfree (readBuffer); } } ZwClose (NtFileHandle); Dump ("Open test on file %ls success.\n", opentest->wszFileName); } else { #if 0 Dump ("Open test on file %ls failed NTSTATUS 0x%08x\n", opentest->wszFileName, ntStatus); #endif } Irp->IoStatus.Information = NT_SUCCESS (ntStatus) ? sizeof (OPEN_TEST_STRUCT) : 0; Irp->IoStatus.Status = ntStatus; } break; case TC_IOCTL_GET_SYSTEM_DRIVE_CONFIG: { GetSystemDriveConfigurationRequest *request = (GetSystemDriveConfigurationRequest *) Irp->AssociatedIrp.SystemBuffer; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE NtFileHandle; UNICODE_STRING FullFileName; IO_STATUS_BLOCK IoStatus; LARGE_INTEGER offset; byte readBuffer [TC_SECTOR_SIZE_BIOS]; if (!ValidateIOBufferSize (Irp, sizeof (GetSystemDriveConfigurationRequest), ValidateInputOutput)) break; EnsureNullTerminatedString (request->DevicePath, sizeof (request->DevicePath)); RtlInitUnicodeString (&FullFileName, request->DevicePath); InitializeObjectAttributes (&ObjectAttributes, &FullFileName, OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, NULL, NULL); ntStatus = ZwCreateFile (&NtFileHandle, SYNCHRONIZE | GENERIC_READ, &ObjectAttributes, &IoStatus, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT | FILE_RANDOM_ACCESS, NULL, 0); if (NT_SUCCESS (ntStatus)) { // Determine if the first sector contains a portion of the VeraCrypt Boot Loader offset.QuadPart = 0; // MBR ntStatus = ZwReadFile (NtFileHandle, NULL, NULL, NULL, &IoStatus, readBuffer, sizeof(readBuffer), &offset, NULL); if (NT_SUCCESS (ntStatus)) { size_t i; // Check for dynamic drive request->DriveIsDynamic = FALSE; if (readBuffer[510] == 0x55 && readBuffer[511] == 0xaa) { int i; for (i = 0; i < 4; ++i) { if (readBuffer[446 + i * 16 + 4] == PARTITION_LDM) { request->DriveIsDynamic = TRUE; break; } } } request->BootLoaderVersion = 0; request->Configuration = 0; request->UserConfiguration = 0; request->CustomUserMessage[0] = 0; // Search for the string "VeraCrypt" for (i = 0; i < sizeof (readBuffer) - strlen (TC_APP_NAME); ++i) { if (memcmp (readBuffer + i, TC_APP_NAME, strlen (TC_APP_NAME)) == 0) { request->BootLoaderVersion = BE16 (*(uint16 *) (readBuffer + TC_BOOT_SECTOR_VERSION_OFFSET)); request->Configuration = readBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET]; if (request->BootLoaderVersion != 0 && request->BootLoaderVersion <= VERSION_NUM) { request->UserConfiguration = readBuffer[TC_BOOT_SECTOR_USER_CONFIG_OFFSET]; memcpy (request->CustomUserMessage, readBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH); } break; } } Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = sizeof (*request); } else { Irp->IoStatus.Status = ntStatus; Irp->IoStatus.Information = 0; } ZwClose (NtFileHandle); } else { Irp->IoStatus.Status = ntStatus; Irp->IoStatus.Information = 0; } } break; case TC_IOCTL_WIPE_PASSWORD_CACHE: WipeCache (); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_PASSWORD_CACHE_STATUS: Irp->IoStatus.Status = cacheEmpty ? STATUS_PIPE_EMPTY : STATUS_SUCCESS; Irp->IoStatus.Information = 0; break; case TC_IOCTL_SET_PORTABLE_MODE_STATUS: if (!UserCanAccessDriveDevice()) { Irp->IoStatus.Status = STATUS_ACCESS_DENIED; Irp->IoStatus.Information = 0; } else { PortableMode = TRUE; Dump ("Setting portable mode\n"); } break; case TC_IOCTL_GET_PORTABLE_MODE_STATUS: Irp->IoStatus.Status = PortableMode ? STATUS_SUCCESS : STATUS_PIPE_EMPTY; Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_MOUNTED_VOLUMES: if (ValidateIOBufferSize (Irp, sizeof (MOUNT_LIST_STRUCT), ValidateOutput)) { MOUNT_LIST_STRUCT *list = (MOUNT_LIST_STRUCT *) Irp->AssociatedIrp.SystemBuffer; PDEVICE_OBJECT ListDevice; int drive; list->ulMountedDrives = 0; for (drive = MIN_MOUNTED_VOLUME_DRIVE_NUMBER; drive <= MAX_MOUNTED_VOLUME_DRIVE_NUMBER; ++drive) { PEXTENSION ListExtension; ListDevice = GetVirtualVolumeDeviceObject (drive); if (!ListDevice) continue; ListExtension = (PEXTENSION) ListDevice->DeviceExtension; if (IsVolumeAccessibleByCurrentUser (ListExtension)) { list->ulMountedDrives |= (1 << ListExtension->nDosDriveNo); RtlStringCbCopyW (list->wszVolume[ListExtension->nDosDriveNo], sizeof(list->wszVolume[ListExtension->nDosDriveNo]),ListExtension->wszVolume); RtlStringCbCopyW (list->wszLabel[ListExtension->nDosDriveNo], sizeof(list->wszLabel[ListExtension->nDosDriveNo]),ListExtension->wszLabel); memcpy (list->volumeID[ListExtension->nDosDriveNo], ListExtension->volumeID, VOLUME_ID_SIZE); list->diskLength[ListExtension->nDosDriveNo] = ListExtension->DiskLength; list->ea[ListExtension->nDosDriveNo] = ListExtension->cryptoInfo->ea; if (ListExtension->cryptoInfo->hiddenVolume) list->volumeType[ListExtension->nDosDriveNo] = PROP_VOL_TYPE_HIDDEN; // Hidden volume else if (ListExtension->cryptoInfo->bHiddenVolProtectionAction) list->volumeType[ListExtension->nDosDriveNo] = PROP_VOL_TYPE_OUTER_VOL_WRITE_PREVENTED; // Normal/outer volume (hidden volume protected AND write already prevented) else if (ListExtension->cryptoInfo->bProtectHiddenVolume) list->volumeType[ListExtension->nDosDriveNo] = PROP_VOL_TYPE_OUTER; // Normal/outer volume (hidden volume protected) else list->volumeType[ListExtension->nDosDriveNo] = PROP_VOL_TYPE_NORMAL; // Normal volume list->truecryptMode[ListExtension->nDosDriveNo] = ListExtension->cryptoInfo->bTrueCryptMode; } } Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = sizeof (MOUNT_LIST_STRUCT); } break; case TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES: if (ValidateIOBufferSize (Irp, sizeof (uint32), ValidateOutput)) { // Prevent the user from downgrading to versions lower than 5.0 by faking mounted volumes. // The user could render the system unbootable by downgrading when boot encryption // is active or being set up. memset (Irp->AssociatedIrp.SystemBuffer, 0, irpSp->Parameters.DeviceIoControl.OutputBufferLength); *(uint32 *) Irp->AssociatedIrp.SystemBuffer = 0xffffFFFF; Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = irpSp->Parameters.DeviceIoControl.OutputBufferLength; } break; case TC_IOCTL_GET_VOLUME_PROPERTIES: if (ValidateIOBufferSize (Irp, sizeof (VOLUME_PROPERTIES_STRUCT), ValidateInputOutput)) { VOLUME_PROPERTIES_STRUCT *prop = (VOLUME_PROPERTIES_STRUCT *) Irp->AssociatedIrp.SystemBuffer; PDEVICE_OBJECT ListDevice = GetVirtualVolumeDeviceObject (prop->driveNo); Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Information = 0; if (ListDevice) { PEXTENSION ListExtension = (PEXTENSION) ListDevice->DeviceExtension; if (IsVolumeAccessibleByCurrentUser (ListExtension)) { prop->uniqueId = ListExtension->UniqueVolumeId; RtlStringCbCopyW (prop->wszVolume, sizeof(prop->wszVolume),ListExtension->wszVolume); RtlStringCbCopyW (prop->wszLabel, sizeof(prop->wszLabel),ListExtension->wszLabel); memcpy (prop->volumeID, ListExtension->volumeID, VOLUME_ID_SIZE); prop->bDriverSetLabel = ListExtension->bDriverSetLabel; prop->diskLength = ListExtension->DiskLength; prop->ea = ListExtension->cryptoInfo->ea; prop->mode = ListExtension->cryptoInfo->mode; prop->pkcs5 = ListExtension->cryptoInfo->pkcs5; prop->pkcs5Iterations = ListExtension->cryptoInfo->noIterations; prop->volumePim = ListExtension->cryptoInfo->volumePim; #if 0 prop->volumeCreationTime = ListExtension->cryptoInfo->volume_creation_time; prop->headerCreationTime = ListExtension->cryptoInfo->header_creation_time; #endif prop->volumeHeaderFlags = ListExtension->cryptoInfo->HeaderFlags; prop->readOnly = ListExtension->bReadOnly; prop->removable = ListExtension->bRemovable; prop->partitionInInactiveSysEncScope = ListExtension->PartitionInInactiveSysEncScope; prop->hiddenVolume = ListExtension->cryptoInfo->hiddenVolume; if (ListExtension->cryptoInfo->bProtectHiddenVolume) prop->hiddenVolProtection = ListExtension->cryptoInfo->bHiddenVolProtectionAction ? HIDVOL_PROT_STATUS_ACTION_TAKEN : HIDVOL_PROT_STATUS_ACTIVE; else prop->hiddenVolProtection = HIDVOL_PROT_STATUS_NONE; prop->totalBytesRead = ListExtension->Queue.TotalBytesRead; prop->totalBytesWritten = ListExtension->Queue.TotalBytesWritten; prop->volFormatVersion = ListExtension->cryptoInfo->LegacyVolume ? TC_VOLUME_FORMAT_VERSION_PRE_6_0 : TC_VOLUME_FORMAT_VERSION; Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = sizeof (VOLUME_PROPERTIES_STRUCT); } } } break; case TC_IOCTL_GET_RESOLVED_SYMLINK: if (ValidateIOBufferSize (Irp, sizeof (RESOLVE_SYMLINK_STRUCT), ValidateInputOutput)) { RESOLVE_SYMLINK_STRUCT *resolve = (RESOLVE_SYMLINK_STRUCT *) Irp->AssociatedIrp.SystemBuffer; { NTSTATUS ntStatus; EnsureNullTerminatedString (resolve->symLinkName, sizeof (resolve->symLinkName)); ntStatus = SymbolicLinkToTarget (resolve->symLinkName, resolve->targetName, sizeof (resolve->targetName)); Irp->IoStatus.Information = sizeof (RESOLVE_SYMLINK_STRUCT); Irp->IoStatus.Status = ntStatus; } } break; case TC_IOCTL_GET_DRIVE_PARTITION_INFO: if (ValidateIOBufferSize (Irp, sizeof (DISK_PARTITION_INFO_STRUCT), ValidateInputOutput)) { DISK_PARTITION_INFO_STRUCT *info = (DISK_PARTITION_INFO_STRUCT *) Irp->AssociatedIrp.SystemBuffer; { PARTITION_INFORMATION_EX pi; NTSTATUS ntStatus; EnsureNullTerminatedString (info->deviceName, sizeof (info->deviceName)); ntStatus = TCDeviceIoControl (info->deviceName, IOCTL_DISK_GET_PARTITION_INFO_EX, NULL, 0, &pi, sizeof (pi)); if (NT_SUCCESS(ntStatus)) { memset (&info->partInfo, 0, sizeof (info->partInfo)); info->partInfo.PartitionLength = pi.PartitionLength; info->partInfo.PartitionNumber = pi.PartitionNumber; info->partInfo.StartingOffset = pi.StartingOffset; if (pi.PartitionStyle == PARTITION_STYLE_MBR) { info->partInfo.PartitionType = pi.Mbr.PartitionType; info->partInfo.BootIndicator = pi.Mbr.BootIndicator; } info->IsGPT = pi.PartitionStyle == PARTITION_STYLE_GPT; } else { // Windows 2000 does not support IOCTL_DISK_GET_PARTITION_INFO_EX ntStatus = TCDeviceIoControl (info->deviceName, IOCTL_DISK_GET_PARTITION_INFO, NULL, 0, &info->partInfo, sizeof (info->partInfo)); info->IsGPT = FALSE; } if (!NT_SUCCESS (ntStatus)) { GET_LENGTH_INFORMATION lengthInfo; ntStatus = TCDeviceIoControl (info->deviceName, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, &lengthInfo, sizeof (lengthInfo)); if (NT_SUCCESS (ntStatus)) { memset (&info->partInfo, 0, sizeof (info->partInfo)); info->partInfo.PartitionLength = lengthInfo.Length; } } info->IsDynamic = FALSE; if (NT_SUCCESS (ntStatus) && OsMajorVersion >= 6) { # define IOCTL_VOLUME_IS_DYNAMIC CTL_CODE(IOCTL_VOLUME_BASE, 18, METHOD_BUFFERED, FILE_ANY_ACCESS) if (!NT_SUCCESS (TCDeviceIoControl (info->deviceName, IOCTL_VOLUME_IS_DYNAMIC, NULL, 0, &info->IsDynamic, sizeof (info->IsDynamic)))) info->IsDynamic = FALSE; } Irp->IoStatus.Information = sizeof (DISK_PARTITION_INFO_STRUCT); Irp->IoStatus.Status = ntStatus; } } break; case TC_IOCTL_GET_DRIVE_GEOMETRY: if (ValidateIOBufferSize (Irp, sizeof (DISK_GEOMETRY_STRUCT), ValidateInputOutput)) { DISK_GEOMETRY_STRUCT *g = (DISK_GEOMETRY_STRUCT *) Irp->AssociatedIrp.SystemBuffer; { NTSTATUS ntStatus; EnsureNullTerminatedString (g->deviceName, sizeof (g->deviceName)); Dump ("Calling IOCTL_DISK_GET_DRIVE_GEOMETRY on %ls\n", g->deviceName); ntStatus = TCDeviceIoControl (g->deviceName, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &g->diskGeometry, sizeof (g->diskGeometry)); Irp->IoStatus.Information = sizeof (DISK_GEOMETRY_STRUCT); Irp->IoStatus.Status = ntStatus; } } break; case VC_IOCTL_GET_DRIVE_GEOMETRY_EX: if (ValidateIOBufferSize (Irp, sizeof (DISK_GEOMETRY_EX_STRUCT), ValidateInputOutput)) { DISK_GEOMETRY_EX_STRUCT *g = (DISK_GEOMETRY_EX_STRUCT *) Irp->AssociatedIrp.SystemBuffer; { NTSTATUS ntStatus; PVOID buffer = TCalloc (256); // enough for DISK_GEOMETRY_EX and padded data if (buffer) { EnsureNullTerminatedString (g->deviceName, sizeof (g->deviceName)); Dump ("Calling IOCTL_DISK_GET_DRIVE_GEOMETRY_EX on %ls\n", g->deviceName); ntStatus = TCDeviceIoControl (g->deviceName, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, buffer, 256); if (NT_SUCCESS(ntStatus)) { PDISK_GEOMETRY_EX pGeo = (PDISK_GEOMETRY_EX) buffer; memcpy (&g->diskGeometry, &pGeo->Geometry, sizeof (DISK_GEOMETRY)); g->DiskSize.QuadPart = pGeo->DiskSize.QuadPart; } else { DISK_GEOMETRY dg = {0}; Dump ("Failed. Calling IOCTL_DISK_GET_DRIVE_GEOMETRY on %ls\n", g->deviceName); ntStatus = TCDeviceIoControl (g->deviceName, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &dg, sizeof (dg)); if (NT_SUCCESS(ntStatus)) { memcpy (&g->diskGeometry, &dg, sizeof (DISK_GEOMETRY)); g->DiskSize.QuadPart = dg.Cylinders.QuadPart * dg.SectorsPerTrack * dg.TracksPerCylinder * dg.BytesPerSector; if (OsMajorVersion >= 6) { STORAGE_READ_CAPACITY storage = {0}; NTSTATUS lStatus; storage.Version = sizeof (STORAGE_READ_CAPACITY); Dump ("Calling IOCTL_STORAGE_READ_CAPACITY on %ls\n", g->deviceName); lStatus = TCDeviceIoControl (g->deviceName, IOCTL_STORAGE_READ_CAPACITY, NULL, 0, &storage, sizeof (STORAGE_READ_CAPACITY)); if ( NT_SUCCESS(lStatus) && (storage.Size == sizeof (STORAGE_READ_CAPACITY)) ) { g->DiskSize.QuadPart = storage.DiskLength.QuadPart; } } } } TCfree (buffer); Irp->IoStatus.Information = sizeof (DISK_GEOMETRY_EX_STRUCT); Irp->IoStatus.Status = ntStatus; } else { Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; Irp->IoStatus.Information = 0; } } } break; case TC_IOCTL_PROBE_REAL_DRIVE_SIZE: if (ValidateIOBufferSize (Irp, sizeof (ProbeRealDriveSizeRequest), ValidateInputOutput)) { ProbeRealDriveSizeRequest *request = (ProbeRealDriveSizeRequest *) Irp->AssociatedIrp.SystemBuffer; NTSTATUS status; UNICODE_STRING name; PFILE_OBJECT fileObject; PDEVICE_OBJECT deviceObject; EnsureNullTerminatedString (request->DeviceName, sizeof (request->DeviceName)); RtlInitUnicodeString (&name, request->DeviceName); status = IoGetDeviceObjectPointer (&name, FILE_READ_ATTRIBUTES, &fileObject, &deviceObject); if (!NT_SUCCESS (status)) { Irp->IoStatus.Information = 0; Irp->IoStatus.Status = status; break; } status = ProbeRealDriveSize (deviceObject, &request->RealDriveSize); ObDereferenceObject (fileObject); if (status == STATUS_TIMEOUT) { request->TimeOut = TRUE; Irp->IoStatus.Information = sizeof (ProbeRealDriveSizeRequest); Irp->IoStatus.Status = STATUS_SUCCESS; } else if (!NT_SUCCESS (status)) { Irp->IoStatus.Information = 0; Irp->IoStatus.Status = status; } else { request->TimeOut = FALSE; Irp->IoStatus.Information = sizeof (ProbeRealDriveSizeRequest); Irp->IoStatus.Status = status; } } break; case TC_IOCTL_MOUNT_VOLUME: if (ValidateIOBufferSize (Irp, sizeof (MOUNT_STRUCT), ValidateInputOutput)) { MOUNT_STRUCT *mount = (MOUNT_STRUCT *) Irp->AssociatedIrp.SystemBuffer; if (mount->VolumePassword.Length > MAX_PASSWORD || mount->ProtectedHidVolPassword.Length > MAX_PASSWORD || mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID || mount->VolumePim < -1 || mount->VolumePim == INT_MAX || mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID || (mount->bTrueCryptMode != FALSE && mount->bTrueCryptMode != TRUE) ) { Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Information = 0; break; } EnsureNullTerminatedString (mount->wszVolume, sizeof (mount->wszVolume)); EnsureNullTerminatedString (mount->wszLabel, sizeof (mount->wszLabel)); Irp->IoStatus.Information = sizeof (MOUNT_STRUCT); Irp->IoStatus.Status = MountDevice (DeviceObject, mount); burn (&mount->VolumePassword, sizeof (mount->VolumePassword)); burn (&mount->ProtectedHidVolPassword, sizeof (mount->ProtectedHidVolPassword)); burn (&mount->pkcs5_prf, sizeof (mount->pkcs5_prf)); burn (&mount->VolumePim, sizeof (mount->VolumePim)); burn (&mount->bTrueCryptMode, sizeof (mount->bTrueCryptMode)); burn (&mount->ProtectedHidVolPkcs5Prf, sizeof (mount->ProtectedHidVolPkcs5Prf)); burn (&mount->ProtectedHidVolPim, sizeof (mount->ProtectedHidVolPim)); } break; case TC_IOCTL_DISMOUNT_VOLUME: if (ValidateIOBufferSize (Irp, sizeof (UNMOUNT_STRUCT), ValidateInputOutput)) { UNMOUNT_STRUCT *unmount = (UNMOUNT_STRUCT *) Irp->AssociatedIrp.SystemBuffer; PDEVICE_OBJECT ListDevice = GetVirtualVolumeDeviceObject (unmount->nDosDriveNo); unmount->nReturnCode = ERR_DRIVE_NOT_FOUND; if (ListDevice) { PEXTENSION ListExtension = (PEXTENSION) ListDevice->DeviceExtension; if (IsVolumeAccessibleByCurrentUser (ListExtension)) unmount->nReturnCode = UnmountDevice (unmount, ListDevice, unmount->ignoreOpenFiles); } Irp->IoStatus.Information = sizeof (UNMOUNT_STRUCT); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_DISMOUNT_ALL_VOLUMES: if (ValidateIOBufferSize (Irp, sizeof (UNMOUNT_STRUCT), ValidateInputOutput)) { UNMOUNT_STRUCT *unmount = (UNMOUNT_STRUCT *) Irp->AssociatedIrp.SystemBuffer; unmount->nReturnCode = UnmountAllDevices (unmount, unmount->ignoreOpenFiles); Irp->IoStatus.Information = sizeof (UNMOUNT_STRUCT); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_BOOT_ENCRYPTION_SETUP: Irp->IoStatus.Status = StartBootEncryptionSetup (DeviceObject, Irp, irpSp); Irp->IoStatus.Information = 0; break; case TC_IOCTL_ABORT_BOOT_ENCRYPTION_SETUP: Irp->IoStatus.Status = AbortBootEncryptionSetup(); Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_BOOT_ENCRYPTION_STATUS: GetBootEncryptionStatus (Irp, irpSp); break; case TC_IOCTL_GET_BOOT_ENCRYPTION_SETUP_RESULT: Irp->IoStatus.Information = 0; Irp->IoStatus.Status = GetSetupResult(); break; case TC_IOCTL_GET_BOOT_DRIVE_VOLUME_PROPERTIES: GetBootDriveVolumeProperties (Irp, irpSp); break; case TC_IOCTL_GET_BOOT_LOADER_VERSION: GetBootLoaderVersion (Irp, irpSp); break; case TC_IOCTL_REOPEN_BOOT_VOLUME_HEADER: ReopenBootVolumeHeader (Irp, irpSp); break; case VC_IOCTL_GET_BOOT_LOADER_FINGERPRINT: GetBootLoaderFingerprint (Irp, irpSp); break; case TC_IOCTL_GET_BOOT_ENCRYPTION_ALGORITHM_NAME: GetBootEncryptionAlgorithmName (Irp, irpSp); break; case TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING: if (ValidateIOBufferSize (Irp, sizeof (int), ValidateOutput)) { *(int *) Irp->AssociatedIrp.SystemBuffer = IsHiddenSystemRunning() ? 1 : 0; Irp->IoStatus.Information = sizeof (int); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_START_DECOY_SYSTEM_WIPE: Irp->IoStatus.Status = StartDecoySystemWipe (DeviceObject, Irp, irpSp); Irp->IoStatus.Information = 0; break; case TC_IOCTL_ABORT_DECOY_SYSTEM_WIPE: Irp->IoStatus.Status = AbortDecoySystemWipe(); Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_DECOY_SYSTEM_WIPE_RESULT: Irp->IoStatus.Status = GetDecoySystemWipeResult(); Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_DECOY_SYSTEM_WIPE_STATUS: GetDecoySystemWipeStatus (Irp, irpSp); break; case TC_IOCTL_WRITE_BOOT_DRIVE_SECTOR: Irp->IoStatus.Status = WriteBootDriveSector (Irp, irpSp); Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_WARNING_FLAGS: if (ValidateIOBufferSize (Irp, sizeof (GetWarningFlagsRequest), ValidateOutput)) { GetWarningFlagsRequest *flags = (GetWarningFlagsRequest *) Irp->AssociatedIrp.SystemBuffer; flags->PagingFileCreationPrevented = PagingFileCreationPrevented; PagingFileCreationPrevented = FALSE; flags->SystemFavoriteVolumeDirty = SystemFavoriteVolumeDirty; SystemFavoriteVolumeDirty = FALSE; Irp->IoStatus.Information = sizeof (GetWarningFlagsRequest); Irp->IoStatus.Status = STATUS_SUCCESS; } break; case TC_IOCTL_SET_SYSTEM_FAVORITE_VOLUME_DIRTY: if (UserCanAccessDriveDevice()) { SystemFavoriteVolumeDirty = TRUE; Irp->IoStatus.Status = STATUS_SUCCESS; } else Irp->IoStatus.Status = STATUS_ACCESS_DENIED; Irp->IoStatus.Information = 0; break; case TC_IOCTL_REREAD_DRIVER_CONFIG: Irp->IoStatus.Status = ReadRegistryConfigFlags (FALSE); Irp->IoStatus.Information = 0; break; case TC_IOCTL_GET_SYSTEM_DRIVE_DUMP_CONFIG: if ( (ValidateIOBufferSize (Irp, sizeof (GetSystemDriveDumpConfigRequest), ValidateOutput)) && (Irp->RequestorMode == KernelMode) ) { GetSystemDriveDumpConfigRequest *request = (GetSystemDriveDumpConfigRequest *) Irp->AssociatedIrp.SystemBuffer; request->BootDriveFilterExtension = GetBootDriveFilterExtension(); if (IsBootDriveMounted() && request->BootDriveFilterExtension) { request->HwEncryptionEnabled = IsHwEncryptionEnabled(); Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = sizeof (*request); } else { Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Information = 0; } } break; default: return TCCompleteIrp (Irp, STATUS_INVALID_DEVICE_REQUEST, 0); } #if defined(DEBUG) || defined(DEBUG_TRACE) if (!NT_SUCCESS (Irp->IoStatus.Status)) { switch (irpSp->Parameters.DeviceIoControl.IoControlCode) { case TC_IOCTL_GET_MOUNTED_VOLUMES: case TC_IOCTL_GET_PASSWORD_CACHE_STATUS: case TC_IOCTL_GET_PORTABLE_MODE_STATUS: case TC_IOCTL_SET_PORTABLE_MODE_STATUS: case TC_IOCTL_OPEN_TEST: case TC_IOCTL_GET_RESOLVED_SYMLINK: case TC_IOCTL_GET_DRIVE_PARTITION_INFO: case TC_IOCTL_GET_BOOT_DRIVE_VOLUME_PROPERTIES: case TC_IOCTL_GET_BOOT_ENCRYPTION_STATUS: case TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING: break; default: Dump ("IOCTL error 0x%08x\n", Irp->IoStatus.Status); } } #endif return TCCompleteIrp (Irp, Irp->IoStatus.Status, Irp->IoStatus.Information); }
4591
True
1
CVE-2019-1010247
False
False
False
True
AV:N/AC:M/Au:N/C:N/I:P/A:N
NETWORK
MEDIUM
NONE
NONE
PARTIAL
NONE
4.3
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.3.10.2', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.3.10.2', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/132a4111bf3791e76437619a66336dce2ce4c79b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://www.compass-security.com/fileadmin/Datein/Research/Advisories/CSNC-2019-001_mod_auth_openidc_reflected_xss.txt', 'name': 'https://www.compass-security.com/fileadmin/Datein/Research/Advisories/CSNC-2019-001_mod_auth_openidc_reflected_xss.txt', 'refsource': 'MISC', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2019/08/msg00029.html', 'name': '[debian-lts-announce] 20190823 [SECURITY] [DLA 1894-1] libapache2-mod-auth-openidc security', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://lists.debian.org/debian-lts-announce/2020/07/msg00028.html', 'name': '[debian-lts-announce] 20200729 [SECURITY] [DLA 2298-1] libapache2-mod-auth-openidc security update', 'refsource': 'MLIST', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-79'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.3.10.2', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'ZmartZone IAM mod_auth_openidc 2.3.10.1 and earlier is affected by: Cross Site Scripting (XSS). The impact is: Redirecting the user to a phishing page or interacting with the application on behalf of the user. The component is: File: src/mod_auth_openidc.c, Line: 3109. The fixed version is: 2.3.10.2.'}]
2020-07-30T00:15Z
2019-07-19T15:15Z
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Cross-site scripting (XSS) vulnerabilities occur when: Untrusted data enters a web application, typically from a web request. The web application dynamically generates a web page that contains this untrusted data. During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc. A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data. Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain. This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain. There are three main kinds of XSS: Type 1: Reflected XSS (or Non-Persistent) - The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser. Type 2: Stored XSS (or Persistent) - The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs. Type 0: DOM-Based XSS - In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible. Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking." In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
https://cwe.mitre.org/data/definitions/79.html
0
Hans Zandbelt
2019-01-22 11:52:16+01:00
release 2.3.10.2: fix XSS vulnerability for poll parameter in OIDC Session Management RP iframe; CSNC-2019-001; thanks Mischa Bachmann Signed-off-by: Hans Zandbelt <[email protected]>
132a4111bf3791e76437619a66336dce2ce4c79b
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_handle_session_management_iframe_rp
oidc_handle_session_management_iframe_rp( request_rec * r , oidc_cfg * c , oidc_session_t * session , const char * client_id , const char * check_session_iframe)
['r', 'c', 'session', 'client_id', 'check_session_iframe']
static int oidc_handle_session_management_iframe_rp(request_rec *r, oidc_cfg *c, oidc_session_t *session, const char *client_id, const char *check_session_iframe) { oidc_debug(r, "enter"); const char *java_script = " <script type=\"text/javascript\">\n" " var targetOrigin = '%s';\n" " var message = '%s' + ' ' + '%s';\n" " var timerID;\n" "\n" " function checkSession() {\n" " console.debug('checkSession: posting ' + message + ' to ' + targetOrigin);\n" " var win = window.parent.document.getElementById('%s').contentWindow;\n" " win.postMessage( message, targetOrigin);\n" " }\n" "\n" " function setTimer() {\n" " checkSession();\n" " timerID = setInterval('checkSession()', %s);\n" " }\n" "\n" " function receiveMessage(e) {\n" " console.debug('receiveMessage: ' + e.data + ' from ' + e.origin);\n" " if (e.origin !== targetOrigin ) {\n" " console.debug('receiveMessage: cross-site scripting attack?');\n" " return;\n" " }\n" " if (e.data != 'unchanged') {\n" " clearInterval(timerID);\n" " if (e.data == 'changed') {\n" " window.location.href = '%s?session=check';\n" " } else {\n" " window.location.href = '%s?session=logout';\n" " }\n" " }\n" " }\n" "\n" " window.addEventListener('message', receiveMessage, false);\n" "\n" " </script>\n"; /* determine the origin for the check_session_iframe endpoint */ char *origin = apr_pstrdup(r->pool, check_session_iframe); apr_uri_t uri; apr_uri_parse(r->pool, check_session_iframe, &uri); char *p = strstr(origin, uri.path); *p = '\0'; /* the element identifier for the OP iframe */ const char *op_iframe_id = "openidc-op"; /* restore the OP session_state from the session */ const char *session_state = oidc_session_get_session_state(r, session); if (session_state == NULL) { oidc_warn(r, "no session_state found in the session; the OP does probably not support session management!?"); return DONE; } char *s_poll_interval = NULL; oidc_util_get_request_parameter(r, "poll", &s_poll_interval); if (s_poll_interval == NULL) s_poll_interval = "3000"; const char *redirect_uri = oidc_get_redirect_uri(r, c); java_script = apr_psprintf(r->pool, java_script, origin, client_id, session_state, op_iframe_id, s_poll_interval, redirect_uri, redirect_uri); return oidc_util_html_send(r, NULL, java_script, "setTimer", NULL, DONE); }
236
True
1
CVE-2019-14857
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:N
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
NONE
5.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-14857', 'name': 'https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-14857', 'refsource': 'CONFIRM', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/pull/451', 'name': 'https://github.com/zmartzone/mod_auth_openidc/pull/451', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/ce37080c6aea30aabae8b4a9b4eea7808445cc8e', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/ce37080c6aea30aabae8b4a9b4eea7808445cc8e', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/5c15dfb08106c2451c2c44ce7ace6813c216ba75', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/5c15dfb08106c2451c2c44ce7ace6813c216ba75', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://groups.google.com/forum/#!topic/mod_auth_openidc/boy1Ba3Gdk4', 'name': 'https://groups.google.com/forum/#!topic/mod_auth_openidc/boy1Ba3Gdk4', 'refsource': 'CONFIRM', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2020/07/msg00028.html', 'name': '[debian-lts-announce] 20200729 [SECURITY] [DLA 2298-1] libapache2-mod-auth-openidc security update', 'refsource': 'MLIST', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-601'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:mod_auth_openidc_project:mod_auth_openidc:*:*:*:*:*:apache:*:*', 'versionEndExcluding': '2.4.0.1', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'A flaw was found in mod_auth_openidc before version 2.4.0.1. An open redirect issue exists in URLs with trailing slashes similar to CVE-2019-3877 in mod_auth_mellon.'}]
2020-07-30T00:15Z
2019-11-26T12:15Z
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
An http parameter may contain a URL value and could cause the web application to redirect the request to the specified URL. By modifying the URL value to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials. Because the server name in the modified link is identical to the original site, phishing attempts have a more trustworthy appearance.
https://cwe.mitre.org/data/definitions/601.html
0
Hans Zandbelt
2019-10-02 21:14:15+02:00
improve validation of the post-logout URL; closes #449 - to avoid an open redirect; thanks AIMOTO Norihito - release 2.4.0.1 Signed-off-by: Hans Zandbelt <[email protected]>
5c15dfb08106c2451c2c44ce7ace6813c216ba75
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_handle_logout
oidc_handle_logout( request_rec * r , oidc_cfg * c , oidc_session_t * session)
['r', 'c', 'session']
static int oidc_handle_logout(request_rec *r, oidc_cfg *c, oidc_session_t *session) { oidc_provider_t *provider = NULL; /* pickup the command or URL where the user wants to go after logout */ char *url = NULL; oidc_util_get_request_parameter(r, OIDC_REDIRECT_URI_REQUEST_LOGOUT, &url); oidc_debug(r, "enter (url=%s)", url); if (oidc_is_front_channel_logout(url)) { return oidc_handle_logout_request(r, c, session, url); } else if (oidc_is_back_channel_logout(url)) { return oidc_handle_logout_backchannel(r, c); } if ((url == NULL) || (apr_strnatcmp(url, "") == 0)) { url = c->default_slo_url; } else { /* do input validation on the logout parameter value */ const char *error_description = NULL; apr_uri_t uri; if (apr_uri_parse(r->pool, url, &uri) != APR_SUCCESS) { const char *error_description = apr_psprintf(r->pool, "Logout URL malformed: %s", url); oidc_error(r, "%s", error_description); return oidc_util_html_send_error(r, c->error_template, "Malformed URL", error_description, HTTP_INTERNAL_SERVER_ERROR); } const char *c_host = oidc_get_current_url_host(r); if ((uri.hostname != NULL) && ((strstr(c_host, uri.hostname) == NULL) || (strstr(uri.hostname, c_host) == NULL))) { error_description = apr_psprintf(r->pool, "logout value \"%s\" does not match the hostname of the current request \"%s\"", apr_uri_unparse(r->pool, &uri, 0), c_host); oidc_error(r, "%s", error_description); return oidc_util_html_send_error(r, c->error_template, "Invalid Request", error_description, HTTP_INTERNAL_SERVER_ERROR); } /* validate the URL to prevent HTTP header splitting */ if (((strstr(url, "\n") != NULL) || strstr(url, "\r") != NULL)) { error_description = apr_psprintf(r->pool, "logout value \"%s\" contains illegal \"\n\" or \"\r\" character(s)", url); oidc_error(r, "%s", error_description); return oidc_util_html_send_error(r, c->error_template, "Invalid Request", error_description, HTTP_INTERNAL_SERVER_ERROR); } } oidc_get_provider_from_session(r, c, session, &provider); if ((provider != NULL) && (provider->end_session_endpoint != NULL)) { const char *id_token_hint = oidc_session_get_idtoken(r, session); char *logout_request = apr_pstrdup(r->pool, provider->end_session_endpoint); if (id_token_hint != NULL) { logout_request = apr_psprintf(r->pool, "%s%sid_token_hint=%s", logout_request, strchr(logout_request ? logout_request : "", OIDC_CHAR_QUERY) != NULL ? OIDC_STR_AMP : OIDC_STR_QUERY, oidc_util_escape_string(r, id_token_hint)); } if (url != NULL) { logout_request = apr_psprintf(r->pool, "%s%spost_logout_redirect_uri=%s", logout_request, strchr(logout_request ? logout_request : "", OIDC_CHAR_QUERY) != NULL ? OIDC_STR_AMP : OIDC_STR_QUERY, oidc_util_escape_string(r, url)); } url = logout_request; } return oidc_handle_logout_request(r, c, session, url); }
512
True
1
CVE-2019-14857
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:N
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
NONE
5.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-14857', 'name': 'https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-14857', 'refsource': 'CONFIRM', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/pull/451', 'name': 'https://github.com/zmartzone/mod_auth_openidc/pull/451', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/ce37080c6aea30aabae8b4a9b4eea7808445cc8e', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/ce37080c6aea30aabae8b4a9b4eea7808445cc8e', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/5c15dfb08106c2451c2c44ce7ace6813c216ba75', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/5c15dfb08106c2451c2c44ce7ace6813c216ba75', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://groups.google.com/forum/#!topic/mod_auth_openidc/boy1Ba3Gdk4', 'name': 'https://groups.google.com/forum/#!topic/mod_auth_openidc/boy1Ba3Gdk4', 'refsource': 'CONFIRM', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2020/07/msg00028.html', 'name': '[debian-lts-announce] 20200729 [SECURITY] [DLA 2298-1] libapache2-mod-auth-openidc security update', 'refsource': 'MLIST', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-601'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:mod_auth_openidc_project:mod_auth_openidc:*:*:*:*:*:apache:*:*', 'versionEndExcluding': '2.4.0.1', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'A flaw was found in mod_auth_openidc before version 2.4.0.1. An open redirect issue exists in URLs with trailing slashes similar to CVE-2019-3877 in mod_auth_mellon.'}]
2020-07-30T00:15Z
2019-11-26T12:15Z
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
An http parameter may contain a URL value and could cause the web application to redirect the request to the specified URL. By modifying the URL value to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials. Because the server name in the modified link is identical to the original site, phishing attempts have a more trustworthy appearance.
https://cwe.mitre.org/data/definitions/601.html
0
Hans Zandbelt
2019-10-03 04:05:31+02:00
2.4.0.2 oops Signed-off-by: Hans Zandbelt <[email protected]>
ce37080c6aea30aabae8b4a9b4eea7808445cc8e
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_validate_post_logout_url
oidc_validate_post_logout_url( request_rec * r , const char * url , char ** err_str , char ** err_desc)
['r', 'url', 'err_str', 'err_desc']
static apr_byte_t oidc_validate_post_logout_url(request_rec *r, const char *url, char **err_str, char **err_desc) { apr_uri_t uri; const char *c_host = NULL; if (apr_uri_parse(r->pool, url, &uri) != APR_SUCCESS) { *err_str = apr_pstrdup(r->pool, "Malformed URL"); *err_desc = apr_psprintf(r->pool, "Logout URL malformed: %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } c_host = oidc_get_current_url_host(r); if ((uri.hostname != NULL) && ((strstr(c_host, uri.hostname) == NULL) || (strstr(uri.hostname, c_host) == NULL))) { *err_str = apr_pstrdup(r->pool, "Invalid Request"); *err_desc = apr_psprintf(r->pool, "logout value \"%s\" does not match the hostname of the current request \"%s\"", apr_uri_unparse(r->pool, &uri, 0), c_host); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } else if (strstr(url, "/") != url) { *err_str = apr_pstrdup(r->pool, "Malformed URL"); *err_desc = apr_psprintf(r->pool, "No hostname was parsed and it does not seem to be relative, i.e starting with '/': %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } /* validate the URL to prevent HTTP header splitting */ if (((strstr(url, "\n") != NULL) || strstr(url, "\r") != NULL)) { *err_str = apr_pstrdup(r->pool, "Invalid Request"); *err_desc = apr_psprintf(r->pool, "logout value \"%s\" contains illegal \"\n\" or \"\r\" character(s)", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } return TRUE; }
319
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_crypto_decrypt
oidc_cache_crypto_decrypt( request_rec * r , const char * cache_value , unsigned char * key , unsigned char ** plaintext)
['r', 'cache_value', 'key', 'plaintext']
static int oidc_cache_crypto_decrypt(request_rec *r, const char *cache_value, unsigned char *key, unsigned char **plaintext) { int len = -1; /* grab the base64url-encoded tag after the "." */ char *encoded_tag = strstr(cache_value, "."); if (encoded_tag == NULL) { oidc_error(r, "corrupted cache value: no tag separator found in encrypted value"); return FALSE; } /* make sure we don't modify the original string since it may be just a pointer into the cache (shm) */ cache_value = apr_pstrmemdup(r->pool, cache_value, strlen(cache_value) - strlen(encoded_tag)); encoded_tag++; /* base64url decode the ciphertext */ char *d_bytes = NULL; int d_len = oidc_base64url_decode(r->pool, &d_bytes, cache_value); /* base64url decode the tag */ char *t_bytes = NULL; int t_len = oidc_base64url_decode(r->pool, &t_bytes, encoded_tag); /* see if we're still good to go */ if ((d_len > 0) && (t_len > 0)) { /* allocated space for the plaintext */ *plaintext = apr_pcalloc(r->pool, (d_len + EVP_CIPHER_block_size(OIDC_CACHE_CIPHER) - 1)); /* decrypt the ciphertext providing the tag value */ len = oidc_cache_crypto_decrypt_impl(r, (unsigned char *) d_bytes, d_len, OIDC_CACHE_CRYPTO_GCM_AAD, sizeof(OIDC_CACHE_CRYPTO_GCM_AAD), (unsigned char *) t_bytes, t_len, key, OIDC_CACHE_CRYPTO_GCM_IV, sizeof(OIDC_CACHE_CRYPTO_GCM_IV), *plaintext); /* check the result and make sure it is \0 terminated */ if (len > -1) { (*plaintext)[len] = '\0'; } else { *plaintext = NULL; } } return len; }
235
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_crypto_decrypt_impl
oidc_cache_crypto_decrypt_impl( request_rec * r , unsigned char * ciphertext , int ciphertext_len , const unsigned char * aad , int aad_len , const unsigned char * tag , int tag_len , unsigned char * key , const unsigned char * iv , int iv_len , unsigned char * plaintext)
['r', 'ciphertext', 'ciphertext_len', 'aad', 'aad_len', 'tag', 'tag_len', 'key', 'iv', 'iv_len', 'plaintext']
static int oidc_cache_crypto_decrypt_impl(request_rec *r, unsigned char *ciphertext, int ciphertext_len, const unsigned char *aad, int aad_len, const unsigned char *tag, int tag_len, unsigned char *key, const unsigned char *iv, int iv_len, unsigned char *plaintext) { EVP_CIPHER_CTX *ctx; int len; int plaintext_len; int ret; /* create and initialize the context */ if (!(ctx = EVP_CIPHER_CTX_new())) { oidc_cache_crypto_openssl_error(r, "EVP_CIPHER_CTX_new"); return -1; } /* initialize the decryption cipher */ if (!EVP_DecryptInit_ex(ctx, OIDC_CACHE_CIPHER, NULL, NULL, NULL)) { oidc_cache_crypto_openssl_error(r, "EVP_DecryptInit_ex"); return -1; } /* set IV length */ if (!EVP_CIPHER_CTX_ctrl(ctx, OIDC_CACHE_CRYPTO_SET_IVLEN, iv_len, NULL)) { oidc_cache_crypto_openssl_error(r, "EVP_CIPHER_CTX_ctrl"); return -1; } /* initialize key and IV */ if (!EVP_DecryptInit_ex(ctx, NULL, NULL, key, iv)) { oidc_cache_crypto_openssl_error(r, "EVP_DecryptInit_ex"); return -1; } /* provide AAD data */ if (!EVP_DecryptUpdate(ctx, NULL, &len, aad, aad_len)) { oidc_cache_crypto_openssl_error(r, "EVP_DecryptUpdate aad: aad_len=%d", aad_len); return -1; } /* provide the message to be decrypted and obtain the plaintext output */ if (!EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len)) { oidc_cache_crypto_openssl_error(r, "EVP_DecryptUpdate ciphertext"); return -1; } plaintext_len = len; /* set expected tag value; works in OpenSSL 1.0.1d and later */ if (!EVP_CIPHER_CTX_ctrl(ctx, OIDC_CACHE_CRYPTO_SET_TAG, tag_len, (void *) tag)) { oidc_cache_crypto_openssl_error(r, "EVP_CIPHER_CTX_ctrl"); return -1; } /* * finalize the decryption; a positive return value indicates success, * anything else is a failure - the plaintext is not trustworthy */ ret = EVP_DecryptFinal_ex(ctx, plaintext + len, &len); /* clean up */ EVP_CIPHER_CTX_free(ctx); if (ret > 0) { /* success */ plaintext_len += len; return plaintext_len; } else { /* verify failed */ oidc_cache_crypto_openssl_error(r, "EVP_DecryptFinal_ex"); return -1; } }
320
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_crypto_encrypt
oidc_cache_crypto_encrypt( request_rec * r , const char * plaintext , unsigned char * key , char ** result)
['r', 'plaintext', 'key', 'result']
static int oidc_cache_crypto_encrypt(request_rec *r, const char *plaintext, unsigned char *key, char **result) { char *encoded = NULL, *p = NULL, *e_tag = NULL; unsigned char *ciphertext = NULL; int plaintext_len, ciphertext_len, encoded_len, e_tag_len; unsigned char tag[OIDC_CACHE_TAG_LEN]; /* allocate space for the ciphertext */ plaintext_len = strlen(plaintext) + 1; ciphertext = apr_pcalloc(r->pool, (plaintext_len + EVP_CIPHER_block_size(OIDC_CACHE_CIPHER))); ciphertext_len = oidc_cache_crypto_encrypt_impl(r, (unsigned char *) plaintext, plaintext_len, OIDC_CACHE_CRYPTO_GCM_AAD, sizeof(OIDC_CACHE_CRYPTO_GCM_AAD), key, OIDC_CACHE_CRYPTO_GCM_IV, sizeof(OIDC_CACHE_CRYPTO_GCM_IV), ciphertext, tag, sizeof(tag)); /* base64url encode the resulting ciphertext */ encoded_len = oidc_base64url_encode(r, &encoded, (const char *) ciphertext, ciphertext_len, 1); if (encoded_len > 0) { p = encoded; /* base64url encode the tag */ e_tag_len = oidc_base64url_encode(r, &e_tag, (const char *) tag, OIDC_CACHE_TAG_LEN, 1); /* now allocated space for the concatenated base64url encoded ciphertext and tag */ encoded = apr_pcalloc(r->pool, encoded_len + 1 + e_tag_len + 1); memcpy(encoded, p, encoded_len); p = encoded + encoded_len; *p = OIDC_CHAR_DOT; p++; /* append the tag in the buffer */ memcpy(p, e_tag, e_tag_len); encoded_len += e_tag_len + 1; /* make sure the result is \0 terminated */ encoded[encoded_len] = '\0'; *result = encoded; } return encoded_len; }
253
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_crypto_encrypt_impl
oidc_cache_crypto_encrypt_impl( request_rec * r , unsigned char * plaintext , int plaintext_len , const unsigned char * aad , int aad_len , unsigned char * key , const unsigned char * iv , int iv_len , unsigned char * ciphertext , const unsigned char * tag , int tag_len)
['r', 'plaintext', 'plaintext_len', 'aad', 'aad_len', 'key', 'iv', 'iv_len', 'ciphertext', 'tag', 'tag_len']
static int oidc_cache_crypto_encrypt_impl(request_rec *r, unsigned char *plaintext, int plaintext_len, const unsigned char *aad, int aad_len, unsigned char *key, const unsigned char *iv, int iv_len, unsigned char *ciphertext, const unsigned char *tag, int tag_len) { EVP_CIPHER_CTX *ctx; int len; int ciphertext_len; /* create and initialize the context */ if (!(ctx = EVP_CIPHER_CTX_new())) { oidc_cache_crypto_openssl_error(r, "EVP_CIPHER_CTX_new"); return -1; } /* initialize the encryption cipher */ if (!EVP_EncryptInit_ex(ctx, OIDC_CACHE_CIPHER, NULL, NULL, NULL)) { oidc_cache_crypto_openssl_error(r, "EVP_EncryptInit_ex"); return -1; } /* set IV length */ if (!EVP_CIPHER_CTX_ctrl(ctx, OIDC_CACHE_CRYPTO_SET_IVLEN, iv_len, NULL)) { oidc_cache_crypto_openssl_error(r, "EVP_CIPHER_CTX_ctrl"); return -1; } /* initialize key and IV */ if (!EVP_EncryptInit_ex(ctx, NULL, NULL, key, iv)) { oidc_cache_crypto_openssl_error(r, "EVP_EncryptInit_ex"); return -1; } /* provide AAD data */ if (!EVP_EncryptUpdate(ctx, NULL, &len, aad, aad_len)) { oidc_cache_crypto_openssl_error(r, "EVP_DecryptUpdate aad: aad_len=%d", aad_len); return -1; } /* provide the message to be encrypted and obtain the encrypted output */ if (!EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len)) { oidc_cache_crypto_openssl_error(r, "EVP_EncryptUpdate ciphertext"); return -1; } ciphertext_len = len; /* * finalize the encryption; normally ciphertext bytes may be written at * this stage, but this does not occur in GCM mode */ if (!EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) { oidc_cache_crypto_openssl_error(r, "EVP_EncryptFinal_ex"); return -1; } ciphertext_len += len; /* get the tag */ if (!EVP_CIPHER_CTX_ctrl(ctx, OIDC_CACHE_CRYPTO_GET_TAG, tag_len, (void *) tag)) { oidc_cache_crypto_openssl_error(r, "EVP_CIPHER_CTX_ctrl"); return -1; } /* clean up */ EVP_CIPHER_CTX_free(ctx); return ciphertext_len; }
309
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_get
oidc_cache_get( request_rec * r , const char * section , const char * key , char ** value)
['r', 'section', 'key', 'value']
apr_byte_t oidc_cache_get(request_rec *r, const char *section, const char *key, char **value) { oidc_cfg *cfg = ap_get_module_config(r->server->module_config, &auth_openidc_module); int encrypted = oidc_cfg_cache_encrypt(r); apr_byte_t rc = TRUE; char *msg = NULL; oidc_debug(r, "enter: %s (section=%s, decrypt=%d, type=%s)", key, section, encrypted, cfg->cache->name); /* see if encryption is turned on */ if (encrypted == 1) key = oidc_cache_get_hashed_key(r, cfg->crypto_passphrase, key); /* get the value from the cache */ const char *cache_value = NULL; if (cfg->cache->get(r, section, key, &cache_value) == FALSE) { rc = FALSE; goto out; } /* see if it is any good */ if (cache_value == NULL) goto out; /* see if encryption is turned on */ if (encrypted == 0) { *value = apr_pstrdup(r->pool, cache_value); goto out; } rc = (oidc_cache_crypto_decrypt(r, cache_value, oidc_cache_hash_passphrase(r, cfg->crypto_passphrase), (unsigned char **) value) > 0); out: /* log the result */ msg = apr_psprintf(r->pool, "from %s cache backend for %skey %s", cfg->cache->name, encrypted ? "encrypted " : "", key); if (rc == TRUE) if (*value != NULL) oidc_debug(r, "cache hit: return %d bytes %s", *value ? (int )strlen(*value) : 0, msg); else oidc_debug(r, "cache miss %s", msg); else oidc_warn(r, "error retrieving value %s", msg); return rc; }
278
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_get_hashed_key
oidc_cache_get_hashed_key( request_rec * r , const char * passphrase , const char * key)
['r', 'passphrase', 'key']
static char *oidc_cache_get_hashed_key(request_rec *r, const char *passphrase, const char *key) { char *input = apr_psprintf(r->pool, "%s:%s", passphrase, key); char *output = NULL; if (oidc_util_hash_string_and_base64url_encode(r, OIDC_JOSE_ALG_SHA256, input, &output) == FALSE) { oidc_error(r, "oidc_util_hash_string_and_base64url_encode returned an error"); return NULL; } return output; }
72
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_hash_passphrase
oidc_cache_hash_passphrase( request_rec * r , const char * passphrase)
['r', 'passphrase']
static unsigned char *oidc_cache_hash_passphrase(request_rec *r, const char *passphrase) { unsigned char *key = NULL; unsigned int key_len = 0; oidc_jose_error_t err; if (oidc_jose_hash_bytes(r->pool, OIDC_JOSE_ALG_SHA256, (const unsigned char *) passphrase, strlen(passphrase), &key, &key_len, &err) == FALSE) { oidc_error(r, "oidc_jose_hash_bytes returned an error: %s", err.text); return NULL; } return key; }
83
True
1
CVE-2021-32791
False
False
False
False
AV:N/AC:M/Au:N/C:P/I:N/A:N
NETWORK
MEDIUM
NONE
PARTIAL
NONE
NONE
4.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
HIGH
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
5.9
MEDIUM
2.2
3.6
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-px3c-6x7j-3r9r', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/375407c16c61a70b56fdbe13b0d2c8f11398e92c', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-330'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, the AES GCM encryption in mod_auth_openidc uses a static IV and AAD. It is important to fix because this creates a static nonce and since aes-gcm is a stream cipher, this can lead to known cryptographic issues, since the same key is being reused. From 2.4.9 onwards this has been patched to use dynamic values through usage of cjose AES encryption routines.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Use of Insufficiently Random Values
The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers.
When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that will be generated, and use this guess to impersonate another user or access sensitive information.
https://cwe.mitre.org/data/definitions/330.html
0
Hans Zandbelt
2021-06-10 15:32:48+02:00
use encrypted JWTs for storing encrypted cache contents - avoid using static AAD/IV; thanks @niebardzo - bump to 2.4.9-dev Signed-off-by: Hans Zandbelt <[email protected]>
375407c16c61a70b56fdbe13b0d2c8f11398e92c
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_cache_set
oidc_cache_set( request_rec * r , const char * section , const char * key , const char * value , apr_time_t expiry)
['r', 'section', 'key', 'value', 'expiry']
apr_byte_t oidc_cache_set(request_rec *r, const char *section, const char *key, const char *value, apr_time_t expiry) { oidc_cfg *cfg = ap_get_module_config(r->server->module_config, &auth_openidc_module); int encrypted = oidc_cfg_cache_encrypt(r); char *encoded = NULL; apr_byte_t rc = FALSE; char *msg = NULL; oidc_debug(r, "enter: %s (section=%s, len=%d, encrypt=%d, ttl(s)=%" APR_TIME_T_FMT ", type=%s)", key, section, value ? (int )strlen(value) : 0, encrypted, apr_time_sec(expiry - apr_time_now()), cfg->cache->name); /* see if we need to encrypt */ if (encrypted == 1) { key = oidc_cache_get_hashed_key(r, cfg->crypto_passphrase, key); if (key == NULL) goto out; if (value != NULL) { if (oidc_cache_crypto_encrypt(r, value, oidc_cache_hash_passphrase(r, cfg->crypto_passphrase), &encoded) <= 0) goto out; value = encoded; } } /* store the resulting value in the cache */ rc = cfg->cache->set(r, section, key, value, expiry); out: /* log the result */ msg = apr_psprintf(r->pool, "%d bytes in %s cache backend for %skey %s", (value ? (int) strlen(value) : 0), (cfg->cache->name ? cfg->cache->name : ""), (encrypted ? "encrypted " : ""), (key ? key : "")); if (rc == TRUE) oidc_debug(r, "successfully stored %s", msg); else oidc_warn(r, "could NOT store %s", msg); return rc; }
283
True
1
CVE-2021-32792
False
False
False
True
AV:N/AC:M/Au:N/C:N/I:P/A:N
NETWORK
MEDIUM
NONE
NONE
PARTIAL
NONE
4.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-79'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, there is an XSS vulnerability in when using `OIDCPreservePost On`.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Cross-site scripting (XSS) vulnerabilities occur when: Untrusted data enters a web application, typically from a web request. The web application dynamically generates a web page that contains this untrusted data. During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc. A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data. Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain. This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain. There are three main kinds of XSS: Type 1: Reflected XSS (or Non-Persistent) - The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser. Type 2: Stored XSS (or Persistent) - The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs. Type 0: DOM-Based XSS - In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible. Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking." In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
https://cwe.mitre.org/data/definitions/79.html
0
Hans Zandbelt
2021-06-25 11:42:57+02:00
avoid XSS vulnerability when using OIDCPreservePost On and supplying URLs that contain single quotes; thanks @oss-aimoto Signed-off-by: Hans Zandbelt <[email protected]>
00c315cb0c8ab77c67be4a2ac08a71a83ac58751
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_request_post_preserved_restore
oidc_request_post_preserved_restore( request_rec * r , const char * original_url)
['r', 'original_url']
static int oidc_request_post_preserved_restore(request_rec *r, const char *original_url) { oidc_debug(r, "enter: original_url=%s", original_url); const char *method = "postOnLoad"; const char *script = apr_psprintf(r->pool, " <script type=\"text/javascript\">\n" " function str_decode(string) {\n" " try {\n" " result = decodeURIComponent(string);\n" " } catch (e) {\n" " result = unescape(string);\n" " }\n" " return result;\n" " }\n" " function %s() {\n" " var mod_auth_openidc_preserve_post_params = JSON.parse(sessionStorage.getItem('mod_auth_openidc_preserve_post_params'));\n" " sessionStorage.removeItem('mod_auth_openidc_preserve_post_params');\n" " for (var key in mod_auth_openidc_preserve_post_params) {\n" " var input = document.createElement(\"input\");\n" " input.name = str_decode(key);\n" " input.value = str_decode(mod_auth_openidc_preserve_post_params[key]);\n" " input.type = \"hidden\";\n" " document.forms[0].appendChild(input);\n" " }\n" " document.forms[0].action = '%s';\n" " document.forms[0].submit();\n" " }\n" " </script>\n", method, original_url); const char *body = " <p>Restoring...</p>\n" " <form method=\"post\"></form>\n"; return oidc_util_html_send(r, "Restoring...", script, method, body, OK); }
93
True
1
CVE-2021-32792
False
False
False
True
AV:N/AC:M/Au:N/C:N/I:P/A:N
NETWORK
MEDIUM
NONE
NONE
PARTIAL
NONE
4.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-79'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, there is an XSS vulnerability in when using `OIDCPreservePost On`.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Cross-site scripting (XSS) vulnerabilities occur when: Untrusted data enters a web application, typically from a web request. The web application dynamically generates a web page that contains this untrusted data. During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc. A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data. Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain. This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain. There are three main kinds of XSS: Type 1: Reflected XSS (or Non-Persistent) - The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser. Type 2: Stored XSS (or Persistent) - The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs. Type 0: DOM-Based XSS - In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible. Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking." In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
https://cwe.mitre.org/data/definitions/79.html
0
AIMOTO NORIHITO
2021-06-28 13:05:52+09:00
Add a function to escape Javascript characters
55ea0a085290cd2c8cdfdd960a230cbc38ba8b56
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_post_preserve_javascript
oidc_post_preserve_javascript( request_rec * r , const char * location , char ** javascript , char ** javascript_method)
['r', 'location', 'javascript', 'javascript_method']
apr_byte_t oidc_post_preserve_javascript(request_rec *r, const char *location, char **javascript, char **javascript_method) { if (oidc_cfg_dir_preserve_post(r) == 0) return FALSE; oidc_debug(r, "enter"); oidc_cfg *cfg = ap_get_module_config(r->server->module_config, &auth_openidc_module); const char *method = oidc_original_request_method(r, cfg, FALSE); if (apr_strnatcmp(method, OIDC_METHOD_FORM_POST) != 0) return FALSE; /* read the parameters that are POST-ed to us */ apr_table_t *params = apr_table_make(r->pool, 8); if (oidc_util_read_post_params(r, params, FALSE, NULL) == FALSE) { oidc_error(r, "something went wrong when reading the POST parameters"); return FALSE; } const apr_array_header_t *arr = apr_table_elts(params); const apr_table_entry_t *elts = (const apr_table_entry_t*) arr->elts; int i; char *json = ""; for (i = 0; i < arr->nelts; i++) { json = apr_psprintf(r->pool, "%s'%s': '%s'%s", json, oidc_util_escape_string(r, elts[i].key), oidc_util_escape_string(r, elts[i].val), i < arr->nelts - 1 ? "," : ""); } json = apr_psprintf(r->pool, "{ %s }", json); const char *jmethod = "preserveOnLoad"; const char *jscript = apr_psprintf(r->pool, " <script type=\"text/javascript\">\n" " function %s() {\n" " sessionStorage.setItem('mod_auth_openidc_preserve_post_params', JSON.stringify(%s));\n" " %s" " }\n" " </script>\n", jmethod, json, location ? apr_psprintf(r->pool, "window.location='%s';\n", location) : ""); if (location == NULL) { if (javascript_method) *javascript_method = apr_pstrdup(r->pool, jmethod); if (javascript) *javascript = apr_pstrdup(r->pool, jscript); } else { oidc_util_html_send(r, "Preserving...", jscript, jmethod, "<p>Preserving...</p>", OK); } return TRUE; }
342
True
1
CVE-2021-32792
False
False
False
True
AV:N/AC:M/Au:N/C:N/I:P/A:N
NETWORK
MEDIUM
NONE
NONE
PARTIAL
NONE
4.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-79'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, there is an XSS vulnerability in when using `OIDCPreservePost On`.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Cross-site scripting (XSS) vulnerabilities occur when: Untrusted data enters a web application, typically from a web request. The web application dynamically generates a web page that contains this untrusted data. During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc. A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data. Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain. This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain. There are three main kinds of XSS: Type 1: Reflected XSS (or Non-Persistent) - The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser. Type 2: Stored XSS (or Persistent) - The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs. Type 0: DOM-Based XSS - In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible. Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking." In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
https://cwe.mitre.org/data/definitions/79.html
0
AIMOTO NORIHITO
2021-06-28 13:05:52+09:00
Add a function to escape Javascript characters
55ea0a085290cd2c8cdfdd960a230cbc38ba8b56
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_request_post_preserved_restore
oidc_request_post_preserved_restore( request_rec * r , const char * original_url)
['r', 'original_url']
static int oidc_request_post_preserved_restore(request_rec *r, const char *original_url) { oidc_debug(r, "enter: original_url=%s", original_url); const char *method = "postOnLoad"; const char *script = apr_psprintf(r->pool, " <script type=\"text/javascript\">\n" " function str_decode(string) {\n" " try {\n" " result = decodeURIComponent(string);\n" " } catch (e) {\n" " result = unescape(string);\n" " }\n" " return result;\n" " }\n" " function %s() {\n" " var mod_auth_openidc_preserve_post_params = JSON.parse(sessionStorage.getItem('mod_auth_openidc_preserve_post_params'));\n" " sessionStorage.removeItem('mod_auth_openidc_preserve_post_params');\n" " for (var key in mod_auth_openidc_preserve_post_params) {\n" " var input = document.createElement(\"input\");\n" " input.name = str_decode(key);\n" " input.value = str_decode(mod_auth_openidc_preserve_post_params[key]);\n" " input.type = \"hidden\";\n" " document.forms[0].appendChild(input);\n" " }\n" " document.forms[0].action = \"%s\";\n" " document.forms[0].submit();\n" " }\n" " </script>\n", method, original_url); const char *body = " <p>Restoring...</p>\n" " <form method=\"post\"></form>\n"; return oidc_util_html_send(r, "Restoring...", script, method, body, OK); }
93
True
1
CVE-2021-32792
False
False
False
True
AV:N/AC:M/Au:N/C:N/I:P/A:N
NETWORK
MEDIUM
NONE
NONE
PARTIAL
NONE
4.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-458c-7pwg-3j7j', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/55ea0a085290cd2c8cdfdd960a230cbc38ba8b56', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/00c315cb0c8ab77c67be4a2ac08a71a83ac58751', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/QXAWKPT5LXZSUTFSJ6IWSZC7RMYYQXQD/', 'name': 'FEDORA-2021-17f5cedf66', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/FZVF6BSJLRQZ7PFFR4X5JSU6KUJYNOCU/', 'name': 'FEDORA-2021-e3017c538a', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'name': 'https://www.oracle.com/security-alerts/cpuapr2022.html', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-79'}]}]
MEDIUM
[{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:*', 'versionStartIncluding': '2.0.0', 'versionEndIncluding': '2.4.48', 'cpe_name': []}]}], 'cpe_match': []}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In mod_auth_openidc before version 2.4.9, there is an XSS vulnerability in when using `OIDCPreservePost On`.'}]
2022-05-10T18:02Z
2021-07-26T17:15Z
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Cross-site scripting (XSS) vulnerabilities occur when: Untrusted data enters a web application, typically from a web request. The web application dynamically generates a web page that contains this untrusted data. During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc. A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data. Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain. This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain. There are three main kinds of XSS: Type 1: Reflected XSS (or Non-Persistent) - The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser. Type 2: Stored XSS (or Persistent) - The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs. Type 0: DOM-Based XSS - In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible. Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking." In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
https://cwe.mitre.org/data/definitions/79.html
0
AIMOTO NORIHITO
2021-06-28 13:05:52+09:00
Add a function to escape Javascript characters
55ea0a085290cd2c8cdfdd960a230cbc38ba8b56
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_session_redirect_parent_window_to_logout
oidc_session_redirect_parent_window_to_logout( request_rec * r , oidc_cfg * c)
['r', 'c']
static int oidc_session_redirect_parent_window_to_logout(request_rec *r, oidc_cfg *c) { oidc_debug(r, "enter"); char *java_script = apr_psprintf(r->pool, " <script type=\"text/javascript\">\n" " window.top.location.href = '%s?session=logout';\n" " </script>\n", oidc_get_redirect_uri(r, c)); return oidc_util_html_send(r, "Redirecting...", java_script, NULL, NULL, OK); }
57
True
1
CVE-2021-39191
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:N
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
NONE
5.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/issues/672', 'name': 'https://github.com/zmartzone/mod_auth_openidc/issues/672', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/03e6bfb446f4e3f27c003d30d6a433e5dd8e2b3d', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/03e6bfb446f4e3f27c003d30d6a433e5dd8e2b3d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9.4', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9.4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-2pgf-8h6h-gqg2', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-2pgf-8h6h-gqg2', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/32RGPW5LZDLDTB7MKZIGAHPSLFOUNWR5/', 'name': 'FEDORA-2021-8d9aca2ded', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RHXO4O4G2UQS7X6OQJCVZKHZAQ7SAIFB/', 'name': 'FEDORA-2022-814ee0c43b', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-601'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In versions prior to 2.4.9.4, the 3rd-party init SSO functionality of mod_auth_openidc was reported to be vulnerable to an open redirect attack by supplying a crafted URL in the `target_link_uri` parameter. A patch in version 2.4.9.4 made it so that the `OIDCRedirectURLsAllowed` setting must be applied to the `target_link_uri` parameter. There are no known workarounds aside from upgrading to a patched version.'}]
2022-05-07T07:15Z
2021-09-03T14:15Z
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
An http parameter may contain a URL value and could cause the web application to redirect the request to the specified URL. By modifying the URL value to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials. Because the server name in the modified link is identical to the original site, phishing attempts have a more trustworthy appearance.
https://cwe.mitre.org/data/definitions/601.html
0
Hans Zandbelt
2021-09-03 10:41:21+02:00
apply OIDCRedirectURLsAllowed setting to target_link_uri closes #672; thanks @Meheni release 2.4.9.4 Signed-off-by: Hans Zandbelt <[email protected]>
03e6bfb446f4e3f27c003d30d6a433e5dd8e2b3d
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_handle_discovery_response
oidc_handle_discovery_response( request_rec * r , oidc_cfg * c)
['r', 'c']
static int oidc_handle_discovery_response(request_rec *r, oidc_cfg *c) { /* variables to hold the values returned in the response */ char *issuer = NULL, *target_link_uri = NULL, *login_hint = NULL, *auth_request_params = NULL, *csrf_cookie, *csrf_query = NULL, *user = NULL, *path_scopes; oidc_provider_t *provider = NULL; oidc_util_get_request_parameter(r, OIDC_DISC_OP_PARAM, &issuer); oidc_util_get_request_parameter(r, OIDC_DISC_USER_PARAM, &user); oidc_util_get_request_parameter(r, OIDC_DISC_RT_PARAM, &target_link_uri); oidc_util_get_request_parameter(r, OIDC_DISC_LH_PARAM, &login_hint); oidc_util_get_request_parameter(r, OIDC_DISC_SC_PARAM, &path_scopes); oidc_util_get_request_parameter(r, OIDC_DISC_AR_PARAM, &auth_request_params); oidc_util_get_request_parameter(r, OIDC_CSRF_NAME, &csrf_query); csrf_cookie = oidc_util_get_cookie(r, OIDC_CSRF_NAME); /* do CSRF protection if not 3rd party initiated SSO */ if (csrf_cookie) { /* clean CSRF cookie */ oidc_util_set_cookie(r, OIDC_CSRF_NAME, "", 0, OIDC_COOKIE_EXT_SAME_SITE_NONE(r)); /* compare CSRF cookie value with query parameter value */ if ((csrf_query == NULL) || apr_strnatcmp(csrf_query, csrf_cookie) != 0) { oidc_warn(r, "CSRF protection failed, no Discovery and dynamic client registration will be allowed"); csrf_cookie = NULL; } } // TODO: trim issuer/accountname/domain input and do more input validation oidc_debug(r, "issuer=\"%s\", target_link_uri=\"%s\", login_hint=\"%s\", user=\"%s\"", issuer, target_link_uri, login_hint, user); if (target_link_uri == NULL) { if (c->default_sso_url == NULL) { return oidc_util_html_send_error(r, c->error_template, "Invalid Request", "SSO to this module without specifying a \"target_link_uri\" parameter is not possible because " OIDCDefaultURL " is not set.", HTTP_INTERNAL_SERVER_ERROR); } target_link_uri = c->default_sso_url; } /* do open redirect prevention */ if (oidc_target_link_uri_matches_configuration(r, c, target_link_uri) == FALSE) { return oidc_util_html_send_error(r, c->error_template, "Invalid Request", "\"target_link_uri\" parameter does not match configuration settings, aborting to prevent an open redirect.", HTTP_UNAUTHORIZED); } /* see if this is a static setup */ if (c->metadata_dir == NULL) { if ((oidc_provider_static_config(r, c, &provider) == TRUE) && (issuer != NULL)) { if (apr_strnatcmp(provider->issuer, issuer) != 0) { return oidc_util_html_send_error(r, c->error_template, "Invalid Request", apr_psprintf(r->pool, "The \"iss\" value must match the configured providers' one (%s != %s).", issuer, c->provider.issuer), HTTP_INTERNAL_SERVER_ERROR); } } return oidc_authenticate_user(r, c, NULL, target_link_uri, login_hint, NULL, NULL, auth_request_params, path_scopes); } /* find out if the user entered an account name or selected an OP manually */ if (user != NULL) { if (login_hint == NULL) login_hint = apr_pstrdup(r->pool, user); /* normalize the user identifier */ if (strstr(user, "https://") != user) user = apr_psprintf(r->pool, "https://%s", user); /* got an user identifier as input, perform OP discovery with that */ if (oidc_proto_url_based_discovery(r, c, user, &issuer) == FALSE) { /* something did not work out, show a user facing error */ return oidc_util_html_send_error(r, c->error_template, "Invalid Request", "Could not resolve the provided user identifier to an OpenID Connect provider; check your syntax.", HTTP_NOT_FOUND); } /* issuer is set now, so let's continue as planned */ } else if (strstr(issuer, OIDC_STR_AT) != NULL) { if (login_hint == NULL) { login_hint = apr_pstrdup(r->pool, issuer); //char *p = strstr(issuer, OIDC_STR_AT); //*p = '\0'; } /* got an account name as input, perform OP discovery with that */ if (oidc_proto_account_based_discovery(r, c, issuer, &issuer) == FALSE) { /* something did not work out, show a user facing error */ return oidc_util_html_send_error(r, c->error_template, "Invalid Request", "Could not resolve the provided account name to an OpenID Connect provider; check your syntax.", HTTP_NOT_FOUND); } /* issuer is set now, so let's continue as planned */ } /* strip trailing '/' */ int n = strlen(issuer); if (issuer[n - 1] == OIDC_CHAR_FORWARD_SLASH) issuer[n - 1] = '\0'; /* try and get metadata from the metadata directories for the selected OP */ if ((oidc_metadata_get(r, c, issuer, &provider, csrf_cookie != NULL) == TRUE) && (provider != NULL)) { /* now we've got a selected OP, send the user there to authenticate */ return oidc_authenticate_user(r, c, provider, target_link_uri, login_hint, NULL, NULL, auth_request_params, path_scopes); } /* something went wrong */ return oidc_util_html_send_error(r, c->error_template, "Invalid Request", "Could not find valid provider metadata for the selected OpenID Connect provider; contact the administrator", HTTP_NOT_FOUND); }
622
True
1
CVE-2021-39191
False
False
False
True
AV:N/AC:M/Au:N/C:P/I:P/A:N
NETWORK
MEDIUM
NONE
PARTIAL
PARTIAL
NONE
5.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NETWORK
LOW
NONE
REQUIRED
CHANGED
LOW
LOW
NONE
6.1
MEDIUM
2.8
2.7
False
[{'url': 'https://github.com/zmartzone/mod_auth_openidc/issues/672', 'name': 'https://github.com/zmartzone/mod_auth_openidc/issues/672', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/commit/03e6bfb446f4e3f27c003d30d6a433e5dd8e2b3d', 'name': 'https://github.com/zmartzone/mod_auth_openidc/commit/03e6bfb446f4e3f27c003d30d6a433e5dd8e2b3d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9.4', 'name': 'https://github.com/zmartzone/mod_auth_openidc/releases/tag/v2.4.9.4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-2pgf-8h6h-gqg2', 'name': 'https://github.com/zmartzone/mod_auth_openidc/security/advisories/GHSA-2pgf-8h6h-gqg2', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/32RGPW5LZDLDTB7MKZIGAHPSLFOUNWR5/', 'name': 'FEDORA-2021-8d9aca2ded', 'refsource': 'FEDORA', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://lists.fedoraproject.org/archives/list/[email protected]/message/RHXO4O4G2UQS7X6OQJCVZKHZAQ7SAIFB/', 'name': 'FEDORA-2022-814ee0c43b', 'refsource': 'FEDORA', 'tags': []}]
[{'description': [{'lang': 'en', 'value': 'CWE-601'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:zmartzone:mod_auth_openidc:*:*:*:*:*:*:*:*', 'versionEndExcluding': '2.4.9.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'mod_auth_openidc is an authentication/authorization module for the Apache 2.x HTTP server that functions as an OpenID Connect Relying Party, authenticating users against an OpenID Connect Provider. In versions prior to 2.4.9.4, the 3rd-party init SSO functionality of mod_auth_openidc was reported to be vulnerable to an open redirect attack by supplying a crafted URL in the `target_link_uri` parameter. A patch in version 2.4.9.4 made it so that the `OIDCRedirectURLsAllowed` setting must be applied to the `target_link_uri` parameter. There are no known workarounds aside from upgrading to a patched version.'}]
2022-05-07T07:15Z
2021-09-03T14:15Z
URL Redirection to Untrusted Site ('Open Redirect')
A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks.
An http parameter may contain a URL value and could cause the web application to redirect the request to the specified URL. By modifying the URL value to a malicious site, an attacker may successfully launch a phishing scam and steal user credentials. Because the server name in the modified link is identical to the original site, phishing attempts have a more trustworthy appearance.
https://cwe.mitre.org/data/definitions/601.html
0
Hans Zandbelt
2021-09-03 10:41:21+02:00
apply OIDCRedirectURLsAllowed setting to target_link_uri closes #672; thanks @Meheni release 2.4.9.4 Signed-off-by: Hans Zandbelt <[email protected]>
03e6bfb446f4e3f27c003d30d6a433e5dd8e2b3d
False
zmartzone/mod_auth_openidc
OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
2014-03-27 18:54:06
2022-08-25 09:59:24
zmartzone
813.0
299.0
oidc_validate_redirect_url
oidc_validate_redirect_url( request_rec * r , oidc_cfg * c , const char * redirect_to_url , apr_byte_t restrict_to_host , char ** err_str , char ** err_desc)
['r', 'c', 'redirect_to_url', 'restrict_to_host', 'err_str', 'err_desc']
static apr_byte_t oidc_validate_redirect_url(request_rec *r, oidc_cfg *c, const char *redirect_to_url, apr_byte_t restrict_to_host, char **err_str, char **err_desc) { apr_uri_t uri; const char *c_host = NULL; apr_hash_index_t *hi = NULL; size_t i = 0; char *url = apr_pstrndup(r->pool, redirect_to_url, OIDC_MAX_URL_LENGTH); // replace potentially harmful backslashes with forward slashes for (i = 0; i < strlen(url); i++) if (url[i] == '\\') url[i] = '/'; if (apr_uri_parse(r->pool, url, &uri) != APR_SUCCESS) { *err_str = apr_pstrdup(r->pool, "Malformed URL"); *err_desc = apr_psprintf(r->pool, "not a valid URL value: %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } if (c->redirect_urls_allowed != NULL) { for (hi = apr_hash_first(NULL, c->redirect_urls_allowed); hi; hi = apr_hash_next(hi)) { apr_hash_this(hi, (const void**) &c_host, NULL, NULL); if (oidc_util_regexp_first_match(r->pool, url, c_host, NULL, err_str) == TRUE) break; } if (hi == NULL) { *err_str = apr_pstrdup(r->pool, "URL not allowed"); *err_desc = apr_psprintf(r->pool, "value does not match the list of allowed redirect URLs: %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } } else if ((uri.hostname != NULL) && (restrict_to_host == TRUE)) { c_host = oidc_get_current_url_host(r); if ((strstr(c_host, uri.hostname) == NULL) || (strstr(uri.hostname, c_host) == NULL)) { *err_str = apr_pstrdup(r->pool, "Invalid Request"); *err_desc = apr_psprintf(r->pool, "URL value \"%s\" does not match the hostname of the current request \"%s\"", apr_uri_unparse(r->pool, &uri, 0), c_host); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } } if ((uri.hostname == NULL) && (strstr(url, "/") != url)) { *err_str = apr_pstrdup(r->pool, "Malformed URL"); *err_desc = apr_psprintf(r->pool, "No hostname was parsed and it does not seem to be relative, i.e starting with '/': %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } else if ((uri.hostname == NULL) && (strstr(url, "//") == url)) { *err_str = apr_pstrdup(r->pool, "Malformed URL"); *err_desc = apr_psprintf(r->pool, "No hostname was parsed and starting with '//': %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } else if ((uri.hostname == NULL) && (strstr(url, "/\\") == url)) { *err_str = apr_pstrdup(r->pool, "Malformed URL"); *err_desc = apr_psprintf(r->pool, "No hostname was parsed and starting with '/\\': %s", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } /* validate the URL to prevent HTTP header splitting */ if (((strstr(url, "\n") != NULL) || strstr(url, "\r") != NULL)) { *err_str = apr_pstrdup(r->pool, "Invalid URL"); *err_desc = apr_psprintf(r->pool, "URL value \"%s\" contains illegal \"\n\" or \"\r\" character(s)", url); oidc_error(r, "%s: %s", *err_str, *err_desc); return FALSE; } return TRUE; }
656
True
1
CVE-2019-1010283
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:N/A:N
NETWORK
LOW
NONE
PARTIAL
NONE
NONE
5.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/univention/univention-corporate-server/commit/a28053045bd2e778c50ed1acaf4e52e1e34f6e34', 'name': 'https://github.com/univention/univention-corporate-server/commit/a28053045bd2e778c50ed1acaf4e52e1e34f6e34', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://forge.univention.org/bugzilla/show_bug.cgi?id=48427', 'name': 'https://forge.univention.org/bugzilla/show_bug.cgi?id=48427', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Vendor Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-200'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:univention:univention_corporate_server:*:*:*:*:*:*:*:*', 'versionEndIncluding': '12.0.1-3', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Univention Corporate Server univention-directory-notifier 12.0.1-3 and earlier is affected by: CWE-213: Intentional Information Exposure. The impact is: Loss of Confidentiality. The component is: function data_on_connection() in src/callback.c. The attack vector is: network connectivity. The fixed version is: 12.0.1-4 and later.'}]
2019-10-09T23:44Z
2019-07-17T21:15Z
Exposure of Sensitive Information to an Unauthorized Actor
The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.
There are many different kinds of mistakes that introduce information exposures. The severity of the error can range widely, depending on the context in which the product operates, the type of sensitive information that is revealed, and the benefits it may provide to an attacker. Some kinds of sensitive information include: private, personal information, such as personal messages, financial data, health records, geographic location, or contact details system status and environment, such as the operating system and installed packages business secrets and intellectual property network status and configuration the product's own code or internal state metadata, e.g. logging of connections or message headers indirect information, such as a discrepancy between two internal operations that can be observed by an outsider Information might be sensitive to different parties, each of which may have their own expectations for whether the information should be protected. These parties include: the product's own users people or organizations whose information is created or used by the product, even if they are not direct product users the product's administrators, including the admins of the system(s) and/or networks on which the product operates the developer Information exposures can occur in different ways: the code explicitly inserts sensitive information into resources or messages that are intentionally made accessible to unauthorized actors, but should not contain the information - i.e., the information should have been "scrubbed" or "sanitized" a different weakness or mistake indirectly inserts the sensitive information into resources, such as a web script error revealing the full system path of the program. the code manages resources that intentionally contain sensitive information, but the resources are unintentionally made accessible to unauthorized actors. In this case, the information exposure is resultant - i.e., a different weakness enabled the access to the information in the first place. It is common practice to describe any loss of confidentiality as an "information exposure," but this can lead to overuse of CWE-200 in CWE mapping. From the CWE perspective, loss of confidentiality is a technical impact that can arise from dozens of different weaknesses, such as insecure file permissions or out-of-bounds read. CWE-200 and its lower-level descendants are intended to cover the mistakes that occur in behaviors that explicitly manage, store, transfer, or cleanse sensitive information.
https://cwe.mitre.org/data/definitions/200.html
0
Philipp Hahn
2019-02-13 10:29:39+01:00
Bug #48427 UDN: Forbid vulnerable GET_DN for VERSION >= 3 UDL using PROTOCOL_3 must no longer use GET_DN but WAIT_DN - if it is still used this is a protocol violation. UDL simply will not get an answer. When UCRV 'notifier/protocol/version is set to 3, any old client still using PROTOCOL_2 will get rejected while negotiating the protocol version, so it is asserted that "version >= network_procotol_version".
a28053045bd2e778c50ed1acaf4e52e1e34f6e34
False
univention/univention-corporate-server
Univention Corporate Server
2017-09-18 08:17:42
2022-08-27 15:17:35
https://www.univention.com/products/ucs/
univention
120.0
47.0
data_on_connection
data_on_connection( int fd , callback_remove_handler remove)
['fd', 'remove']
int data_on_connection(int fd, callback_remove_handler remove) { int nread; char *network_packet; char network_line[8192]; char *p; unsigned long id; char string[1024]; unsigned long msg_id = UINT32_MAX; enum network_protocol version = network_client_get_version(fd); ioctl(fd, FIONREAD, &nread); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "new connection data = %d\n",nread); if(nread == 0) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_PROCESS, "%d failed, got 0 close connection to listener ", fd); close(fd); FD_CLR(fd, &readfds); remove(fd); network_client_dump (); return 0; } if ( nread >= 8192 ) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ERROR, "%d failed, more than 8192 close connection to listener ", fd); close(fd); FD_CLR(fd, &readfds); remove(fd); return 0; } /* read the whole package */ network_packet=malloc((nread+1) * sizeof(char)); read(fd, network_packet, nread); network_packet[nread]='\0'; memset(network_line, 0, 8192); p=network_packet; p_sem(sem_id); while ( get_network_line(p, network_line) ) { if ( strlen(network_line) > 0 ) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "line = [%s]",network_line); } if ( !strncmp(network_line, "MSGID: ", strlen("MSGID: ")) ) { /* read message id */ msg_id=strtoul(&(network_line[strlen("MSGID: ")]), NULL, 10); p+=strlen(network_line); } else if ( !strncmp(network_line, "Version: ", strlen("Version: ")) ) { char *head = network_line, *end; univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: VERSION"); version = strtoul(head + 9, &end, 10); if (!head[9] || *end) goto failed; univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "VERSION=%d", version); if (version < network_procotol_version) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_PROCESS, "Forbidden VERSION=%d < %d, close connection to listener", version, network_procotol_version); goto close; } else if (version >= PROTOCOL_LAST) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_PROCESS, "Future VERSION=%d", version); version = PROTOCOL_LAST - 1; } network_client_set_version(fd, version); /* reset message id */ msg_id = UINT32_MAX; p+=strlen(network_line); } else if ( !strncmp(network_line, "Capabilities: ", strlen("Capabilities: ")) ) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: Capabilities"); if ( version > PROTOCOL_UNKNOWN ) { memset(string, 0, sizeof(string)); snprintf(string, sizeof(string), "Version: %d\nCapabilities: \n\n", version); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "SEND: %s", string); write(fd, string, strlen(string)); } else { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "Capabilities recv, but no version line"); } p+=strlen(network_line); } else if ( !strncmp(network_line, "GET_DN ", strlen("GET_DN ")) && msg_id != UINT32_MAX && network_client_get_version(fd) > 0) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: GET_DN"); id=strtoul(&(network_line[strlen("GET_DN ")]), NULL, 10); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "id: %ld",id); if ( id <= notify_last_id.id) { char *dn_string = NULL; univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "try to read %ld from cache", id); /* try to read from cache */ if ( (dn_string = notifier_cache_get(id)) == NULL ) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "%ld not found in cache", id); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "%ld get one dn", id); /* read from transaction file, because not in cache */ if( (dn_string=notify_transcation_get_one_dn ( id )) == NULL ) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "%ld failed ", id); /* TODO: maybe close connection? */ univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ERROR, "%d failed, close connection to listener ", fd); close(fd); FD_CLR(fd, &readfds); remove(fd); return 0; } } if ( dn_string != NULL ) { snprintf(string, sizeof(string), "MSGID: %ld\n%s\n\n",msg_id,dn_string); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "--> %d: [%s]",fd, string); write(fd, string, strlen(string)); free(dn_string); } } else { /* set wanted id */ network_client_set_next_id(fd, id); network_client_set_msg_id(fd, msg_id); } p+=strlen(network_line)+1; msg_id = UINT32_MAX; } else if (!strncmp(p, "WAIT_ID ", 8) && msg_id != UINT32_MAX && version >= PROTOCOL_3) { char *head = network_line, *end; univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: WAIT_ID"); id = strtoul(head + 8, &end, 10); if (!head[8] || *end) goto failed; univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "id: %ld", id); if (id <= notify_last_id.id) { snprintf(string, sizeof(string), "MSGID: %ld\n%ld\n\n", msg_id, notify_last_id.id); write(fd, string, strlen(string)); } else { /* set wanted id */ network_client_set_next_id(fd, id); network_client_set_msg_id(fd, msg_id); } p += strlen(network_line) + 1; msg_id = UINT32_MAX; } else if ( !strncmp(network_line, "GET_ID", strlen("GET_ID")) && msg_id != UINT32_MAX && network_client_get_version(fd) > 0) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: GET_ID"); memset(string, 0, sizeof(string)); snprintf(string, sizeof(string), "MSGID: %ld\n%ld\n\n",msg_id,notify_last_id.id); write(fd, string, strlen(string)); p+=strlen(network_line)+1; msg_id = UINT32_MAX; } else if ( !strncmp(network_line, "GET_SCHEMA_ID", strlen("GET_SCHEMA_ID")) && msg_id != UINT32_MAX && network_client_get_version(fd) > 0) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: GET_SCHEMA_ID"); memset(string, 0, sizeof(string)); snprintf(string, sizeof(string), "MSGID: %ld\n%ld\n\n",msg_id,SCHEMA_ID); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "--> %d: [%s]",fd, string); write(fd, string, strlen(string)); p+=strlen(network_line)+1; msg_id = UINT32_MAX; } else if ( !strncmp(network_line, "ALIVE", strlen("ALIVE")) && msg_id != UINT32_MAX && network_client_get_version(fd) > 0) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "RECV: ALIVE"); snprintf(string, sizeof(string), "MSGID: %ld\nOKAY\n\n",msg_id); write(fd, string, strlen(string)); p+=strlen(network_line)+1; msg_id = UINT32_MAX; } else { p+=strlen(network_line); if (strlen(network_line) == 0 ) { p+=1; } else { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ERROR, "Drop package [%s]", network_line); } } } v_sem(sem_id); univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ALL, "END Package"); network_client_dump (); return 0; failed: univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_PROCESS, "Failed parsing [%s]", p); close: close(fd); FD_CLR(fd, &readfds); remove(fd); return 0; }
1325
True
1
CVE-2019-1010294
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:N/A:N
NETWORK
LOW
NONE
PARTIAL
NONE
NONE
5.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
NONE
NONE
7.5
HIGH
3.9
3.6
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/7e768f8a473409215fe3fff8f6e31f8a3a0103c6', 'name': 'https://github.com/OP-TEE/optee_os/commit/7e768f8a473409215fe3fff8f6e31f8a3a0103c6', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-189'}]}]
MEDIUM
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Rounding error. The impact is: Potentially leaking code and/or data from previous Trusted Application. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2019-07-16T16:13Z
2019-07-15T18:15Z
Numeric Errors
Weaknesses in this category are related to improper calculation or conversion of numbers.
https://cwe.mitre.org/data/definitions/189.html
1
Joakim Bech
2018-09-07 09:46:25+02:00
core: clear the entire TA area Previously we cleared (memset to zero) the size corresponding to code and data segments, however the allocation for the TA is made on the granularity of the memory pool, meaning that we did not clear all memory and because of that we could potentially leak code and data of a previous loaded TA. Fixes: OP-TEE-2018-0006: "Potential disclosure of previously loaded TA code and data" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Suggested-by: Jens Wiklander <[email protected]> Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
7e768f8a473409215fe3fff8f6e31f8a3a0103c6
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
alloc_ta_mem
alloc_ta_mem( size_t size)
['size']
static struct mobj *alloc_ta_mem(size_t size) { #ifdef CFG_PAGED_USER_TA return mobj_paged_alloc(size); #else struct mobj *mobj = mobj_mm_alloc(mobj_sec_ddr, size, &tee_mm_sec_ddr); if (mobj) memset(mobj_get_va(mobj, 0), 0, size); return mobj; #endif }
49
True
1
CVE-2019-1010296
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/b60e1cee406a1ff521145ab9534370dfb85dd592', 'name': 'https://github.com/OP-TEE/optee_os/commit/b60e1cee406a1ff521145ab9534370dfb85dd592', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Code execution in context of TEE core (kernel). The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
https://cwe.mitre.org/data/definitions/190.html
0
Joakim Bech
2018-09-27 10:15:53+02:00
svc: check for allocation overflow in syscall_cryp_obj_populate Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0009: "Integer overflow in crypto system calls" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
b60e1cee406a1ff521145ab9534370dfb85dd592
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_cryp_obj_populate
syscall_cryp_obj_populate( unsigned long obj , struct utee_attribute * usr_attrs , unsigned long attr_count)
['obj', 'usr_attrs', 'attr_count']
TEE_Result syscall_cryp_obj_populate(unsigned long obj, struct utee_attribute *usr_attrs, unsigned long attr_count) { TEE_Result res; struct tee_ta_session *sess; struct tee_obj *o; const struct tee_cryp_obj_type_props *type_props; TEE_Attribute *attrs = NULL; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), tee_svc_uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) return res; /* Must be a transient object */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0) return TEE_ERROR_BAD_PARAMETERS; /* Must not be initialized already */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0) return TEE_ERROR_BAD_PARAMETERS; type_props = tee_svc_find_type_props(o->info.objectType); if (!type_props) return TEE_ERROR_NOT_IMPLEMENTED; attrs = malloc(sizeof(TEE_Attribute) * attr_count); if (!attrs) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_attrs, attr_count, attrs); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_check_attr(ATTR_USAGE_POPULATE, type_props, attrs, attr_count); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_obj_populate_type(o, type_props, attrs, attr_count); if (res == TEE_SUCCESS) o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; out: free(attrs); return res; }
247
True
1
CVE-2019-1010296
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/b60e1cee406a1ff521145ab9534370dfb85dd592', 'name': 'https://github.com/OP-TEE/optee_os/commit/b60e1cee406a1ff521145ab9534370dfb85dd592', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Code execution in context of TEE core (kernel). The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Joakim Bech
2018-09-27 10:15:53+02:00
svc: check for allocation overflow in syscall_cryp_obj_populate Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0009: "Integer overflow in crypto system calls" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
b60e1cee406a1ff521145ab9534370dfb85dd592
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_cryp_obj_populate
syscall_cryp_obj_populate( unsigned long obj , struct utee_attribute * usr_attrs , unsigned long attr_count)
['obj', 'usr_attrs', 'attr_count']
TEE_Result syscall_cryp_obj_populate(unsigned long obj, struct utee_attribute *usr_attrs, unsigned long attr_count) { TEE_Result res; struct tee_ta_session *sess; struct tee_obj *o; const struct tee_cryp_obj_type_props *type_props; TEE_Attribute *attrs = NULL; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), tee_svc_uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) return res; /* Must be a transient object */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0) return TEE_ERROR_BAD_PARAMETERS; /* Must not be initialized already */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0) return TEE_ERROR_BAD_PARAMETERS; type_props = tee_svc_find_type_props(o->info.objectType); if (!type_props) return TEE_ERROR_NOT_IMPLEMENTED; attrs = malloc(sizeof(TEE_Attribute) * attr_count); if (!attrs) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_attrs, attr_count, attrs); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_check_attr(ATTR_USAGE_POPULATE, type_props, attrs, attr_count); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_obj_populate_type(o, type_props, attrs, attr_count); if (res == TEE_SUCCESS) o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; out: free(attrs); return res; }
247
True
1
CVE-2019-1010297
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'name': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Execution of code in TEE core (kernel) context. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
https://cwe.mitre.org/data/definitions/190.html
0
Joakim Bech
2018-09-27 10:24:26+02:00
svc: check for allocation overflow in crypto calls Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0010: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
a637243270fc1faae16de059091795c32d86e65e
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_cryp_derive_key
syscall_cryp_derive_key( unsigned long state , const struct utee_attribute * usr_params , unsigned long param_count , unsigned long derived_key)
['state', 'usr_params', 'param_count', 'derived_key']
TEE_Result syscall_cryp_derive_key(unsigned long state, const struct utee_attribute *usr_params, unsigned long param_count, unsigned long derived_key) { TEE_Result res = TEE_ERROR_NOT_SUPPORTED; struct tee_ta_session *sess; struct tee_obj *ko; struct tee_obj *so; struct tee_cryp_state *cs; struct tee_cryp_obj_secret *sk; const struct tee_cryp_obj_type_props *type_props; TEE_Attribute *params = NULL; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * param_count); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, param_count, params); if (res != TEE_SUCCESS) goto out; /* Get key set in operation */ res = tee_obj_get(utc, cs->key1, &ko); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, tee_svc_uref_to_vaddr(derived_key), &so); if (res != TEE_SUCCESS) goto out; /* Find information needed about the object to initialize */ sk = so->attr; /* Find description of object */ type_props = tee_svc_find_type_props(so->info.objectType); if (!type_props) { res = TEE_ERROR_NOT_SUPPORTED; goto out; } if (cs->algo == TEE_ALG_DH_DERIVE_SHARED_SECRET) { size_t alloc_size; struct bignum *pub; struct bignum *ss; if (param_count != 1 || params[0].attributeID != TEE_ATTR_DH_PUBLIC_VALUE) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } alloc_size = params[0].content.ref.length * 8; pub = crypto_bignum_allocate(alloc_size); ss = crypto_bignum_allocate(alloc_size); if (pub && ss) { crypto_bignum_bin2bn(params[0].content.ref.buffer, params[0].content.ref.length, pub); res = crypto_acipher_dh_shared_secret(ko->attr, pub, ss); if (res == TEE_SUCCESS) { sk->key_size = crypto_bignum_num_bytes(ss); crypto_bignum_bn2bin(ss, (uint8_t *)(sk + 1)); so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } else { res = TEE_ERROR_OUT_OF_MEMORY; } crypto_bignum_free(pub); crypto_bignum_free(ss); } else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_ECDH) { size_t alloc_size; struct ecc_public_key key_public; uint8_t *pt_secret; unsigned long pt_secret_len; if (param_count != 2 || params[0].attributeID != TEE_ATTR_ECC_PUBLIC_VALUE_X || params[1].attributeID != TEE_ATTR_ECC_PUBLIC_VALUE_Y) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } switch (cs->algo) { case TEE_ALG_ECDH_P192: alloc_size = 192; break; case TEE_ALG_ECDH_P224: alloc_size = 224; break; case TEE_ALG_ECDH_P256: alloc_size = 256; break; case TEE_ALG_ECDH_P384: alloc_size = 384; break; case TEE_ALG_ECDH_P521: alloc_size = 521; break; default: res = TEE_ERROR_NOT_IMPLEMENTED; goto out; } /* Create the public key */ res = crypto_acipher_alloc_ecc_public_key(&key_public, alloc_size); if (res != TEE_SUCCESS) goto out; key_public.curve = ((struct ecc_keypair *)ko->attr)->curve; crypto_bignum_bin2bn(params[0].content.ref.buffer, params[0].content.ref.length, key_public.x); crypto_bignum_bin2bn(params[1].content.ref.buffer, params[1].content.ref.length, key_public.y); pt_secret = (uint8_t *)(sk + 1); pt_secret_len = sk->alloc_size; res = crypto_acipher_ecc_shared_secret(ko->attr, &key_public, pt_secret, &pt_secret_len); if (res == TEE_SUCCESS) { sk->key_size = pt_secret_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } /* free the public key */ crypto_acipher_free_ecc_public_key(&key_public); } #if defined(CFG_CRYPTO_HKDF) else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_HKDF) { void *salt, *info; size_t salt_len, info_len, okm_len; uint32_t hash_id = TEE_ALG_GET_DIGEST_HASH(cs->algo); struct tee_cryp_obj_secret *ik = ko->attr; const uint8_t *ikm = (const uint8_t *)(ik + 1); res = get_hkdf_params(params, param_count, &salt, &salt_len, &info, &info_len, &okm_len); if (res != TEE_SUCCESS) goto out; /* Requested size must fit into the output object's buffer */ if (okm_len > ik->alloc_size) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_cryp_hkdf(hash_id, ikm, ik->key_size, salt, salt_len, info, info_len, (uint8_t *)(sk + 1), okm_len); if (res == TEE_SUCCESS) { sk->key_size = okm_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } #endif #if defined(CFG_CRYPTO_CONCAT_KDF) else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_CONCAT_KDF) { void *info; size_t info_len, derived_key_len; uint32_t hash_id = TEE_ALG_GET_DIGEST_HASH(cs->algo); struct tee_cryp_obj_secret *ss = ko->attr; const uint8_t *shared_secret = (const uint8_t *)(ss + 1); res = get_concat_kdf_params(params, param_count, &info, &info_len, &derived_key_len); if (res != TEE_SUCCESS) goto out; /* Requested size must fit into the output object's buffer */ if (derived_key_len > ss->alloc_size) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_cryp_concat_kdf(hash_id, shared_secret, ss->key_size, info, info_len, (uint8_t *)(sk + 1), derived_key_len); if (res == TEE_SUCCESS) { sk->key_size = derived_key_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } #endif #if defined(CFG_CRYPTO_PBKDF2) else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_PBKDF2) { void *salt; size_t salt_len, iteration_count, derived_key_len; uint32_t hash_id = TEE_ALG_GET_DIGEST_HASH(cs->algo); struct tee_cryp_obj_secret *ss = ko->attr; const uint8_t *password = (const uint8_t *)(ss + 1); res = get_pbkdf2_params(params, param_count, &salt, &salt_len, &derived_key_len, &iteration_count); if (res != TEE_SUCCESS) goto out; /* Requested size must fit into the output object's buffer */ if (derived_key_len > ss->alloc_size) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_cryp_pbkdf2(hash_id, password, ss->key_size, salt, salt_len, iteration_count, (uint8_t *)(sk + 1), derived_key_len); if (res == TEE_SUCCESS) { sk->key_size = derived_key_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } #endif else res = TEE_ERROR_NOT_SUPPORTED; out: free(params); return res; }
1242
True
1
CVE-2019-1010297
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'name': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Execution of code in TEE core (kernel) context. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Joakim Bech
2018-09-27 10:24:26+02:00
svc: check for allocation overflow in crypto calls Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0010: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
a637243270fc1faae16de059091795c32d86e65e
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_cryp_derive_key
syscall_cryp_derive_key( unsigned long state , const struct utee_attribute * usr_params , unsigned long param_count , unsigned long derived_key)
['state', 'usr_params', 'param_count', 'derived_key']
TEE_Result syscall_cryp_derive_key(unsigned long state, const struct utee_attribute *usr_params, unsigned long param_count, unsigned long derived_key) { TEE_Result res = TEE_ERROR_NOT_SUPPORTED; struct tee_ta_session *sess; struct tee_obj *ko; struct tee_obj *so; struct tee_cryp_state *cs; struct tee_cryp_obj_secret *sk; const struct tee_cryp_obj_type_props *type_props; TEE_Attribute *params = NULL; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * param_count); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, param_count, params); if (res != TEE_SUCCESS) goto out; /* Get key set in operation */ res = tee_obj_get(utc, cs->key1, &ko); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, tee_svc_uref_to_vaddr(derived_key), &so); if (res != TEE_SUCCESS) goto out; /* Find information needed about the object to initialize */ sk = so->attr; /* Find description of object */ type_props = tee_svc_find_type_props(so->info.objectType); if (!type_props) { res = TEE_ERROR_NOT_SUPPORTED; goto out; } if (cs->algo == TEE_ALG_DH_DERIVE_SHARED_SECRET) { size_t alloc_size; struct bignum *pub; struct bignum *ss; if (param_count != 1 || params[0].attributeID != TEE_ATTR_DH_PUBLIC_VALUE) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } alloc_size = params[0].content.ref.length * 8; pub = crypto_bignum_allocate(alloc_size); ss = crypto_bignum_allocate(alloc_size); if (pub && ss) { crypto_bignum_bin2bn(params[0].content.ref.buffer, params[0].content.ref.length, pub); res = crypto_acipher_dh_shared_secret(ko->attr, pub, ss); if (res == TEE_SUCCESS) { sk->key_size = crypto_bignum_num_bytes(ss); crypto_bignum_bn2bin(ss, (uint8_t *)(sk + 1)); so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } else { res = TEE_ERROR_OUT_OF_MEMORY; } crypto_bignum_free(pub); crypto_bignum_free(ss); } else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_ECDH) { size_t alloc_size; struct ecc_public_key key_public; uint8_t *pt_secret; unsigned long pt_secret_len; if (param_count != 2 || params[0].attributeID != TEE_ATTR_ECC_PUBLIC_VALUE_X || params[1].attributeID != TEE_ATTR_ECC_PUBLIC_VALUE_Y) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } switch (cs->algo) { case TEE_ALG_ECDH_P192: alloc_size = 192; break; case TEE_ALG_ECDH_P224: alloc_size = 224; break; case TEE_ALG_ECDH_P256: alloc_size = 256; break; case TEE_ALG_ECDH_P384: alloc_size = 384; break; case TEE_ALG_ECDH_P521: alloc_size = 521; break; default: res = TEE_ERROR_NOT_IMPLEMENTED; goto out; } /* Create the public key */ res = crypto_acipher_alloc_ecc_public_key(&key_public, alloc_size); if (res != TEE_SUCCESS) goto out; key_public.curve = ((struct ecc_keypair *)ko->attr)->curve; crypto_bignum_bin2bn(params[0].content.ref.buffer, params[0].content.ref.length, key_public.x); crypto_bignum_bin2bn(params[1].content.ref.buffer, params[1].content.ref.length, key_public.y); pt_secret = (uint8_t *)(sk + 1); pt_secret_len = sk->alloc_size; res = crypto_acipher_ecc_shared_secret(ko->attr, &key_public, pt_secret, &pt_secret_len); if (res == TEE_SUCCESS) { sk->key_size = pt_secret_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } /* free the public key */ crypto_acipher_free_ecc_public_key(&key_public); } #if defined(CFG_CRYPTO_HKDF) else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_HKDF) { void *salt, *info; size_t salt_len, info_len, okm_len; uint32_t hash_id = TEE_ALG_GET_DIGEST_HASH(cs->algo); struct tee_cryp_obj_secret *ik = ko->attr; const uint8_t *ikm = (const uint8_t *)(ik + 1); res = get_hkdf_params(params, param_count, &salt, &salt_len, &info, &info_len, &okm_len); if (res != TEE_SUCCESS) goto out; /* Requested size must fit into the output object's buffer */ if (okm_len > ik->alloc_size) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_cryp_hkdf(hash_id, ikm, ik->key_size, salt, salt_len, info, info_len, (uint8_t *)(sk + 1), okm_len); if (res == TEE_SUCCESS) { sk->key_size = okm_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } #endif #if defined(CFG_CRYPTO_CONCAT_KDF) else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_CONCAT_KDF) { void *info; size_t info_len, derived_key_len; uint32_t hash_id = TEE_ALG_GET_DIGEST_HASH(cs->algo); struct tee_cryp_obj_secret *ss = ko->attr; const uint8_t *shared_secret = (const uint8_t *)(ss + 1); res = get_concat_kdf_params(params, param_count, &info, &info_len, &derived_key_len); if (res != TEE_SUCCESS) goto out; /* Requested size must fit into the output object's buffer */ if (derived_key_len > ss->alloc_size) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_cryp_concat_kdf(hash_id, shared_secret, ss->key_size, info, info_len, (uint8_t *)(sk + 1), derived_key_len); if (res == TEE_SUCCESS) { sk->key_size = derived_key_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } #endif #if defined(CFG_CRYPTO_PBKDF2) else if (TEE_ALG_GET_MAIN_ALG(cs->algo) == TEE_MAIN_ALGO_PBKDF2) { void *salt; size_t salt_len, iteration_count, derived_key_len; uint32_t hash_id = TEE_ALG_GET_DIGEST_HASH(cs->algo); struct tee_cryp_obj_secret *ss = ko->attr; const uint8_t *password = (const uint8_t *)(ss + 1); res = get_pbkdf2_params(params, param_count, &salt, &salt_len, &derived_key_len, &iteration_count); if (res != TEE_SUCCESS) goto out; /* Requested size must fit into the output object's buffer */ if (derived_key_len > ss->alloc_size) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } res = tee_cryp_pbkdf2(hash_id, password, ss->key_size, salt, salt_len, iteration_count, (uint8_t *)(sk + 1), derived_key_len); if (res == TEE_SUCCESS) { sk->key_size = derived_key_len; so->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; set_attribute(so, type_props, TEE_ATTR_SECRET_VALUE); } } #endif else res = TEE_ERROR_NOT_SUPPORTED; out: free(params); return res; }
1242
True
1
CVE-2019-1010297
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'name': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Execution of code in TEE core (kernel) context. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
https://cwe.mitre.org/data/definitions/190.html
0
Joakim Bech
2018-09-27 10:24:26+02:00
svc: check for allocation overflow in crypto calls Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0010: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
a637243270fc1faae16de059091795c32d86e65e
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_obj_generate_key
syscall_obj_generate_key( unsigned long obj , unsigned long key_size , const struct utee_attribute * usr_params , unsigned long param_count)
['obj', 'key_size', 'usr_params', 'param_count']
TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size, const struct utee_attribute *usr_params, unsigned long param_count) { TEE_Result res; struct tee_ta_session *sess; const struct tee_cryp_obj_type_props *type_props; struct tee_obj *o; struct tee_cryp_obj_secret *key; size_t byte_size; TEE_Attribute *params = NULL; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), tee_svc_uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) return res; /* Must be a transient object */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0) return TEE_ERROR_BAD_STATE; /* Must not be initialized already */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0) return TEE_ERROR_BAD_STATE; /* Find description of object */ type_props = tee_svc_find_type_props(o->info.objectType); if (!type_props) return TEE_ERROR_NOT_SUPPORTED; /* Check that maxKeySize follows restrictions */ if (key_size % type_props->quanta != 0) return TEE_ERROR_NOT_SUPPORTED; if (key_size < type_props->min_size) return TEE_ERROR_NOT_SUPPORTED; if (key_size > type_props->max_size) return TEE_ERROR_NOT_SUPPORTED; params = malloc(sizeof(TEE_Attribute) * param_count); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_params, param_count, params); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_check_attr(ATTR_USAGE_GENERATE_KEY, type_props, params, param_count); if (res != TEE_SUCCESS) goto out; switch (o->info.objectType) { case TEE_TYPE_AES: case TEE_TYPE_DES: case TEE_TYPE_DES3: case TEE_TYPE_HMAC_MD5: case TEE_TYPE_HMAC_SHA1: case TEE_TYPE_HMAC_SHA224: case TEE_TYPE_HMAC_SHA256: case TEE_TYPE_HMAC_SHA384: case TEE_TYPE_HMAC_SHA512: case TEE_TYPE_GENERIC_SECRET: byte_size = key_size / 8; /* * We have to do it like this because the parity bits aren't * counted when telling the size of the key in bits. */ if (o->info.objectType == TEE_TYPE_DES || o->info.objectType == TEE_TYPE_DES3) { byte_size = (key_size + key_size / 7) / 8; } key = (struct tee_cryp_obj_secret *)o->attr; if (byte_size > key->alloc_size) { res = TEE_ERROR_EXCESS_DATA; goto out; } res = crypto_rng_read((void *)(key + 1), byte_size); if (res != TEE_SUCCESS) goto out; key->key_size = byte_size; /* Set bits for all known attributes for this object type */ o->have_attrs = (1 << type_props->num_type_attrs) - 1; break; case TEE_TYPE_RSA_KEYPAIR: res = tee_svc_obj_generate_key_rsa(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DSA_KEYPAIR: res = tee_svc_obj_generate_key_dsa(o, type_props, key_size); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DH_KEYPAIR: res = tee_svc_obj_generate_key_dh(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_ECDSA_KEYPAIR: case TEE_TYPE_ECDH_KEYPAIR: res = tee_svc_obj_generate_key_ecc(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; default: res = TEE_ERROR_BAD_FORMAT; } out: free(params); if (res == TEE_SUCCESS) { o->info.keySize = key_size; o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; } return res; }
568
True
1
CVE-2019-1010297
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'name': 'https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Execution of code in TEE core (kernel) context. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Joakim Bech
2018-09-27 10:24:26+02:00
svc: check for allocation overflow in crypto calls Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0010: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
a637243270fc1faae16de059091795c32d86e65e
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_obj_generate_key
syscall_obj_generate_key( unsigned long obj , unsigned long key_size , const struct utee_attribute * usr_params , unsigned long param_count)
['obj', 'key_size', 'usr_params', 'param_count']
TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size, const struct utee_attribute *usr_params, unsigned long param_count) { TEE_Result res; struct tee_ta_session *sess; const struct tee_cryp_obj_type_props *type_props; struct tee_obj *o; struct tee_cryp_obj_secret *key; size_t byte_size; TEE_Attribute *params = NULL; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), tee_svc_uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) return res; /* Must be a transient object */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0) return TEE_ERROR_BAD_STATE; /* Must not be initialized already */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0) return TEE_ERROR_BAD_STATE; /* Find description of object */ type_props = tee_svc_find_type_props(o->info.objectType); if (!type_props) return TEE_ERROR_NOT_SUPPORTED; /* Check that maxKeySize follows restrictions */ if (key_size % type_props->quanta != 0) return TEE_ERROR_NOT_SUPPORTED; if (key_size < type_props->min_size) return TEE_ERROR_NOT_SUPPORTED; if (key_size > type_props->max_size) return TEE_ERROR_NOT_SUPPORTED; params = malloc(sizeof(TEE_Attribute) * param_count); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_params, param_count, params); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_check_attr(ATTR_USAGE_GENERATE_KEY, type_props, params, param_count); if (res != TEE_SUCCESS) goto out; switch (o->info.objectType) { case TEE_TYPE_AES: case TEE_TYPE_DES: case TEE_TYPE_DES3: case TEE_TYPE_HMAC_MD5: case TEE_TYPE_HMAC_SHA1: case TEE_TYPE_HMAC_SHA224: case TEE_TYPE_HMAC_SHA256: case TEE_TYPE_HMAC_SHA384: case TEE_TYPE_HMAC_SHA512: case TEE_TYPE_GENERIC_SECRET: byte_size = key_size / 8; /* * We have to do it like this because the parity bits aren't * counted when telling the size of the key in bits. */ if (o->info.objectType == TEE_TYPE_DES || o->info.objectType == TEE_TYPE_DES3) { byte_size = (key_size + key_size / 7) / 8; } key = (struct tee_cryp_obj_secret *)o->attr; if (byte_size > key->alloc_size) { res = TEE_ERROR_EXCESS_DATA; goto out; } res = crypto_rng_read((void *)(key + 1), byte_size); if (res != TEE_SUCCESS) goto out; key->key_size = byte_size; /* Set bits for all known attributes for this object type */ o->have_attrs = (1 << type_props->num_type_attrs) - 1; break; case TEE_TYPE_RSA_KEYPAIR: res = tee_svc_obj_generate_key_rsa(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DSA_KEYPAIR: res = tee_svc_obj_generate_key_dsa(o, type_props, key_size); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DH_KEYPAIR: res = tee_svc_obj_generate_key_dh(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_ECDSA_KEYPAIR: case TEE_TYPE_ECDH_KEYPAIR: res = tee_svc_obj_generate_key_ecc(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; default: res = TEE_ERROR_BAD_FORMAT; } out: free(params); if (res == TEE_SUCCESS) { o->info.keySize = key_size; o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; } return res; }
568
True
1
CVE-2019-1010298
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'name': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Code execution in the context of TEE core (kernel). The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
https://cwe.mitre.org/data/definitions/190.html
0
Joakim Bech
2018-09-27 10:30:20+02:00
svc: check for allocation overflow in crypto calls part 2 Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0011: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_asymm_operate
syscall_asymm_operate( unsigned long state , const struct utee_attribute * usr_params , size_t num_params , const void * src_data , size_t src_len , void * dst_data , uint64_t * dst_len)
['state', 'usr_params', 'num_params', 'src_data', 'src_len', 'dst_data', 'dst_len']
TEE_Result syscall_asymm_operate(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *src_data, size_t src_len, void *dst_data, uint64_t *dst_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; uint64_t dlen64; size_t dlen; struct tee_obj *o; void *label = NULL; size_t label_len = 0; size_t n; int salt_len; TEE_Attribute *params = NULL; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) src_data, src_len); if (res != TEE_SUCCESS) return res; res = tee_svc_copy_from_user(&dlen64, dst_len, sizeof(dlen64)); if (res != TEE_SUCCESS) return res; dlen = dlen64; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) dst_data, dlen); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * num_params); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, num_params, params); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, cs->key1, &o); if (res != TEE_SUCCESS) goto out; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) { res = TEE_ERROR_GENERIC; goto out; } switch (cs->algo) { case TEE_ALG_RSA_NOPAD: if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsanopad_encrypt(o->attr, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsanopad_decrypt(o->attr, src_data, src_len, dst_data, &dlen); } else { /* * We will panic because "the mode is not compatible * with the function" */ res = TEE_ERROR_GENERIC; } break; case TEE_ALG_RSAES_PKCS1_V1_5: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512: for (n = 0; n < num_params; n++) { if (params[n].attributeID == TEE_ATTR_RSA_OAEP_LABEL) { label = params[n].content.ref.buffer; label_len = params[n].content.ref.length; break; } } if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsaes_encrypt(cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsaes_decrypt( cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else { res = TEE_ERROR_BAD_PARAMETERS; } break; #if defined(CFG_CRYPTO_RSASSA_NA1) case TEE_ALG_RSASSA_PKCS1_V1_5: #endif case TEE_ALG_RSASSA_PKCS1_V1_5_MD5: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA1: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA224: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA256: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA384: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA512: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512: if (cs->mode != TEE_MODE_SIGN) { res = TEE_ERROR_BAD_PARAMETERS; break; } salt_len = pkcs1_get_salt_len(params, num_params, src_len); res = crypto_acipher_rsassa_sign(cs->algo, o->attr, salt_len, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_DSA_SHA1: case TEE_ALG_DSA_SHA224: case TEE_ALG_DSA_SHA256: res = crypto_acipher_dsa_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_ECDSA_P192: case TEE_ALG_ECDSA_P224: case TEE_ALG_ECDSA_P256: case TEE_ALG_ECDSA_P384: case TEE_ALG_ECDSA_P521: res = crypto_acipher_ecc_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; default: res = TEE_ERROR_BAD_PARAMETERS; break; } out: free(params); if (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) { TEE_Result res2; dlen64 = dlen; res2 = tee_svc_copy_to_user(dst_len, &dlen64, sizeof(*dst_len)); if (res2 != TEE_SUCCESS) return res2; } return res; }
763
True
1
CVE-2019-1010298
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'name': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Code execution in the context of TEE core (kernel). The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Joakim Bech
2018-09-27 10:30:20+02:00
svc: check for allocation overflow in crypto calls part 2 Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0011: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_asymm_operate
syscall_asymm_operate( unsigned long state , const struct utee_attribute * usr_params , size_t num_params , const void * src_data , size_t src_len , void * dst_data , uint64_t * dst_len)
['state', 'usr_params', 'num_params', 'src_data', 'src_len', 'dst_data', 'dst_len']
TEE_Result syscall_asymm_operate(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *src_data, size_t src_len, void *dst_data, uint64_t *dst_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; uint64_t dlen64; size_t dlen; struct tee_obj *o; void *label = NULL; size_t label_len = 0; size_t n; int salt_len; TEE_Attribute *params = NULL; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) src_data, src_len); if (res != TEE_SUCCESS) return res; res = tee_svc_copy_from_user(&dlen64, dst_len, sizeof(dlen64)); if (res != TEE_SUCCESS) return res; dlen = dlen64; res = tee_mmu_check_access_rights( utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t) dst_data, dlen); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * num_params); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, num_params, params); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, cs->key1, &o); if (res != TEE_SUCCESS) goto out; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) { res = TEE_ERROR_GENERIC; goto out; } switch (cs->algo) { case TEE_ALG_RSA_NOPAD: if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsanopad_encrypt(o->attr, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsanopad_decrypt(o->attr, src_data, src_len, dst_data, &dlen); } else { /* * We will panic because "the mode is not compatible * with the function" */ res = TEE_ERROR_GENERIC; } break; case TEE_ALG_RSAES_PKCS1_V1_5: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384: case TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512: for (n = 0; n < num_params; n++) { if (params[n].attributeID == TEE_ATTR_RSA_OAEP_LABEL) { label = params[n].content.ref.buffer; label_len = params[n].content.ref.length; break; } } if (cs->mode == TEE_MODE_ENCRYPT) { res = crypto_acipher_rsaes_encrypt(cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else if (cs->mode == TEE_MODE_DECRYPT) { res = crypto_acipher_rsaes_decrypt( cs->algo, o->attr, label, label_len, src_data, src_len, dst_data, &dlen); } else { res = TEE_ERROR_BAD_PARAMETERS; } break; #if defined(CFG_CRYPTO_RSASSA_NA1) case TEE_ALG_RSASSA_PKCS1_V1_5: #endif case TEE_ALG_RSASSA_PKCS1_V1_5_MD5: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA1: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA224: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA256: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA384: case TEE_ALG_RSASSA_PKCS1_V1_5_SHA512: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384: case TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512: if (cs->mode != TEE_MODE_SIGN) { res = TEE_ERROR_BAD_PARAMETERS; break; } salt_len = pkcs1_get_salt_len(params, num_params, src_len); res = crypto_acipher_rsassa_sign(cs->algo, o->attr, salt_len, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_DSA_SHA1: case TEE_ALG_DSA_SHA224: case TEE_ALG_DSA_SHA256: res = crypto_acipher_dsa_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; case TEE_ALG_ECDSA_P192: case TEE_ALG_ECDSA_P224: case TEE_ALG_ECDSA_P256: case TEE_ALG_ECDSA_P384: case TEE_ALG_ECDSA_P521: res = crypto_acipher_ecc_sign(cs->algo, o->attr, src_data, src_len, dst_data, &dlen); break; default: res = TEE_ERROR_BAD_PARAMETERS; break; } out: free(params); if (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) { TEE_Result res2; dlen64 = dlen; res2 = tee_svc_copy_to_user(dst_len, &dlen64, sizeof(*dst_len)); if (res2 != TEE_SUCCESS) return res2; } return res; }
763
True
1
CVE-2019-1010298
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'name': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Code execution in the context of TEE core (kernel). The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Integer Overflow or Wraparound
The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.
An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
https://cwe.mitre.org/data/definitions/190.html
0
Joakim Bech
2018-09-27 10:30:20+02:00
svc: check for allocation overflow in crypto calls part 2 Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0011: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_asymm_verify
syscall_asymm_verify( unsigned long state , const struct utee_attribute * usr_params , size_t num_params , const void * data , size_t data_len , const void * sig , size_t sig_len)
['state', 'usr_params', 'num_params', 'data', 'data_len', 'sig', 'sig_len']
TEE_Result syscall_asymm_verify(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *data, size_t data_len, const void *sig, size_t sig_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; struct tee_obj *o; size_t hash_size; int salt_len = 0; TEE_Attribute *params = NULL; uint32_t hash_algo; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; if (cs->mode != TEE_MODE_VERIFY) return TEE_ERROR_BAD_PARAMETERS; res = tee_mmu_check_access_rights(utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)data, data_len); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights(utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)sig, sig_len); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * num_params); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, num_params, params); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, cs->key1, &o); if (res != TEE_SUCCESS) goto out; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } switch (TEE_ALG_GET_MAIN_ALG(cs->algo)) { case TEE_MAIN_ALGO_RSA: if (cs->algo != TEE_ALG_RSASSA_PKCS1_V1_5) { hash_algo = TEE_DIGEST_HASH_TO_ALGO(cs->algo); res = tee_hash_get_digest_size(hash_algo, &hash_size); if (res != TEE_SUCCESS) break; if (data_len != hash_size) { res = TEE_ERROR_BAD_PARAMETERS; break; } salt_len = pkcs1_get_salt_len(params, num_params, hash_size); } res = crypto_acipher_rsassa_verify(cs->algo, o->attr, salt_len, data, data_len, sig, sig_len); break; case TEE_MAIN_ALGO_DSA: hash_algo = TEE_DIGEST_HASH_TO_ALGO(cs->algo); res = tee_hash_get_digest_size(hash_algo, &hash_size); if (res != TEE_SUCCESS) break; /* * Depending on the DSA algorithm (NIST), the digital signature * output size may be truncated to the size of a key pair * (Q prime size). Q prime size must be less or equal than the * hash output length of the hash algorithm involved. */ if (data_len > hash_size) { res = TEE_ERROR_BAD_PARAMETERS; break; } res = crypto_acipher_dsa_verify(cs->algo, o->attr, data, data_len, sig, sig_len); break; case TEE_MAIN_ALGO_ECDSA: res = crypto_acipher_ecc_verify(cs->algo, o->attr, data, data_len, sig, sig_len); break; default: res = TEE_ERROR_NOT_SUPPORTED; } out: free(params); return res; }
486
True
1
CVE-2019-1010298
False
False
False
False
AV:N/AC:L/Au:N/C:C/I:C/A:C
NETWORK
LOW
NONE
COMPLETE
COMPLETE
COMPLETE
10.0
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'name': 'https://github.com/OP-TEE/optee_os/commit/70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}, {'lang': 'en', 'value': 'CWE-190'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Code execution in the context of TEE core (kernel). The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Joakim Bech
2018-09-27 10:30:20+02:00
svc: check for allocation overflow in crypto calls part 2 Without checking for overflow there is a risk of allocating a buffer with size smaller than anticipated and as a consequence of that it might lead to a heap based overflow with attacker controlled data written outside the boundaries of the buffer. Fixes: OP-TEE-2018-0011: "Integer overflow in crypto system calls (x2)" Signed-off-by: Joakim Bech <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Jens Wiklander <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
70697bf3c5dc3d201341b01a1a8e5bc6d2fb48f8
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
syscall_asymm_verify
syscall_asymm_verify( unsigned long state , const struct utee_attribute * usr_params , size_t num_params , const void * data , size_t data_len , const void * sig , size_t sig_len)
['state', 'usr_params', 'num_params', 'data', 'data_len', 'sig', 'sig_len']
TEE_Result syscall_asymm_verify(unsigned long state, const struct utee_attribute *usr_params, size_t num_params, const void *data, size_t data_len, const void *sig, size_t sig_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; struct tee_obj *o; size_t hash_size; int salt_len = 0; TEE_Attribute *params = NULL; uint32_t hash_algo; struct user_ta_ctx *utc; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; utc = to_user_ta_ctx(sess->ctx); res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; if (cs->mode != TEE_MODE_VERIFY) return TEE_ERROR_BAD_PARAMETERS; res = tee_mmu_check_access_rights(utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)data, data_len); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights(utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)sig, sig_len); if (res != TEE_SUCCESS) return res; params = malloc(sizeof(TEE_Attribute) * num_params); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(utc, usr_params, num_params, params); if (res != TEE_SUCCESS) goto out; res = tee_obj_get(utc, cs->key1, &o); if (res != TEE_SUCCESS) goto out; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) { res = TEE_ERROR_BAD_PARAMETERS; goto out; } switch (TEE_ALG_GET_MAIN_ALG(cs->algo)) { case TEE_MAIN_ALGO_RSA: if (cs->algo != TEE_ALG_RSASSA_PKCS1_V1_5) { hash_algo = TEE_DIGEST_HASH_TO_ALGO(cs->algo); res = tee_hash_get_digest_size(hash_algo, &hash_size); if (res != TEE_SUCCESS) break; if (data_len != hash_size) { res = TEE_ERROR_BAD_PARAMETERS; break; } salt_len = pkcs1_get_salt_len(params, num_params, hash_size); } res = crypto_acipher_rsassa_verify(cs->algo, o->attr, salt_len, data, data_len, sig, sig_len); break; case TEE_MAIN_ALGO_DSA: hash_algo = TEE_DIGEST_HASH_TO_ALGO(cs->algo); res = tee_hash_get_digest_size(hash_algo, &hash_size); if (res != TEE_SUCCESS) break; /* * Depending on the DSA algorithm (NIST), the digital signature * output size may be truncated to the size of a key pair * (Q prime size). Q prime size must be less or equal than the * hash output length of the hash algorithm involved. */ if (data_len > hash_size) { res = TEE_ERROR_BAD_PARAMETERS; break; } res = crypto_acipher_dsa_verify(cs->algo, o->attr, data, data_len, sig, sig_len); break; case TEE_MAIN_ALGO_ECDSA: res = crypto_acipher_ecc_verify(cs->algo, o->attr, data, data_len, sig, sig_len); break; default: res = TEE_ERROR_NOT_SUPPORTED; } out: free(params); return res; }
486
True
1
CVE-2019-1010293
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/95f36d661f2b75887772ea28baaad904bde96970', 'name': 'https://github.com/OP-TEE/optee_os/commit/95f36d661f2b75887772ea28baaad904bde96970', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Boundary crossing. The impact is: Memory corruption of the TEE itself. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2020-08-24T17:37Z
2019-07-15T18:15Z
Out-of-bounds Write
The software writes data past the end, or before the beginning, of the intended buffer.
Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/787.html
0
Jens Wiklander
2018-11-19 13:34:23+01:00
core: tee_mmu_check_access_rights() check all pages Prior to this patch tee_mmu_check_access_rights() checks an address in each page of a supplied range. If both the start and length of that range is unaligned the last page in the range is sometimes not checked. With this patch the first address of each page in the range is checked to simplify the logic of checking each page and the range and also to cover the last page under all circumstances. Fixes: OP-TEE-2018-0005: "tee_mmu_check_access_rights does not check final page of TA buffer" Signed-off-by: Jens Wiklander <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Joakim Bech <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
95f36d661f2b75887772ea28baaad904bde96970
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
tee_mmu_check_access_rights
tee_mmu_check_access_rights( const struct user_ta_ctx * utc , uint32_t flags , uaddr_t uaddr , size_t len)
['utc', 'flags', 'uaddr', 'len']
TEE_Result tee_mmu_check_access_rights(const struct user_ta_ctx *utc, uint32_t flags, uaddr_t uaddr, size_t len) { uaddr_t a; size_t addr_incr = MIN(CORE_MMU_USER_CODE_SIZE, CORE_MMU_USER_PARAM_SIZE); if (ADD_OVERFLOW(uaddr, len, &a)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_NONSECURE) && (flags & TEE_MEMORY_ACCESS_SECURE)) return TEE_ERROR_ACCESS_DENIED; /* * Rely on TA private memory test to check if address range is private * to TA or not. */ if (!(flags & TEE_MEMORY_ACCESS_ANY_OWNER) && !tee_mmu_is_vbuf_inside_ta_private(utc, (void *)uaddr, len)) return TEE_ERROR_ACCESS_DENIED; for (a = uaddr; a < (uaddr + len); a += addr_incr) { uint32_t attr; TEE_Result res; res = tee_mmu_user_va2pa_attr(utc, (void *)a, NULL, &attr); if (res != TEE_SUCCESS) return res; if ((flags & TEE_MEMORY_ACCESS_NONSECURE) && (attr & TEE_MATTR_SECURE)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_SECURE) && !(attr & TEE_MATTR_SECURE)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_WRITE) && !(attr & TEE_MATTR_UW)) return TEE_ERROR_ACCESS_DENIED; if ((flags & TEE_MEMORY_ACCESS_READ) && !(attr & TEE_MATTR_UR)) return TEE_ERROR_ACCESS_DENIED; } return TEE_SUCCESS; }
217
True
1
CVE-2019-1010295
False
False
False
False
AV:N/AC:L/Au:N/C:P/I:P/A:P
NETWORK
LOW
NONE
PARTIAL
PARTIAL
PARTIAL
7.5
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NETWORK
LOW
NONE
NONE
UNCHANGED
HIGH
HIGH
HIGH
9.8
CRITICAL
3.9
5.9
False
[{'url': 'https://github.com/OP-TEE/optee_os/commit/d5c5b0b77b2b589666024d219a8007b3f5b6faeb', 'name': 'https://github.com/OP-TEE/optee_os/commit/d5c5b0b77b2b589666024d219a8007b3f5b6faeb', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}]
[{'description': [{'lang': 'en', 'value': 'CWE-20'}, {'lang': 'en', 'value': 'CWE-125'}, {'lang': 'en', 'value': 'CWE-787'}]}]
HIGH
[{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:linaro:op-tee:*:*:*:*:*:*:*:*', 'versionEndIncluding': '3.3.0', 'cpe_name': []}]}]
[{'lang': 'en', 'value': 'Linaro/OP-TEE OP-TEE 3.3.0 and earlier is affected by: Buffer Overflow. The impact is: Memory corruption and disclosure of memory content. The component is: optee_os. The fixed version is: 3.4.0 and later.'}]
2021-07-21T11:39Z
2019-07-15T18:15Z
Out-of-bounds Read
The software reads data past the end, or before the beginning, of the intended buffer.
Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
https://cwe.mitre.org/data/definitions/125.html
0
Jens Wiklander
2018-11-20 09:56:58+01:00
core: svc: always check ta parameters Always check TA parameters from a user TA. This prevents a user TA from passing invalid pointers to a pseudo TA. Fixes: OP-TEE-2018-0007: "Buffer checks missing when calling pseudo TAs". Signed-off-by: Jens Wiklander <[email protected]> Tested-by: Joakim Bech <[email protected]> (QEMU v7, v8) Reviewed-by: Joakim Bech <[email protected]> Reported-by: Riscure <[email protected]> Reported-by: Alyssa Milburn <[email protected]> Acked-by: Etienne Carriere <[email protected]>
d5c5b0b77b2b589666024d219a8007b3f5b6faeb
False
OP-TEE/optee_os
Trusted side of the TEE
2014-05-26 17:18:57
2022-08-26 17:12:14
null
OP-TEE
1176.0
844.0
tee_svc_copy_param
tee_svc_copy_param( struct tee_ta_session * sess , struct tee_ta_session * called_sess , struct utee_params * callee_params , struct tee_ta_param * param , void * tmp_buf_va [ TEE_NUM_PARAMS ] , struct mobj ** mobj_tmp)
['sess', 'called_sess', 'callee_params', 'param', 'mobj_tmp']
static TEE_Result tee_svc_copy_param(struct tee_ta_session *sess, struct tee_ta_session *called_sess, struct utee_params *callee_params, struct tee_ta_param *param, void *tmp_buf_va[TEE_NUM_PARAMS], struct mobj **mobj_tmp) { size_t n; TEE_Result res; size_t req_mem = 0; size_t s; uint8_t *dst = 0; bool ta_private_memref[TEE_NUM_PARAMS]; struct user_ta_ctx *utc = to_user_ta_ctx(sess->ctx); void *va; size_t dst_offs; /* fill 'param' input struct with caller params description buffer */ if (!callee_params) { memset(param, 0, sizeof(*param)); } else { res = tee_mmu_check_access_rights(utc, TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)callee_params, sizeof(struct utee_params)); if (res != TEE_SUCCESS) return res; utee_param_to_param(param, callee_params); } if (called_sess && is_pseudo_ta_ctx(called_sess->ctx)) { /* pseudo TA borrows the mapping of the calling TA */ return TEE_SUCCESS; } /* All mobj in param are of type MOJB_TYPE_VIRT */ for (n = 0; n < TEE_NUM_PARAMS; n++) { ta_private_memref[n] = false; switch (TEE_PARAM_TYPE_GET(param->types, n)) { case TEE_PARAM_TYPE_MEMREF_INPUT: case TEE_PARAM_TYPE_MEMREF_OUTPUT: case TEE_PARAM_TYPE_MEMREF_INOUT: va = (void *)param->u[n].mem.offs; s = param->u[n].mem.size; if (!va) { if (s) return TEE_ERROR_BAD_PARAMETERS; break; } /* uTA cannot expose its private memory */ if (tee_mmu_is_vbuf_inside_ta_private(utc, va, s)) { s = ROUNDUP(s, sizeof(uint32_t)); if (ADD_OVERFLOW(req_mem, s, &req_mem)) return TEE_ERROR_BAD_PARAMETERS; ta_private_memref[n] = true; break; } res = tee_mmu_vbuf_to_mobj_offs(utc, va, s, &param->u[n].mem.mobj, &param->u[n].mem.offs); if (res != TEE_SUCCESS) return res; break; default: break; } } if (req_mem == 0) return TEE_SUCCESS; res = alloc_temp_sec_mem(req_mem, mobj_tmp, &dst); if (res != TEE_SUCCESS) return res; dst_offs = 0; for (n = 0; n < TEE_NUM_PARAMS; n++) { if (!ta_private_memref[n]) continue; s = ROUNDUP(param->u[n].mem.size, sizeof(uint32_t)); switch (TEE_PARAM_TYPE_GET(param->types, n)) { case TEE_PARAM_TYPE_MEMREF_INPUT: case TEE_PARAM_TYPE_MEMREF_INOUT: va = (void *)param->u[n].mem.offs; if (va) { res = tee_svc_copy_from_user(dst, va, param->u[n].mem.size); if (res != TEE_SUCCESS) return res; param->u[n].mem.offs = dst_offs; param->u[n].mem.mobj = *mobj_tmp; tmp_buf_va[n] = dst; dst += s; dst_offs += s; } break; case TEE_PARAM_TYPE_MEMREF_OUTPUT: va = (void *)param->u[n].mem.offs; if (va) { param->u[n].mem.offs = dst_offs; param->u[n].mem.mobj = *mobj_tmp; tmp_buf_va[n] = dst; dst += s; dst_offs += s; } break; default: continue; } } return TEE_SUCCESS; }
619
True
1