CVE-2024-26934 - Improper Locking

Severity

78%

Complexity

18%

Confidentiality

98%

CVSS 3.1 Base Score 7.8. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Demo Examples

Improper Locking

CWE-667

In the following Java snippet, methods are defined to get and set a long field in an instance of a class that is shared across multiple threads. Because operations on double and long are nonatomic in Java, concurrent access may cause unexpected behavior. Thus, all operations on long and double fields should be synchronized.


               
}
return someLongValue;
someLongValue = l;

Improper Locking

CWE-667

This code tries to obtain a lock for a file, then writes to it.


               
fclose($logFile);
}//attempt to get logfile lock
flock($logfile, LOCK_UN);// unlock logfile
print "Could not obtain lock on logFile.log, message not recorded\n";

PHP by default will wait indefinitely until a file lock is released. If an attacker is able to obtain the file lock, this code will pause execution, possibly leading to denial of service for other users. Note that in this case, if an attacker can perform an flock() on the file, they may already have privileges to destroy the log file. However, this still impacts the execution of other programs that depend on flock().

Improper Locking

CWE-667

The following function attempts to acquire a lock in order to perform operations on a shared resource.


               
}
pthread_mutex_unlock(mutex);/* access shared resource */

However, the code does not check the value returned by pthread_mutex_lock() for errors. If pthread_mutex_lock() cannot acquire the mutex for any reason the function may introduce a race condition into the program and result in undefined behavior.

In order to avoid data races correctly written programs must check the result of thread synchronization functions and appropriately handle all errors, either by attempting to recover from them or reporting it to higher levels.


               
}
return pthread_mutex_unlock(mutex);
return result;
/* access shared resource */

Improper Locking

CWE-667

It may seem that the following bit of code achieves thread safety while avoiding unnecessary synchronization...


               
return helper;
}
}
helper = new Helper();

The programmer wants to guarantee that only one Helper() object is ever allocated, but does not want to pay the cost of synchronization every time this code is called.

Suppose that helper is not initialized. Then, thread A sees that helper==null and enters the synchronized block and begins to execute:


               
helper = new Helper();

If a second thread, thread B, takes over in the middle of this call and helper has not finished running the constructor, then thread B may make calls on helper while its fields hold incorrect values.

Overview

First reported 9 months ago

2024-05-01 06:15:00

Last updated 3 months ago

2024-11-21 09:03:00

Affected Software

Linux Kernel

References

https://git.kernel.org/stable/c/8cbdd324b41528994027128207fae8100dff094f

https://git.kernel.org/stable/c/12d6a5681a0a5cecc2af7860f0a1613fa7c6e947

https://git.kernel.org/stable/c/e451709573f8be904a8a72d0775bf114d7c291d9

https://git.kernel.org/stable/c/1b175bc579f46520b11ecda443bcd2ee4904f66a

https://git.kernel.org/stable/c/ab062fa3dc69aea88fe62162c5881ba14b50ecc5

https://git.kernel.org/stable/c/122a06f1068bf5e39089863f4f60b1f5d4273384

https://git.kernel.org/stable/c/dbdf66250d2d33e8b27352fcb901de79f3521057

https://git.kernel.org/stable/c/07acf979da33c721357ff27129edf74c23c036c6

https://git.kernel.org/stable/c/80ba43e9f799cbdd83842fc27db667289b3150f5

https://git.kernel.org/stable/c/8cbdd324b41528994027128207fae8100dff094f

Patch

https://git.kernel.org/stable/c/12d6a5681a0a5cecc2af7860f0a1613fa7c6e947

Patch

https://git.kernel.org/stable/c/e451709573f8be904a8a72d0775bf114d7c291d9

Patch

https://git.kernel.org/stable/c/1b175bc579f46520b11ecda443bcd2ee4904f66a

Patch

https://git.kernel.org/stable/c/ab062fa3dc69aea88fe62162c5881ba14b50ecc5

Patch

https://git.kernel.org/stable/c/122a06f1068bf5e39089863f4f60b1f5d4273384

Patch

https://git.kernel.org/stable/c/dbdf66250d2d33e8b27352fcb901de79f3521057

Patch

https://git.kernel.org/stable/c/07acf979da33c721357ff27129edf74c23c036c6

Patch

https://git.kernel.org/stable/c/80ba43e9f799cbdd83842fc27db667289b3150f5

Patch

https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html

https://lists.debian.org/debian-lts-announce/2024/06/msg00020.html

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.