{"id":"CVE-2026-82961","summary":"Unvalidated pin index in GPIO syscall handlers allows out-of-bounds kernel writes from user mode","details":"The GPIO syscall handlers in drivers/gpio/gpio_handlers.c did not validate the pin argument supplied by a user-mode caller. z_vrfy_gpio_pin_configure(), z_vrfy_gpio_pin_get_config() and z_vrfy_gpio_pin_interrupt_configure() verified only the device object (K_SYSCALL_DRIVER_GPIO() / K_SYSCALL_OBJ()) and then passed the caller-supplied gpio_pin_t straight through to z_impl_gpio_pin_*() and on to the driver. The only pin check in include/zephyr/drivers/gpio.h was __ASSERT(gpio_port_pin_is_supported(cfg-\u003eport_pin_mask, pin), ...), which compiles to nothing unless CONFIG_ASSERT is enabled, so in a production build no check existed at all.\n\nGPIO drivers use pin as a shift count and as an array index on the documented assumption that it is a pin the controller supports. On STM32, for example, gpio_stm32_pin_interrupt_configure() turns pin into an EXTI line and stm32_gpio_intc_set_irq_callback() writes data-\u003ecb[line_num].cb and data-\u003ecb[line_num].data into a NUM_EXTI_LINES-entry array (default 16) in drivers/interrupt_controller/intc_gpio_stm32.c, guarded only by a compiled-out __ASSERT_NO_MSG(); the same function then reads exti_irq_table[line_num] and calls irq_enable() on the result. Other controllers index fixed-size per-pin configuration tables the same way — drivers/gpio/gpio_ite_it8xxx2_v2.c reads an MMIO base pointer out of wuc_base[8] with the caller's pin and performs a read-modify-write through it.\n\nThe issue is reachable only in builds with CONFIG_USERSPACE=y (the file is compiled under that symbol), by a user-mode thread that has been granted access to a GPIO device object. Such a grant is intended to authorize control of that port's pins; the missing validation instead lets the thread drive a supervisor-mode out-of-bounds write of a function pointer and an associated void * past a kernel .bss array, and out-of-bounds reads that feed irq_enable() and MMIO accesses — an escape from the user-mode sandbox that can lead to kernel memory corruption, arbitrary code execution, or a crash.\n\nThe fix validates pin against the controller's gpio_driver_config.port_pin_mask with gpio_port_pin_is_supported() in every pin-taking z_vrfy_ handler and returns -EINVAL otherwise, complemented by an unconditional pin \u003e= GPIO_MAX_PINS_PER_PORT range check added to the shared z_impl_gpio_pin_*() inlines.","aliases":["GHSA-4f2x-8qw8-jjgf"],"modified":"2026-11-07T07:06:49.340015930Z","published":"2026-10-28T16:58:58.927Z","database_specific":{"cwe_ids":["CWE-787"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/82xxx/CVE-2026-82961.json","cna_assigner":"zephyr"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/82xxx/CVE-2026-82961.json"},{"type":"ADVISORY","url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-4f2x-8qw8-jjgf"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-82961"},{"type":"FIX","url":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363"},{"type":"FIX","url":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6"},{"type":"FIX","url":"https://github.com/zephyrproject-rtos/zephyr/commit/d145faab7e3a8cea62a8fd7ed5f30ef73e762f59"},{"type":"FIX","url":"https://github.com/zephyrproject-rtos/zephyr/commit/d28a05d5de4420f27ba3de7b9e4442fa056d51de"},{"type":"PACKAGE","url":"https://github.com/zephyrproject-rtos/zephyr"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/zephyrproject-rtos/zephyr","events":[{"introduced":"9518bd19b7a736bd649fa2fc8d8d52967c0b486f"},{"fixed":"41d10b59730406bbab4ca9f1fbbe9e96aafb4966"},{"fixed":"020e83e06b35e98a4a3c2354f67e5eee3f163363"},{"fixed":"d145faab7e3a8cea62a8fd7ed5f30ef73e762f59"},{"fixed":"c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6"},{"fixed":"d28a05d5de4420f27ba3de7b9e4442fa056d51de"}],"database_specific":{"extracted_events":[{"range":[{"introduced":"2.2.0"},{"fixed":"4.5.0"}],"source":"AFFECTED_FIELD","strategy":"StandardRange"},{"range":[{"fixed":"020e83e06b35e98a4a3c2354f67e5eee3f163363"}],"source":"REFERENCES_COMMIT"},{"range":[{"fixed":"d145faab7e3a8cea62a8fd7ed5f30ef73e762f59"}],"source":"REFERENCES_COMMIT"},{"range":[{"fixed":"c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6"}],"source":"REFERENCES_COMMIT"},{"source":"REFERENCES_COMMIT","range":[{"fixed":"d28a05d5de4420f27ba3de7b9e4442fa056d51de"}]}]}}],"versions":["v4.4.0","v4.4.0-rc3","v4.4.0-rc2","v4.4.0-rc1","v4.3.0","v4.3.0-rc3","v4.3.0-rc2","v4.3.0-rc1","v4.2.0","v4.2.0-rc3","v4.2.0-rc2","v4.2.0-rc1","v4.1.0","v4.1.0-rc3","v4.1.0-rc2","v4.1.0-rc1","v4.0.0","v4.0.0-rc3","v4.0.0-rc2","v4.0.0-rc1","v3.7.0","v3.7.0-rc3","v3.7.0-rc2","v3.7.0-rc1","v3.6.0","v3.6.0-rc3","v3.6.0-rc2","v3.6.0-rc1","zephyr-v3.5.0","v3.5.0","v3.5.0-rc3","v3.5.0-rc2","v3.5.0-rc1","zephyr-v3.4.0","v3.4.0","v3.4.0-rc3","v3.4.0-rc2","v3.4.0-rc1","zephyr-v3.3.0","v3.3.0","v3.3.0-rc3","v3.3.0-rc2","v3.3.0-rc1","zephyr-v3.2.0","v3.2.0","v3.2.0-rc3","v3.2.0-rc2","v3.2.0-rc1","zephyr-v3.1.0","v3.1.0","v3.1.0-rc3","v3.1.0-rc2","v3.1.0-rc1","zephyr-v3.0.0","v3.0.0","v3.0.0-rc3","v3.0.0-rc2","v3.0.0-rc1","v2.7.99","v2.7.0-rc3","v2.7.0-rc2","v2.7.0-rc1","zephyr-v2.6.0","v2.6.0","v2.6.0-rc3","v2.6.0-rc2","v2.6.0-rc1","zephyr-v2.5.0","v2.5.0","v2.5.0-rc4","v2.5.0-rc3","v2.5.0-rc2","v2.5.0-rc1","zephyr-v2.4.0","v2.4.0","v2.4.0-rc3","v2.4.0-rc2","v2.4.0-rc1","zephyr-v2.3.0","v2.3.0","v2.3.0-rc2","v2.3.0-rc1","zephyr-v2.2.0","v2.2.0"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-82961.json","vanir_signatures":[{"deprecated":false,"digest":{"function_hash":"273056552564574970881073377551277748294","length":638},"id":"CVE-2026-82961-020ff34c","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/d28a05d5de4420f27ba3de7b9e4442fa056d51de","target":{"function":"gpio_emul_pin_get_config","file":"drivers/gpio/gpio_emul.c"}},{"signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"file":"drivers/gpio/gpio_handlers.c","function":"z_vrfy_gpio_pin_get_config"},"deprecated":false,"digest":{"length":237,"function_hash":"107761852298818485173046111979778706702"},"id":"CVE-2026-82961-089cd305"},{"target":{"file":"drivers/gpio/gpio_handlers.c","function":"z_vrfy_gpio_pin_get_raw"},"deprecated":false,"digest":{"length":155,"function_hash":"101251576075787151219263314870337063812"},"id":"CVE-2026-82961-2929b102","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6"},{"signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h"},"deprecated":false,"digest":{"line_hashes":["158057830990632044784476888427052628520","311271272430973565960850518289967548344","107203214583122949925318861597822836062","227537240662559717170092714247522097101","312671709903008049938035042164696686208","91337041674197654747131461574343612183","180977023048880485029482404785443625151","26607726116354795968784573568314901766","229745006357290877936222955959660728208","178183734906413007560831046153398468705","15855502801035045872064515174674181770","179604461057411367777406566357217305305","320278859236289497591786792889498065554","279743187572392585083773119637060460972","214135087758950573324406800088377246284","304751202054600659914133858140102173772","194489203255550416603845015574632299380","279743187572392585083773119637060460972","266535986280214456138217818848448829011","184071024660375453120035987981772146233","328142699913767047131181876166560891317","46064992783423613983941279338858829792","281912322400071227781835620030273043365","61120874653116876658700902599642352261","210916466892979681335173691681484481113","111225135795378244498301379348607338323","46064992783423613983941279338858829792","281912322400071227781835620030273043365","162178375299714661433803929602554490383","20863430431255131907156488444595099945","256509674082172873326214797401170524627","159006519290276449759471884791049912442","178197089494319743093899991994801326644","30396129903685205119112824507617206826","190088327176108523016705200472175788989","216743932237346392615171527737499588050","68889991970455945943456306513347695286","203640638051617526381146154167107836599","84726207230038964134899937685894734936","87215015233094932274377036512047645623","124968467767663826847165650498613046902","204190104589405787940112800595259014147","150981806222607211324089465358615584305","61309613520377233581844713279115181682","20221376153053087418643417200336346308","150541761120557061687750471418589285754"],"threshold":0.9},"id":"CVE-2026-82961-298aa98c","signature_type":"Line"},{"deprecated":false,"digest":{"function_hash":"138094886789491332944125265529515264137","length":238},"id":"CVE-2026-82961-29c8dde9","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"file":"drivers/gpio/gpio_handlers.c","function":"z_vrfy_gpio_pin_set"}},{"signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_interrupt_configure"},"deprecated":false,"digest":{"function_hash":"238331963294445877139199691590291490445","length":2210},"id":"CVE-2026-82961-2d9d1e7f","signature_type":"Function"},{"target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_get_raw"},"deprecated":false,"digest":{"function_hash":"104028553534043652077376309025770526220","length":390},"id":"CVE-2026-82961-3070147d","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363"},{"id":"CVE-2026-82961-307e419a","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"file":"drivers/gpio/gpio_handlers.c","function":"z_vrfy_gpio_pin_configure"},"deprecated":false,"digest":{"function_hash":"233604323078336360139532824136414685859","length":178}},{"source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"gpio_pin_is_input"},"deprecated":false,"digest":{"function_hash":"47357441404981016907097381094342561059","length":413},"id":"CVE-2026-82961-446f2844","signature_type":"Function","signature_version":"v1"},{"signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/d28a05d5de4420f27ba3de7b9e4442fa056d51de","target":{"file":"drivers/gpio/gpio_emul.c","function":"gpio_emul_pin_configure"},"deprecated":false,"digest":{"function_hash":"151140575211033526077661926271499764230","length":1353},"id":"CVE-2026-82961-4bd85503"},{"signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_set"},"deprecated":false,"digest":{"function_hash":"229023309792739103466977013076301789130","length":447},"id":"CVE-2026-82961-4d3308df"},{"target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_get"},"deprecated":false,"digest":{"length":390,"function_hash":"104028553534043652077376309025770526220"},"id":"CVE-2026-82961-5b2547bb","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363"},{"digest":{"function_hash":"4844956782592181781551849331657484613","length":424},"id":"CVE-2026-82961-5bce4e9f","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_set_raw"},"deprecated":false},{"signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_configure"},"deprecated":false,"digest":{"function_hash":"278062893824301338793212379735638978716","length":1824},"id":"CVE-2026-82961-602fe335","signature_type":"Function"},{"deprecated":false,"digest":{"length":2202,"function_hash":"188226000791999954648756308390662779444"},"id":"CVE-2026-82961-6453e80e","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/d28a05d5de4420f27ba3de7b9e4442fa056d51de","target":{"function":"gpio_emul_pin_interrupt_configure","file":"drivers/gpio/gpio_emul.c"}},{"signature_type":"Line","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/d28a05d5de4420f27ba3de7b9e4442fa056d51de","target":{"file":"drivers/gpio/gpio_emul.c"},"deprecated":false,"digest":{"line_hashes":["296803631862748661004260874286087006498","176499455662478461728608125079626334285","118261645151697227133956946313892276364","112741492982897750282232304204003768709","88846337767686135916723301695552822039","149740769228068306270794600757855920262","118261645151697227133956946313892276364","112741492982897750282232304204003768709","149919129659327743746698158814930490834","274586375555915797932324994757710675850","220858368772464926881995272611674769936","227187155485033108523770309072701558628","252829720540933993388612596534687237103","1769198752120429137305703712550741509","176111007580672007844364974414783428176","173520146315484122880095501250680993125"],"threshold":0.9},"id":"CVE-2026-82961-70de17bd"},{"signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"function":"z_vrfy_gpio_pin_interrupt_configure","file":"drivers/gpio/gpio_handlers.c"},"deprecated":false,"digest":{"function_hash":"292626046689935077544543515092276802444","length":182},"id":"CVE-2026-82961-82a4b8c1","signature_type":"Function"},{"deprecated":false,"digest":{"length":297,"function_hash":"113778983976824561733766759439016052155"},"id":"CVE-2026-82961-87aaa945","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"z_impl_gpio_pin_toggle"}},{"signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"file":"drivers/gpio/gpio_handlers.c","function":"z_vrfy_gpio_pin_set_raw"},"deprecated":false,"digest":{"function_hash":"138094886789491332944125265529515264137","length":238},"id":"CVE-2026-82961-9a33ac15"},{"signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"file":"drivers/gpio/gpio_handlers.c","function":"z_vrfy_gpio_pin_get"},"deprecated":false,"digest":{"function_hash":"101251576075787151219263314870337063812","length":155},"id":"CVE-2026-82961-a5289e63"},{"source":"https://github.com/zephyrproject-rtos/zephyr/commit/c9641fa5bfec44892e0cf2d84f78c7c60fca8ad6","target":{"file":"drivers/gpio/gpio_handlers.c"},"deprecated":false,"digest":{"line_hashes":["328808808986849351731047160390758784575","8928216215927502867657456306671883474","331313374611057137189428058696654404102","267833951806037345364441566040879112270","204687789926412730109259271718116518844","38084793133240181060393661084293388623","218221664346788360452753562351393332071","102330778449358137517136156542952718800","173913443906112658943529908114879129185","79444084790314889408266025652401066653","197807183380950227595266227906467840966","208830861015750935712873512173926186698","334735974545440133317823079497140250700","71282466393676919059034107338822955097","209456565430919449357172226839944794424","4573735265246045170173799021471856998","208131662797264550927438419561554180993","196011756746442583981680477780798527099","180598947384780334286138666164397989502","175699479208354360605554009198099048770","93623833404125082058146857295203032394","222391601725406216469874029316363740671","263373239563602050284558269346993926745","272648279887677170970715668133510646521","132391408037900331198967571963355573602","338791605316562823512141202570017371647","230604816034394448678181993758597592949","34852763859533047481872267397887807048","206067381807328633640566036811447974799","55462392356693293345503167239713068584","125321833845786261315466304784072586085","142993824990433231077516007997710408135","242000719846435176283516483323484002915","154653027639288805195730098745822946311"],"threshold":0.9},"id":"CVE-2026-82961-b52f564e","signature_type":"Line","signature_version":"v1"},{"digest":{"function_hash":"247909646649845215149224973575673540970","length":413},"id":"CVE-2026-82961-d5685fcd","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/020e83e06b35e98a4a3c2354f67e5eee3f163363","target":{"file":"include/zephyr/drivers/gpio.h","function":"gpio_pin_is_output"},"deprecated":false},{"digest":{"length":427,"function_hash":"217599587994172069488565648396248664598"},"id":"CVE-2026-82961-e06058b5","signature_type":"Function","signature_version":"v1","source":"https://github.com/zephyrproject-rtos/zephyr/commit/d28a05d5de4420f27ba3de7b9e4442fa056d51de","target":{"file":"drivers/gpio/gpio_emul.c","function":"gpio_emul_flags_get"},"deprecated":false}],"vanir_signatures_modified":"2026-11-07T07:06:49Z"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"}]}