Skip to content

Commit e374edc

Browse files
yogeshmahajan-1903akshay-joshi
authored andcommitted
Fixed Command injection vulnerability allowing arbitrary command execution on Windows (CVE-2025-12763). #9323
1 parent 1d39739 commit e374edc

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

docs/en_US/release_notes_9_10.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ Bug fixes
4141
| `Issue #9240 <https://github.com/pgadmin-org/pgadmin4/issues/9240>`_ - Fixed an issue where the Debian build process failed with a "Sphinx module not found" error when using a Python virtual environment.
4242
| `Issue #9281 <https://github.com/pgadmin-org/pgadmin4/issues/9281>`_ - Fixed an issue where the last used storage directory was reset to blank, leading to access denied errors during backup or restore operations.
4343
| `Issue #9304 <https://github.com/pgadmin-org/pgadmin4/issues/9304>`_ - Fixed an issue that prevented assigning multiple users to an RLS policy.
44-
| `Issue #9320 <https://github.com/pgadmin-org/pgadmin4/issues/9320>`_ - Fixed remote code execution vulnerability when restoring PLAIN-format SQL dumps in server mode (CVE-2025-12762).
44+
| `Issue #9320 <https://github.com/pgadmin-org/pgadmin4/issues/9320>`_ - Fixed remote code execution vulnerability when restoring PLAIN-format SQL dumps in server mode (CVE-2025-12762).
45+
| `Issue #9323 <https://github.com/pgadmin-org/pgadmin4/issues/9323>`_ - Fixed Command injection vulnerability allowing arbitrary command execution on Windows (CVE-2025-12763).

web/pgadmin/misc/bgprocess/process_executor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# To make print function compatible with python2 & python3
3434
import sys
3535
import os
36+
import subprocess
3637
from datetime import datetime, timedelta, tzinfo, timezone
3738
from subprocess import Popen, PIPE
3839
from threading import Thread
@@ -319,7 +320,9 @@ def execute(argv):
319320

320321
kwargs = dict()
321322
kwargs['close_fds'] = False
322-
kwargs['shell'] = True if _IS_WIN else False
323+
kwargs['shell'] = False
324+
if _IS_WIN:
325+
kwargs['creationflags'] = subprocess.CREATE_NO_WINDOW
323326

324327
# We need environment variables & values in string
325328
kwargs['env'] = os.environ.copy()

web/pgadmin/tools/restore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def get_restore_util_args(data, manager, server, driver, conn, filepath):
336336
False)
337337
set_multiple('indexes', '--index', data, args, driver, conn, False)
338338

339-
args.append(fs_short_path(filepath))
339+
args.append(filepath)
340340

341341
return args
342342

web/pgadmin/utils/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,19 @@ def filename_with_file_manager_path(_file, create_file=False,
311311
elif not os.path.isabs(_file):
312312
_file = os.path.join(document_dir(), _file)
313313

314-
def short_filepath():
315-
short_path = fs_short_path(_file)
314+
def short_filepath(file=_file):
315+
short_path = fs_short_path(file)
316316
# fs_short_path() function may return empty path on Windows
317317
# if directory doesn't exists. In that case we strip the last path
318318
# component and get the short path.
319319
if os.name == 'nt' and short_path == '':
320-
base_name = os.path.basename(_file)
321-
dir_name = os.path.dirname(_file)
322-
short_path = fs_short_path(dir_name) + '\\' + base_name
320+
base_name = os.path.basename(file)
321+
dir_name = os.path.dirname(file)
322+
dir_short_path = fs_short_path(dir_name)
323+
if dir_short_path == '' and file != "":
324+
short_path = os.path.join(short_filepath(dir_name), base_name)
325+
else:
326+
short_path = os.path.join(dir_short_path, base_name)
323327
return short_path
324328

325329
if create_file:

0 commit comments

Comments
 (0)