In the Linux kernel, the following vulnerability has been resolved:
tracing: Fix reading strings from synthetic events
The follow commands caused a crash:
# cd /sys/kernel/tracing # echo 's:open char file[]' > dynamicevents # echo 'hist:keys=commonpid:file=filename:onchange($file).trace(open,$file)' > events/syscalls/sysenteropenat/trigger' # echo 1 > events/synthetic/open/enable
BOOM!
The problem is that the synthetic event field "char file[]" will read the value given to it as a string without any memory checks to make sure the address is valid. The above example will pass in the user space address and the sythetic event code will happily call strlen() on it and then strscpy() where either one will cause an oops when accessing user space addresses.
Use the helper functions from tracekprobe and traceeprobe that can read strings safely (and actually succeed when the address is from user space and the memory is mapped in).
Now the above can show:
packagekitd-1721 [000] ...2. 104.597170: open: file=/usr/lib/rpm/fileattrs/cmake.attr
in:imjournal-978 [006] ...2. 104.599642: open: file=/var/lib/rsyslog/imjournal.state.tmp
packagekitd-1721 [000] ...2. 104.626308: open: file=/usr/lib/rpm/fileattrs/debuginfo.attr
{ "vanir_signatures": [ { "id": "CVE-2022-50255-163753f3", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9c79fbcbdb6cb10c07c85040eaf615180b26c48", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "251132537873191429545423129942354188794", "235144508325451997148734651369560808410", "113445923283533582543280565922667774311", "142232133759921746536366156811715963184", "293180425373988007719382265103890638719", "93806727712227239089851685167350058093", "152446216547059685505722461000233617014", "23626497881520121147026137630118709266", "147637207206471712507814536075547657423", "308462771560816731204274125465440371324", "228917117257799245058094074323617758500", "13382334276870651468398684965988638679", "339699109954238010398164902505232447099", "35621413454958501890544303493574474209", "317747739203379556043292862702333644479", "260725702620242885310944308859845945749", "78392399143137706286989203725891278105", "197513171218402700354445810546643309547", "89277207640582705668337323761961653892", "61201432854009121921801016166405674961", "152108844165947276586635894567002275169", "145448654803553063988528166549133059924", "75899245853455711005798123753794041355", "74682549384265165288801984454751482388" ] }, "target": { "file": "kernel/trace/trace_events_synth.c" } }, { "id": "CVE-2022-50255-414e7a08", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0934ae9977c27133449b6dd8c6213970e7eece38", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "251132537873191429545423129942354188794", "235144508325451997148734651369560808410", "113445923283533582543280565922667774311", "142232133759921746536366156811715963184", "293180425373988007719382265103890638719", "93806727712227239089851685167350058093", "152446216547059685505722461000233617014", "23626497881520121147026137630118709266", "147637207206471712507814536075547657423", "308462771560816731204274125465440371324", "228917117257799245058094074323617758500", "13382334276870651468398684965988638679", "339699109954238010398164902505232447099", "35621413454958501890544303493574474209", "317747739203379556043292862702333644479", "260725702620242885310944308859845945749", "78392399143137706286989203725891278105", "197513171218402700354445810546643309547", "89277207640582705668337323761961653892", "61201432854009121921801016166405674961", "152108844165947276586635894567002275169", "145448654803553063988528166549133059924", "75899245853455711005798123753794041355", "74682549384265165288801984454751482388" ] }, "target": { "file": "kernel/trace/trace_events_synth.c" } }, { "id": "CVE-2022-50255-61c6352d", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9c79fbcbdb6cb10c07c85040eaf615180b26c48", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 672.0, "function_hash": "255010174192243459998404091807141757667" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_string" } }, { "id": "CVE-2022-50255-ad3571fa", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f8bae1853196b52ede50950387f5b48cf83b9815", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 1423.0, "function_hash": "242760786530209069155133228523433769392" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_event_raw_event_synth" } }, { "id": "CVE-2022-50255-b3d488c4", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@149198d0b884e4606ed1d29b330c70016d878276", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 672.0, "function_hash": "255010174192243459998404091807141757667" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_string" } }, { "id": "CVE-2022-50255-bce7a31d", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0934ae9977c27133449b6dd8c6213970e7eece38", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 1423.0, "function_hash": "242760786530209069155133228523433769392" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_event_raw_event_synth" } }, { "id": "CVE-2022-50255-c19b1e9b", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f8bae1853196b52ede50950387f5b48cf83b9815", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 672.0, "function_hash": "255010174192243459998404091807141757667" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_string" } }, { "id": "CVE-2022-50255-d154ade7", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0934ae9977c27133449b6dd8c6213970e7eece38", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 672.0, "function_hash": "255010174192243459998404091807141757667" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_string" } }, { "id": "CVE-2022-50255-d91c0388", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9c79fbcbdb6cb10c07c85040eaf615180b26c48", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 1423.0, "function_hash": "242760786530209069155133228523433769392" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_event_raw_event_synth" } }, { "id": "CVE-2022-50255-e5ba8163", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f8bae1853196b52ede50950387f5b48cf83b9815", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "251132537873191429545423129942354188794", "235144508325451997148734651369560808410", "113445923283533582543280565922667774311", "142232133759921746536366156811715963184", "293180425373988007719382265103890638719", "93806727712227239089851685167350058093", "152446216547059685505722461000233617014", "23626497881520121147026137630118709266", "147637207206471712507814536075547657423", "308462771560816731204274125465440371324", "228917117257799245058094074323617758500", "13382334276870651468398684965988638679", "339699109954238010398164902505232447099", "35621413454958501890544303493574474209", "317747739203379556043292862702333644479", "260725702620242885310944308859845945749", "78392399143137706286989203725891278105", "197513171218402700354445810546643309547", "89277207640582705668337323761961653892", "61201432854009121921801016166405674961", "152108844165947276586635894567002275169", "145448654803553063988528166549133059924", "75899245853455711005798123753794041355", "74682549384265165288801984454751482388" ] }, "target": { "file": "kernel/trace/trace_events_synth.c" } }, { "id": "CVE-2022-50255-f90ae935", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@149198d0b884e4606ed1d29b330c70016d878276", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "251132537873191429545423129942354188794", "235144508325451997148734651369560808410", "113445923283533582543280565922667774311", "142232133759921746536366156811715963184", "293180425373988007719382265103890638719", "93806727712227239089851685167350058093", "152446216547059685505722461000233617014", "23626497881520121147026137630118709266", "147637207206471712507814536075547657423", "308462771560816731204274125465440371324", "228917117257799245058094074323617758500", "13382334276870651468398684965988638679", "339699109954238010398164902505232447099", "35621413454958501890544303493574474209", "317747739203379556043292862702333644479", "260725702620242885310944308859845945749", "78392399143137706286989203725891278105", "197513171218402700354445810546643309547", "89277207640582705668337323761961653892", "61201432854009121921801016166405674961", "152108844165947276586635894567002275169", "145448654803553063988528166549133059924", "75899245853455711005798123753794041355", "74682549384265165288801984454751482388" ] }, "target": { "file": "kernel/trace/trace_events_synth.c" } }, { "id": "CVE-2022-50255-fdbe0592", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@149198d0b884e4606ed1d29b330c70016d878276", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 1423.0, "function_hash": "242760786530209069155133228523433769392" }, "target": { "file": "kernel/trace/trace_events_synth.c", "function": "trace_event_raw_event_synth" } } ] }