diff options
| author | jvoisin | 2025-10-02 15:22:08 +0200 |
|---|---|---|
| committer | jvoisin | 2025-10-02 15:22:08 +0200 |
| commit | da8c7aebc5602c04b771ada71a098ccb23d83a48 (patch) | |
| tree | c006dabc93a369c247334bc50985b78653f9eb60 /src | |
| parent | 09bc3ffc8734cf2437e14ab123c7b732db53b836 (diff) | |
fix(log): systematically drop when .drop() is used
When the `php` logging facility is used, the error could have been caught by
using `set_error_handler` and whatnot. This commit ensures that if the
`.drop()` option is set, we're calling `zend_bailout()` that can't be caught.
An attacker could have used this issue to silently perform some recon of the
running environment. This isn't considered a vulnerability as an attacker
with arbitrary php code execution can simply use the use-after-free of the day
to gain arbitrary (native) code execution anyway, after detecting that
Snuffleupagus is in use, to take little risks of detection.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_utils.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sp_utils.c b/src/sp_utils.c index b045f61..775ff95 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -52,19 +52,19 @@ void sp_log_msgf(char const* const restrict feature, int level, int type, | |||
| 52 | syslog(syslog_level, "[snuffleupagus][%s][%s][%s] %s in %s on line %d", | 52 | syslog(syslog_level, "[snuffleupagus][%s][%s][%s] %s in %s on line %d", |
| 53 | client_ip, feature, logtype, msg, error_filename, error_lineno); | 53 | client_ip, feature, logtype, msg, error_filename, error_lineno); |
| 54 | closelog(); | 54 | closelog(); |
| 55 | efree(msg); | ||
| 56 | if (type == SP_TYPE_DROP) { | ||
| 57 | zend_bailout(); | ||
| 58 | } | ||
| 59 | break; | 55 | break; |
| 60 | } | 56 | } |
| 61 | case SP_LOG_ZEND: | 57 | case SP_LOG_ZEND: |
| 62 | default: | 58 | default: |
| 63 | zend_error(level, "[snuffleupagus][%s][%s][%s] %s", client_ip, feature, | 59 | zend_error(level, "[snuffleupagus][%s][%s][%s] %s", client_ip, feature, |
| 64 | logtype, msg); | 60 | logtype, msg); |
| 65 | efree(msg); | ||
| 66 | break; | 61 | break; |
| 67 | } | 62 | } |
| 63 | |||
| 64 | efree(msg); | ||
| 65 | if (type == SP_TYPE_DROP) { | ||
| 66 | zend_bailout(); | ||
| 67 | } | ||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | int compute_hash(char const* const restrict filename, | 70 | int compute_hash(char const* const restrict filename, |
