code
stringlengths
14
2.05k
label
int64
0
1
programming_language
stringclasses
7 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
98
description
stringlengths
36
379
url
stringlengths
36
48
label_name
stringclasses
2 values
function AngelType_name_render(AngelType $angeltype, $plain = false) { if ($plain) { return sprintf('%s (%u)', $angeltype->name, $angeltype->id); } return '<a href="' . angeltype_link($angeltype->id) . '">' . ($angeltype->restricted ? icon('mortarboard-fill') : '') . $angeltype->name
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
$panel_body .= '<br>' . icon('person') . '<span class="text-' . $shift['style'] . '">' . $needed_angels['need'] . ' &times; ' . $needed_angels['angeltype_name'] . '</span>'; } $type = 'bg-dark'; if (theme_type() == 'light') { $type = 'bg-light'; } return div('col-md-3 mb-3', [ div('dashboard-card card border-' . $shift['style'] . ' ' . $type, [ div('card-body', [ '<a class="card-link" href="' . shift_link($shift) . '"></a>', $panel_body, ]), ]), ]); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function Room_name_render(Room $room) { if (auth()->can('view_rooms')) { return '<a href="' . room_link($room) . '">' . icon('pin-map-fill') . $room->name . '</a>'; } return icon('pin-map-fill') . $room->name; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function Room_view(Room $room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer) { $user = auth()->user(); $assignNotice = ''; if (config('signup_requires_arrival') && !$user->state->arrived) { $assignNotice = info(render_user_arrived_hint(), true); } $description = ''; if ($room->description) { $description = '<h3>' . __('Description') . '</h3>'; $parsedown = new Parsedown(); $description .= $parsedown->parse($room->description); } $dect = ''; if (config('enable_dect') && $room->dect) { $dect = heading(__('Contact'), 3) . description([__('DECT') => sprintf('<a href="tel:%s">%1$s</a>', $room->dect)]); } $tabs = []; if ($room->map_url) { $tabs[__('Map')] = sprintf( '<div class="map">' . '<iframe style="width: 100%%; min-height: 400px; border: 0 none;" src="%s"></iframe>' . '</div>', $room->map_url ); } $tabs[__('Shifts')] = div('first', [ $shiftsFilterRenderer->render(page_link_to('rooms', [ 'action' => 'view', 'room_id' => $room->id, ]), ['rooms' => [$room->id]]), $shiftCalendarRenderer->render(), ]); $selected_tab = 0; $request = request(); if ($request->has('shifts_filter_day')) { $selected_tab = count($tabs) - 1; } return page_with_title(icon('pin-map-fill') . $room->name, [ $assignNotice, auth()->can('admin_rooms') ? buttons([ button( page_link_to('admin/rooms/edit/' . $room->id), icon('pencil') . __('edit') ), ]) : '', $dect, $description, tabs($tabs, $selected_tab), ], true); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function render(Shift $shift, $needed_angeltypes, $shift_entries, $user) { $info_text = ''; if ($shift->title != '') { $info_text = icon('info-circle') . $shift->title . '<br>'; } list($shift_signup_state, $shifts_row) = $this->renderShiftNeededAngeltypes( $shift, $needed_angeltypes, $shift_entries, $user ); $class = $this->classForSignupState($shift_signup_state); $blocks = ceil(($shift->end->timestamp - $shift->start->timestamp) / ShiftCalendarRenderer::SECONDS_PER_ROW); $blocks = max(1, $blocks); $room = $shift->room; return [ $blocks, div( 'shift-card" style="height: ' . ($blocks * ShiftCalendarRenderer::BLOCK_HEIGHT - ShiftCalendarRenderer::MARGIN) . 'px;', div( 'shift card bg-' . $class, [ $this->renderShiftHead($shift, $class, $shift_signup_state->getFreeEntries()), div('card-body ' . $this->classBg(), [ $info_text, Room_name_render($room), ]), $shifts_row, ] ) ),
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
private function renderShiftHead(Shift $shift, $class, $needed_angeltypes_count) { $header_buttons = ''; if (auth()->can('admin_shifts')) { $header_buttons = '<div class="ms-auto d-print-none">' . table_buttons([ button( page_link_to('user_shifts', ['edit_shift' => $shift->id]), icon('pencil'), 'btn-' . $class . ' btn-sm border-light text-white' ), button( page_link_to('user_shifts', ['delete_shift' => $shift->id]), icon('trash'), 'btn-' . $class . ' btn-sm border-light text-white' ), ]) . '</div>'; } $shift_heading = $shift->start->format('H:i') . ' &dash; ' . $shift->end->format('H:i') . ' &mdash; ' . $shift->shiftType->name; if ($needed_angeltypes_count > 0) { $shift_heading = '<span class="badge bg-light text-danger me-1">' . $needed_angeltypes_count . '</span> ' . $shift_heading; } return div('card-header d-flex align-items-center', [ '<a class="d-flex align-items-center text-white" href="' . shift_link($shift) . '">' . $shift_heading . '</a>', $header_buttons, ]); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftEntry_create_view_admin( Shift $shift, Room $room, AngelType $angeltype, $angeltypes_select, $signup_user, $users_select ) { $start = $shift->start->format(__('Y-m-d H:i')); return page_with_title( ShiftEntry_create_title() . ': ' . $shift->shiftType->name . ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>', [ Shift_view_header($shift, $room), info(__('Do you want to sign up the following user for this shift?'), true), form([ form_select('angeltype_id', __('Angeltype'), $angeltypes_select, $angeltype->id), form_select('user_id', __('User'), $users_select, $signup_user->id), form_submit('submit', icon('check-lg') . __('Save')), ]), ] ); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftEntry_edit_view( $angel, $date, $location, $title, $type, $comment, $freeloaded, $freeloaded_comment, $user_admin_shifts = false ) { $freeload_form = []; if ($user_admin_shifts) { $freeload_form = [ form_checkbox('freeloaded', __('Freeloaded'), $freeloaded), form_textarea( 'freeloaded_comment', __('Freeload comment (Only for shift coordination):'), $freeloaded_comment ), ]; } if ($angel->id == auth()->user()->id) { $comment = form_textarea('comment', __('Comment (for your eyes only):'), $comment); } else { $comment = ''; } return page_with_title(__('Edit shift entry'), [ msg(), form([ form_info(__('Angel:'), User_Nick_render($angel)), form_info(__('Date, Duration:'), $date), form_info(__('Location:'), $location), form_info(__('Title:'), $title), form_info(__('Type:'), $type), $comment, join('', $freeload_form), form_submit('submit', __('Save')), ]), ]); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftEntry_create_view_user(Shift $shift, Room $room, AngelType $angeltype, $comment) { $start = $shift->start->format(__('Y-m-d H:i')); return page_with_title( ShiftEntry_create_title() . ': ' . $shift->shiftType->name . ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>', [ Shift_view_header($shift, $room), info(sprintf(__('Do you want to sign up for this shift as %s?'), $angeltype->name), true), form([ form_textarea('comment', __('Comment (for your eyes only):'), $comment), form_submit('submit', icon('check-lg') . __('Save')), ]), ] ); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftEntry_delete_view_admin(Shift $shift, AngelType $angeltype, User $signoff_user) { return page_with_title(ShiftEntry_delete_title(), [ info(sprintf( __('Do you want to sign off %s from shift %s from %s to %s as %s?'), User_Nick_render($signoff_user), $shift->shiftType->name, $shift->start->format(__('Y-m-d H:i')), $shift->end->format(__('Y-m-d H:i')), $angeltype->name ), true), form([ buttons([ button(user_link($signoff_user->id), icon('x-lg') . __('cancel')), form_submit('delete', icon('trash') . __('sign off'), 'btn-danger', false), ]), ]), ]); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftEntry_create_view_supporter(Shift $shift, Room $room, AngelType $angeltype, $signup_user, $users_select) { $start = $shift->start->format(__('Y-m-d H:i')); return page_with_title( ShiftEntry_create_title() . ': ' . $shift->shiftType->name . ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>', [ Shift_view_header($shift, $room), info(sprintf( __('Do you want to sign up the following user for this shift as %s?'), $angeltype->name ), true), form([ form_select('user_id', __('User'), $users_select, $signup_user->id), form_submit('submit', icon('check-lg') . __('Save')), ]), ] ); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftType_name_render(ShiftType $shifttype) { if (auth()->can('shifttypes')) { return '<a href="' . shifttype_link($shifttype) . '">' . $shifttype->name . '</a>'; } return $shifttype->name; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function ShiftType_delete_view(ShiftType $shifttype) { return page_with_title(sprintf(__('Delete shifttype %s'), $shifttype->name), [ info(sprintf(__('Do you want to delete shifttype %s?'), $shifttype->name), true), form([ buttons([ button(page_link_to('shifttypes'), icon('x-lg') . __('cancel')), form_submit( 'delete', icon('trash') . __('delete'), 'btn-danger', false ), ]), ]), ], true); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
sprintf( __('Become %s'), $angeltype->name ) );
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function Shift_view_header(Shift $shift, Room $room) { return div('row', [ div('col-sm-3 col-xs-6', [ '<h4>' . __('Title') . '</h4>', '<p class="lead">' . ($shift->url != '' ? '<a href="' . $shift->url . '">' . $shift->title . '</a>' : $shift->title) . '</p>', ]), div('col-sm-3 col-xs-6', [ '<h4>' . __('Start') . '</h4>', '<p class="lead' . (time() >= $shift->start->timestamp ? ' text-success' : '') . '">', icon('calendar-event') . $shift->start->format(__('Y-m-d')), '<br />', icon('clock') . $shift->start->format('H:i'), '</p>', ]),
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function addHint($hint, $important = false) { if (!empty($hint)) { if ($important) { $this->important = true; $this->hints[] = error($hint, true); } else { $this->hints[] = info($hint, true); } } }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function render_user_dect_hint() { $user = auth()->user(); if ($user->state->arrived && config('enable_dect') && !$user->contact->dect) { $text = __('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.'); return render_profile_link($text); } return null; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
function User_view_worklog(Worklog $worklog, $admin_user_worklog_privilege) { $actions = ''; if ($admin_user_worklog_privilege) { $actions = table_buttons([ button( url('/admin/user/' . $worklog->user->id . '/worklog/' . $worklog->id), icon('pencil') . __('edit'), 'btn-sm' ), button( url('/admin/user/' . $worklog->user->id . '/worklog/' . $worklog->id . '/delete'), icon('trash') . __('delete'), 'btn-sm' ), ]); } return [ 'date' => icon('calendar-event') . date(__('Y-m-d'), $worklog->worked_at->timestamp), 'duration' => sprintf('%.2f', $worklog->hours) . ' h', 'room' => '', 'shift_info' => __('Work log entry'), 'comment' => $worklog->comment . '<br>' . sprintf( __('Added by %s at %s'), User_Nick_render($worklog->creator), $worklog->created_at->format(__('Y-m-d H:i')) ), 'actions' => $actions, ]; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
$output[] = __($group->name); } return div('col-md-2', [ '<h4>' . __('Rights') . '</h4>', join('<br>', $output), ]); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
: Str::ucfirst($oauth->provider) ); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
. ($angeltype->pivot->supporter ? icon('patch-check') : '') . $angeltype->name . '</a>'; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function renderView() { /** @var RequestSql $obj */ if (!($obj = $this->loadObject(true))) { return ''; } try { if ($results = Db::readOnly()->getArray($obj->sql)) { foreach (array_keys($results[0]) as $key) { $tabKey[] = $key; } $view['name'] = $obj->name; $view['key'] = $tabKey; $view['results'] = $results; $this->toolbar_title = $obj->name; $requestSql = new RequestSql(); $view['attributes'] = $requestSql->attributes; } else { $view['error'] = true; } } catch (PrestaShopException $e) { $this->errors[] = $e->getMessage(); $view = [ 'name' => '', 'key' => '', 'results' => [], ]; } $this->tpl_view_vars = [ 'view' => $view, ]; return parent::renderView(); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function testRender() { $kernel = self::bootKernel(); /** @var Environment $twig */ $twig = self::getContainer()->get('twig'); $stack = self::getContainer()->get('request_stack'); $cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'); $converter = new MPdfConverter((new FileHelperFactory($this))->create(), $cacheDir); $request = new Request(); $request->setLocale('en'); $stack->push($request); $sut = new PDFRenderer($twig, $converter, $this->createMock(ProjectStatisticService::class)); $prefix = date('Ymd'); $response = $this->render($sut); $this->assertEquals('application/pdf', $response->headers->get('Content-Type')); $this->assertEquals('attachment; filename=' . $prefix . '-Customer_Name-project_name.pdf', $response->headers->get('Content-Disposition')); $this->assertNotEmpty($response->getContent()); $sut->setDispositionInline(true); $response = $this->render($sut); $this->assertEquals('inline; filename=' . $prefix . '-Customer_Name-project_name.pdf', $response->headers->get('Content-Disposition')); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testRender() { $kernel = self::bootKernel(); /** @var Environment $twig */ $twig = self::getContainer()->get('twig'); $stack = self::getContainer()->get('request_stack'); $request = new Request(); $request->setLocale('en'); $stack->push($request); $sut = new HtmlRenderer( $twig, new EventDispatcher(), $this->createMock(ProjectStatisticService::class), $this->createMock(ActivityStatisticService::class) ); $response = $this->render($sut); $content = $response->getContent(); $this->assertStringContainsString('>1:50<', $content); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testConfiguration() { $sut = new HtmlRenderer( $this->createMock(Environment::class), new EventDispatcher(), $this->createMock(ProjectStatisticService::class), $this->createMock(ActivityStatisticService::class) ); $this->assertEquals('print', $sut->getId()); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testRender() { $kernel = self::bootKernel(); /** @var Environment $twig */ $twig = self::getContainer()->get('twig'); $stack = self::getContainer()->get('request_stack'); $cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'); $converter = new MPdfConverter((new FileHelperFactory($this))->create(), $cacheDir); $request = new Request(); $request->setLocale('en'); $stack->push($request); $sut = new PDFRenderer($twig, $converter, $this->createMock(ProjectStatisticService::class)); $response = $this->render($sut); $prefix = date('Ymd'); $this->assertEquals('application/pdf', $response->headers->get('Content-Type')); $this->assertEquals('attachment; filename=' . $prefix . '-Customer_Name-project_name.pdf', $response->headers->get('Content-Disposition')); $this->assertNotEmpty($response->getContent()); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testConfiguration() { $sut = new PDFRenderer( $this->createMock(Environment::class), $this->createMock(HtmlToPdfConverter::class), $this->createMock(ProjectStatisticService::class) ); $this->assertEquals('pdf', $sut->getId()); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testRender() { $kernel = self::bootKernel(); /** @var Environment $twig */ $twig = self::getContainer()->get('twig'); $stack = self::getContainer()->get('request_stack'); $cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'); $request = new Request(); $request->setLocale('en'); $stack->push($request); /** @var FilesystemLoader $loader */ $loader = $twig->getLoader(); $loader->addPath(__DIR__ . '/../templates/', 'invoice'); $sut = new PdfRenderer($twig, new MPdfConverter((new FileHelperFactory($this))->create(), $cacheDir)); $model = $this->getInvoiceModel(); $document = $this->getInvoiceDocument('default.pdf.twig', true); $response = $sut->render($document, $model); $this->assertEquals('application/pdf', $response->headers->get('Content-Type')); $this->assertStringContainsString('attachment; filename', $response->headers->get('Content-Disposition')); $this->assertNotEmpty($response->getContent()); $sut->setDispositionInline(true); $response = $sut->render($document, $model); $this->assertStringContainsString('inline; filename', $response->headers->get('Content-Disposition')); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testSupports() { $env = new Environment(new ArrayLoader([])); $sut = new PdfRenderer($env, $this->createMock(HtmlToPdfConverter::class)); $this->assertTrue($sut->supports($this->getInvoiceDocument('default.pdf.twig', true))); $this->assertTrue($sut->supports($this->getInvoiceDocument('service-date.pdf.twig'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('timesheet.html.twig'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('company.docx', true))); $this->assertFalse($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx', true))); $this->assertFalse($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods', true))); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testRender() { $kernel = self::bootKernel(); /** @var Environment $twig */ $twig = self::getContainer()->get('twig'); $stack = self::getContainer()->get('request_stack'); $request = new Request(); $request->setLocale('en'); $stack->push($request); /** @var FilesystemLoader $loader */ $loader = $twig->getLoader(); $loader->addPath($this->getInvoiceTemplatePath(), 'invoice'); $sut = new TwigRenderer($twig); $model = $this->getInvoiceModel(); $model->getTemplate()->setLanguage('de'); $document = $this->getInvoiceDocument('timesheet.html.twig'); $response = $sut->render($document, $model); $content = $response->getContent(); $filename = $model->getInvoiceNumber() . '-customer_with_special_name'; $this->assertStringContainsString('<title>' . $filename . '</title>', $content); $this->assertStringContainsString('<span contenteditable="true">a very *long* test invoice / template title with [ßpecial] chäracter</span>', $content); // 3 timesheets have a description and therefor do not render the activity // 2 timesheets have no description and the correct activity assigned $this->assertEquals(2, substr_count($content, 'activity description')); $this->assertStringContainsString(nl2br("foo\n" . "foo\r\n" . 'foo' . PHP_EOL . "bar\n" . "bar\r\n" . 'Hello'), $content); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function testSupports() { $loader = new FilesystemLoader(); $env = new Environment($loader); $sut = new TwigRenderer($env); $this->assertTrue($sut->supports($this->getInvoiceDocument('invoice.html.twig'))); $this->assertTrue($sut->supports($this->getInvoiceDocument('timesheet.html.twig'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('service-date.pdf.twig'))); $this->assertFalse($sut->supports($this->getInvoiceDocument('company.docx', true))); $this->assertFalse($sut->supports($this->getInvoiceDocument('spreadsheet.xlsx', true))); $this->assertFalse($sut->supports($this->getInvoiceDocument('open-spreadsheet.ods', true))); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
function read_gps_location($file) { if (is_file($file)) { $exif = exif_read_data($file); if ( isset($exif['GPSLatitude']) && isset($exif['GPSLongitude']) && isset($exif['GPSLatitudeRef']) && isset($exif['GPSLongitudeRef']) && in_array($exif['GPSLatitudeRef'], array('E', 'W', 'N', 'S')) && in_array($exif['GPSLongitudeRef'], array('E', 'W', 'N', 'S')) ) { $GPSLatitudeRef = strtolower(trim($exif['GPSLatitudeRef'])); $GPSLongitudeRef = strtolower(trim($exif['GPSLongitudeRef'])); $lat_degrees_a = explode('/', $exif['GPSLatitude'][0]); $lat_minutes_a = explode('/', $exif['GPSLatitude'][1]); $lat_seconds_a = explode('/', $exif['GPSLatitude'][2]); $lon_degrees_a = explode('/', $exif['GPSLongitude'][0]); $lon_minutes_a = explode('/', $exif['GPSLongitude'][1]); $lon_seconds_a = explode('/', $exif['GPSLongitude'][2]); $lat_degrees = $lat_degrees_a[0] / $lat_degrees_a[1]; $lat_minutes = $lat_minutes_a[0] / $lat_minutes_a[1]; $lat_seconds = $lat_seconds_a[0] / $lat_seconds_a[1]; $lon_degrees = $lon_degrees_a[0] / $lon_degrees_a[1]; $lon_minutes = $lon_minutes_a[0] / $lon_minutes_a[1]; $lon_seconds = $lon_seconds_a[0] / $lon_seconds_a[1]; $lat = (float) $lat_degrees + ((($lat_minutes * 60) + ($lat_seconds)) / 3600); $lon = (float) $lon_degrees + ((($lon_minutes * 60) + ($lon_seconds)) / 3600); // If the latitude is South, make it negative // If the longitude is west, make it negative $GPSLatitudeRef == 's' ? $lat *= -1 : ''; $GPSLongitudeRef == 'w' ? $lon *= -1 : ''; return array( 'lat' => $lat, 'lon' => $lon ); } } return false; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
} elseif ('array' === $item[0]) { $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); } elseif ('null' === $item[0]) {
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
} elseif ('boolean' === $item[0]) { $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>'; } elseif ('resource' === $item[0]) {
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); } return implode(', ', $result); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function getFilters() { return [ new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]), new TwigFilter('abbr_method', [$this, 'abbrMethod'], ['is_safe' => ['html']]), new TwigFilter('format_args', [$this, 'formatArgs'], ['is_safe' => ['html']]), new TwigFilter('format_args_as_text', [$this, 'formatArgsAsText']), new TwigFilter('file_excerpt', [$this, 'fileExcerpt'], ['is_safe' => ['html']]), new TwigFilter('format_file', [$this, 'formatFile'], ['is_safe' => ['html']]), new TwigFilter('format_file_from_text', [$this, 'formatFileFromText'], ['is_safe' => ['html']]), new TwigFilter('format_log_message', [$this, 'formatLogMessage'], ['is_safe' => ['html']]), new TwigFilter('file_link', [$this, 'getFileLink']), new TwigFilter('file_relative', [$this, 'getFileRelative']), ]; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function __construct( AccessChecker $accessChecker, Metadata $metadata, EntityManager $entityManager, MimeType $mimeType, DetailsObtainer $detailsObtainer ) { $this->accessChecker = $accessChecker; $this->metadata = $metadata; $this->entityManager = $entityManager; $this->mimeType = $mimeType; $this->detailsObtainer = $detailsObtainer; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
function se_start_user_session($ud) { /* reset session id */ session_regenerate_id(true); $_SESSION['user_id'] = $ud['user_id']; $_SESSION['user_nick'] = $ud['user_nick']; $_SESSION['user_mail'] = $ud['user_mail']; $_SESSION['user_class'] = $ud['user_class']; $_SESSION['user_psw'] = $ud['user_psw']; $_SESSION['user_firstname'] = $ud['user_firstname']; $_SESSION['user_lastname'] = $ud['user_lastname']; $_SESSION['user_hash'] = md5($ud['user_nick']); /* CSRF Protection */ $token = md5(uniqid(rand(), TRUE)); $_SESSION['token'] = $token; $_SESSION['token_time'] = time(); $arr_drm = explode("|", $ud['user_drm']); if($arr_drm[0] == "drm_acp_pages") { $_SESSION['acp_pages'] = "allowed"; } if($arr_drm[1] == "drm_acp_files") { $_SESSION['acp_files'] = "allowed"; } if($arr_drm[2] == "drm_acp_user") { $_SESSION['acp_user'] = "allowed"; } if($arr_drm[3] == "drm_acp_system") { $_SESSION['acp_system'] = "allowed"; } if($arr_drm[4] == "drm_acp_editpages") { $_SESSION['acp_editpages'] = "allowed"; } if($arr_drm[5] == "drm_acp_editownpages") { $_SESSION['acp_editownpages'] = "allowed"; } if($arr_drm[6] == "drm_moderator") { $_SESSION['drm_moderator'] = "allowed"; } if($arr_drm[7] == "drm_can_publish") { $_SESSION['drm_can_publish'] = "true"; } if($arr_drm[8] == "drm_acp_sensitive_files") { $_SESSION['drm_acp_sensitive_files'] = "allowed"; } }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
public function save($check_notify = false) { $this->name = SugarCleaner::cleanHtml($this->name); $this->parseDescription(); parent::save($check_notify); if (file_exists('custom/modules/AOP_Case_Updates/CaseUpdatesHook.php')) { require_once 'custom/modules/AOP_Case_Updates/CaseUpdatesHook.php'; } else { require_once 'modules/AOP_Case_Updates/CaseUpdatesHook.php'; } if (class_exists('CustomCaseUpdatesHook')) { $hook = new CustomCaseUpdatesHook(); } else { $hook = new CaseUpdatesHook(); } $hook->sendCaseUpdate($this); return $this->id; }
0
PHP
NVD-CWE-noinfo
null
null
null
vulnerable
$t_field_values_js .= '"'.string_attribute( $t_custom_field_value ).'" ,'; } $t_field_values_js = rtrim( $t_field_values_js, ',' ); $t_field_values_js .= ']'; return $t_field_values_js; }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function fetchAccessToken($authCode, array $params = []) { if ($this->validateAuthState) { $authState = $this->getState('authState'); $incomingRequest = Yii::$app->getRequest(); $incomingState = $incomingRequest->get('state', $incomingRequest->post('state')); if (!isset($incomingState) || empty($authState) || strcmp($incomingState, $authState) !== 0) { throw new HttpException(400, 'Invalid auth state parameter.'); } $this->removeState('authState'); } $defaultParams = [ 'code' => $authCode, 'grant_type' => 'authorization_code', 'redirect_uri' => $this->getReturnUrl(), ]; if ($this->enablePkce) { $defaultParams['code_verifier'] = $this->getState('authCodeVerifier'); } $request = $this->createRequest() ->setMethod('POST') ->setUrl($this->tokenUrl) ->setData(array_merge($defaultParams, $params)); // Azure AD will complain if there is no `Origin` header. if ($this->enablePkce) { $request->addHeaders(['Origin' => Url::to('/')]); } $this->applyClientCredentialsToRequest($request); $response = $this->sendRequest($request); $token = $this->createToken(['params' => $response]); $this->setAccessToken($token); return $token; }
0
PHP
CWE-287
Improper Authentication
When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.
https://cwe.mitre.org/data/definitions/287.html
vulnerable
public function fetchAccessToken($oauthToken = null, OAuthToken $requestToken = null, $oauthVerifier = null, array $params = []) { $incomingRequest = Yii::$app->getRequest(); if ($oauthToken === null) { $oauthToken = $incomingRequest->get('oauth_token', $incomingRequest->post('oauth_token', $oauthToken)); } if (!is_object($requestToken)) { $requestToken = $this->getState('requestToken'); if (!is_object($requestToken)) { throw new InvalidParamException('Request token is required to fetch access token!'); } } if (strcmp($requestToken->getToken(), $oauthToken) !== 0) { throw new HttpException(400, 'Invalid auth state parameter.'); } $this->removeState('requestToken'); $defaultParams = [ 'oauth_consumer_key' => $this->consumerKey, 'oauth_token' => $requestToken->getToken() ]; if ($oauthVerifier === null) { $oauthVerifier = $incomingRequest->get('oauth_verifier', $incomingRequest->post('oauth_verifier')); } if (!empty($oauthVerifier)) { $defaultParams['oauth_verifier'] = $oauthVerifier; } $request = $this->createRequest() ->setMethod($this->accessTokenMethod) ->setUrl($this->accessTokenUrl) ->setData(array_merge($defaultParams, $params)); $this->signRequest($request, $requestToken); $response = $this->sendRequest($request); $token = $this->createToken([ 'params' => $response ]); $this->setAccessToken($token); return $token; }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
public function fetchAccessToken($authCode, array $params = []) { if ($this->validateAuthState) { $authState = $this->getState('authState'); $incomingRequest = Yii::$app->getRequest(); $incomingState = $incomingRequest->get('state', $incomingRequest->post('state')); if (!isset($incomingState) || empty($authState) || strcmp($incomingState, $authState) !== 0) { throw new HttpException(400, 'Invalid auth state parameter.'); } $this->removeState('authState'); } $defaultParams = [ 'code' => $authCode, 'grant_type' => 'authorization_code', 'redirect_uri' => $this->getReturnUrl(), ]; if ($this->enablePkce) { $authCodeVerifier = $this->getState('authCodeVerifier'); if (empty($authCodeVerifier)) { // Prevent PKCE Downgrade Attack // https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#name-pkce-downgrade-attack throw new HttpException(409, 'Invalid auth code verifier.'); } $defaultParams['code_verifier'] = $authCodeVerifier; $this->removeState('authCodeVerifier'); } $request = $this->createRequest() ->setMethod('POST') ->setUrl($this->tokenUrl) ->setData(array_merge($defaultParams, $params)); // Azure AD will complain if there is no `Origin` header. if ($this->enablePkce) { $request->addHeaders(['Origin' => Url::to('/')]); } $this->applyClientCredentialsToRequest($request); $response = $this->sendRequest($request); $token = $this->createToken(['params' => $response]); $this->setAccessToken($token); return $token; }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
protected function createToken(array $tokenConfig = []) { if ($this->validateJws) { $jwsData = $this->loadJws($tokenConfig['params']['id_token']); $this->validateClaims($jwsData); $tokenConfig['params'] = array_merge($tokenConfig['params'], $jwsData); if ($this->getValidateAuthNonce()) { $authNonce = $this->getState('authNonce'); if (!isset($jwsData['nonce']) || empty($authNonce) || strcmp($jwsData['nonce'], $authNonce) !== 0) { throw new HttpException(400, 'Invalid auth nonce'); } else { $this->removeState('authNonce'); } } } return parent::createToken($tokenConfig); }
0
PHP
NVD-CWE-Other
Other
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.
https://nvd.nist.gov/vuln/categories
vulnerable
return rawurlencode($varDefinitions[$k]); }, $operation['http']['requestUri'] ); // Add the query string variables or appending to one if needed. if (!empty($opts['query'])) { $relative = $this->appendQuery($opts['query'], $relative); } $path = $this->endpoint->getPath(); //Accounts for trailing '/' in path when custom endpoint //is provided to endpointProviderV2 if ($this->api->isModifiedModel() && $this->api->getServiceName() === 's3' ) { if (substr($path, -1) === '/' && $relative[0] === '/') { $path = rtrim($path, '/'); } $relative = $path . $relative; } // If endpoint has path, remove leading '/' to preserve URI resolution. if ($path && $relative[0] === '/') { $relative = substr($relative, 1); } //Append path to endpoint when leading '//...' present // as uri cannot be properly resolved if ($this->api->isModifiedModel() && strpos($relative, '//') === 0 ) { return new Uri($this->endpoint . $relative); } // Expand path place holders using Amazon's slightly different URI // template syntax. return UriResolver::resolve($this->endpoint, new Uri($relative)); }
0
PHP
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
public function initContent() { parent::initContent(); $post = $this->getBeesBlogPost(); if (! $post) { Tools::redirect(BeesBlog::getBeesBlogLink()); return; } // mark post as viewed BeesBlogPost::viewed($post->id); if (Configuration::get(BeesBlog::SOCIAL_SHARING)) { $this->context->controller->addCSS(_PS_MODULE_DIR_.'beesblog/views/css/socialmedia.css', 'all'); $this->context->controller->addJS(_PS_MODULE_DIR_.'beesblog/views/js/socialmedia.js'); } Media::addJsDef([ 'sharing_name' => addcslashes($post->title, "'"), 'sharing_url' => addcslashes(Tools::getHttpHost(true).$_SERVER['REQUEST_URI'], "'"), 'sharing_img' => addcslashes(Tools::getHttpHost(true).'/img/beesblog/posts/'.(int) $post->id.'.jpg', "'"), ]);
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public function sentAssetAcceptanceReminder($acceptanceId = null) { $this->authorize('reports.view'); if (!$acceptance = CheckoutAcceptance::pending()->find($acceptanceId)) { // Redirect to the unaccepted assets report page with error return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data')); } $assetItem = $acceptance->checkoutable; if (is_null($acceptance->created_at)){ return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data')); } else { $logItem_res = $assetItem->checkouts()->where('created_at', '=', $acceptance->created_at)->get(); if ($logItem_res->isEmpty()){ return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data')); } $logItem = $logItem_res[0]; } if(!$assetItem->assignedTo->locale){ Notification::locale(Setting::getSettings()->locale)->send( $assetItem->assignedTo, new CheckoutAssetNotification($assetItem, $assetItem->assignedTo, $logItem->user, $acceptance, $logItem->note) ); } else { Notification::send( $assetItem->assignedTo, new CheckoutAssetNotification($assetItem, $assetItem->assignedTo, $logItem->user, $acceptance, $logItem->note) ); } return redirect()->route('reports/unaccepted_assets')->with('success', trans('admin/reports/general.reminder_sent')); }
0
PHP
CWE-352
Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.
https://cwe.mitre.org/data/definitions/352.html
vulnerable
public function markdown(){ $this->markdownEnable = true; // 保护markdown内容不受XUBBP解析器干扰 /*urltxt 文本链接*/ $this->parse['!^(.*?)((?:https?|ftps?|rtsp)\://[a-zA-Z0-9\.\,\?\!\(\)\[\]\@\/\:\_\;\+\&\%\*\=\~\^\#\-]+)(.*)$!is'] = array(array(1, 3), 'mdlink', array(2)); /*mailtxt 文本电子邮件地址*/ $this->parse['!^(.*?)((?:mailto:)?[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,4})(.*)$!is'] = array(array(1, 3), 'mdpre', array(2)); // 添加新的匹配规则 $parseHead = [ /*mdcode markdown代码高亮*/ '!^(^|.*?\n)( *)(`{3,})( *[^`\n]+?)?( *\n.*?\n *)\3( *\n.*| *$)$!is' => array(array(1, 6), 'mdcode', array(4, 5, 3, 2)), /*code 代码高亮(标记独占一行,高优先级)*/ '!^(^|.*?\n+)\[code(?:=([^\]]*))?\](\n+.*?\n+)\[/code\](\n+.*|$)$!is' => array(array(1, 4), 'code', array(2, 3)), /* html 通过iframe的srcdoc属性实现的HTML内容嵌入(标记独占一行,高优先级)*/ '!^(^|.*?\n+)\[html(=[^\]]*)?\](\n+.*?\n+)\[/html\](\n+.*|$)$!is' => array(array(1, 4), 'html', array(2, 3)), /* textbox 文本框(标记独占一行,高优先级)*/ '!^(^|.*?\n+)\[text(?:=([^\]]*))?\](\n+.*?\n+)\[/text\](\n+.*|$)$!is' => array(array(1, 4), 'textbox', array(2, 3)), /* 4个空格或一个tab开头的markdown代码块 */ '!^(^|.*?\n+)((?:\t| )[^\n]*(?:\n+(?:\t| )[^\n]*)*)(\n+.*|$)$!is' => array(array(1, 3), 'mdpre', array(2)), /*inline代码(优先级比上面的低)*/ '!^(.*?)((`+).+?\3)(.*)$!is' => array(array(1, 4), 'mdpre', array(2)), ]; $this->parse = $parseHead + $this->parse; return array(array( 'type' => 'markdown', )); }
0
PHP
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
private function filterIn(){ $in = $this->in; unset($in['URLrouter'],$in['URLremote'],$in['HTTP_DEBUG_URL'],$in['CSRF_TOKEN'],$in['accessToken'],$in[str_replace(".", "/", ACTION)]); return $in; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
private function filterIn(){ $in = $this->in; unset($in['URLrouter'],$in['URLremote'],$in['HTTP_DEBUG_URL'],$in['CSRF_TOKEN'],$in['accessToken'],$in[str_replace(".", "/", ACTION)]); return $in; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function srvPhpinfo(){ phpinfo();exit; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function srvPhpinfo(){ phpinfo();exit; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function checkAccessToken(){ $config = Model('Plugin')->getConfig('fileView'); if(!$config['apiKey']) return; $timeTo = isset($this->in['timeTo'])?intval($this->in['timeTo']):''; $token = md5($this->in['path'].$timeTo.$config['apiKey']); if($token != $this->in['token']){ show_tips('token ' . LNG('common.error')); } if($timeTo != '' && $timeTo <= time()){ show_tips('token ' . LNG('common.expired')); } }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function checkAccessToken(){ $config = Model('Plugin')->getConfig('fileView'); if(!$config['apiKey']) return; $timeTo = isset($this->in['timeTo'])?intval($this->in['timeTo']):''; $token = md5($this->in['path'].$timeTo.$config['apiKey']); if($token != $this->in['token']){ show_tips('token ' . LNG('common.error')); } if($timeTo != '' && $timeTo <= time()){ show_tips('token ' . LNG('common.expired')); } }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
private function fileGetZipContentCheck($path){ if(!request_url_safe($path)) return; $urlInfo = parse_url_query($path); if(!isset($urlInfo['index']) || !isset($urlInfo['path']) || !isset($urlInfo['accessToken'])) return; if(!Action('user.index')->accessTokenCheck($urlInfo['accessToken'])){return;} $zipFile = rawurldecode($urlInfo['path']); $indexArr = @json_decode(rawurldecode($urlInfo['index']),true); if(!$indexArr || !$zipFile){show_json(LNG('common.pathNotExists'),false);} $isShareFile = isset($urlInfo['explorer/share/unzipList']); $isViewFile = isset($urlInfo['explorer/index/unzipList']); // 权限判断; if($isShareFile){ $shareFileInfo = Action("explorer.share")->sharePathInfo($zipFile); if(!$shareFileInfo){show_json(LNG('explorer.noPermissionAction'),false);} $zipFile = $shareFileInfo['path']; }else if($isViewFile){ if(!Action('explorer.auth')->canRead($zipFile)){ show_json(LNG('explorer.noPermissionAction'),false); } }else{return;} // 解压处理; $filePart = IOArchive::unzipPart($zipFile,$indexArr); if(!$filePart || !IO::exist($filePart['file'])){ show_json(LNG('common.pathNotExists'),false); } $this->fileGetMake($filePart['file'],IO::info($filePart['file']),$path);exit; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
private function fileGetZipContentCheck($path){ if(!request_url_safe($path)) return; $urlInfo = parse_url_query($path); if(!isset($urlInfo['index']) || !isset($urlInfo['path']) || !isset($urlInfo['accessToken'])) return; if(!Action('user.index')->accessTokenCheck($urlInfo['accessToken'])){return;} $zipFile = rawurldecode($urlInfo['path']); $indexArr = @json_decode(rawurldecode($urlInfo['index']),true); if(!$indexArr || !$zipFile){show_json(LNG('common.pathNotExists'),false);} $isShareFile = isset($urlInfo['explorer/share/unzipList']); $isViewFile = isset($urlInfo['explorer/index/unzipList']); // 权限判断; if($isShareFile){ $shareFileInfo = Action("explorer.share")->sharePathInfo($zipFile); if(!$shareFileInfo){show_json(LNG('explorer.noPermissionAction'),false);} $zipFile = $shareFileInfo['path']; }else if($isViewFile){ if(!Action('explorer.auth')->canRead($zipFile)){ show_json(LNG('explorer.noPermissionAction'),false); } }else{return;} // 解压处理; $filePart = IOArchive::unzipPart($zipFile,$indexArr); if(!$filePart || !IO::exist($filePart['file'])){ show_json(LNG('common.pathNotExists'),false); } $this->fileGetMake($filePart['file'],IO::info($filePart['file']),$path);exit; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function rename() { $data = Input::getArray(array( "name" => array("check"=>"require"), "newName" => array("check"=>"require"), )); $res = $this->model->rename($data['name'],$data['newName']); $msg = !!$res ? LNG('explorer.success') : LNG('explorer.repeatError'); show_json($msg,!!$res); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function rename() { $data = Input::getArray(array( "name" => array("check"=>"require"), "newName" => array("check"=>"require"), )); $res = $this->model->rename($data['name'],$data['newName']); $msg = !!$res ? LNG('explorer.success') : LNG('explorer.repeatError'); show_json($msg,!!$res); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function mkfile(){ $this->pathAllowCheck($this->in['path'],true); $info = IO::info($this->in['path']); if($info && $info['type'] == 'file'){ //父目录为文件; show_json(LNG('explorer.success'),true,IO::pathFather($info['path'])); } $tplPath = BASIC_PATH.'static/others/newfile-tpl/'; $ext = get_path_ext($this->in['path']); $tplFile = $tplPath.'newfile.'.$ext; $content = _get($this->in,'content',''); if( isset($this->in['content']) ){ if( _get($this->in,'base64') ){ //文件内容base64; $content = base64_decode($content); } }else if(@file_exists($tplFile)){ $content = file_get_contents($tplFile); } $repeat = !empty($this->in['fileRepeat']) ? $this->in['fileRepeat']:REPEAT_RENAME; $result = IO::mkfile($this->in['path'],$content,$repeat); $errorLast = IO::getLastError(LNG('explorer.error')); $msg = !!$result ? LNG('explorer.success') : $errorLast; show_json($msg,!!$result,$result); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function mkfile(){ $this->pathAllowCheck($this->in['path'],true); $info = IO::info($this->in['path']); if($info && $info['type'] == 'file'){ //父目录为文件; show_json(LNG('explorer.success'),true,IO::pathFather($info['path'])); } $tplPath = BASIC_PATH.'static/others/newfile-tpl/'; $ext = get_path_ext($this->in['path']); $tplFile = $tplPath.'newfile.'.$ext; $content = _get($this->in,'content',''); if( isset($this->in['content']) ){ if( _get($this->in,'base64') ){ //文件内容base64; $content = base64_decode($content); } }else if(@file_exists($tplFile)){ $content = file_get_contents($tplFile); } $repeat = !empty($this->in['fileRepeat']) ? $this->in['fileRepeat']:REPEAT_RENAME; $result = IO::mkfile($this->in['path'],$content,$repeat); $errorLast = IO::getLastError(LNG('explorer.error')); $msg = !!$result ? LNG('explorer.success') : $errorLast; show_json($msg,!!$result,$result); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function pathAllowCheck($path){ $notAllow = array('/', '\\', ':', '*', '?', '"', '<', '>', '|'); $parse = KodIO::parse($path); if($parse['pathBase']){ $path = $parse['param']; } $name = get_path_this($path); $checkName = str_replace($notAllow,'_',$name); if($name != $checkName){ show_json(LNG('explorer.charNoSupport').implode(',',$notAllow),false); } $maxLength = $GLOBALS['config']['systemOption']['fileNameLengthMax']; if($maxLength && strlen($name) > $maxLength ){ show_json(LNG("common.lengthLimit")." (max=$maxLength)",false); } return; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function pathAllowCheck($path){ $notAllow = array('/', '\\', ':', '*', '?', '"', '<', '>', '|'); $parse = KodIO::parse($path); if($parse['pathBase']){ $path = $parse['param']; } $name = get_path_this($path); $checkName = str_replace($notAllow,'_',$name); if($name != $checkName){ show_json(LNG('explorer.charNoSupport').implode(',',$notAllow),false); } $maxLength = $GLOBALS['config']['systemOption']['fileNameLengthMax']; if($maxLength && strlen($name) > $maxLength ){ show_json(LNG("common.lengthLimit")." (max=$maxLength)",false); } return; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function fileOutBy(){ if(!$this->in['path']) return; // 拼接转换相对路径; $add = rawurldecode($this->in['add']); $parse = kodIO::parse($this->in['path']); $allow = array('',kodIO::KOD_IO,kodIO::KOD_USER_DRIVER,kodIO::KOD_SHARE_LINK); if(in_array($parse['type'],$allow)){ $distPath = kodIO::pathTrue(get_path_father($parse['path']).'/'.ltrim($add,'/')); $distInfo = IO::info($distPath); }else{//KOD_SOURCE KOD_SHARE_ITEM(source,) $info = IO::info($parse['path']); if($parse['type'] == kodIO::KOD_SOURCE){ $level = Model("Source")->parentLevelArray($info['parentLevel']); $pathRoot = '{source:'.$level[0].'}'; }else if($parse['type'] == kodIO::KOD_SHARE_ITEM){ $pathArr = explode('/',trim($parse['path'],'/')); $pathRoot = $pathArr[0]; $shareInfo = Model('Share')->getInfo($parse['id']); // source路径内部协作分享; if($shareInfo['sourceID']){$pathRoot = $pathRoot.'/'.$shareInfo['sourceID'];} } $displayPathArr = explode('/',trim($info['pathDisplay'],'/'));array_shift($displayPathArr); $displayPath = $pathRoot.'/'.implode('/',$displayPathArr); $distPath = kodIO::pathTrue(get_path_father($displayPath).'/'.$add); $distInfo = IO::infoFullSimple($distPath); } // pr($distPath,$distInfo,$parse,[$pathRoot,$displayPath,$info,$shareInfo]);exit; if(!$distInfo || $distInfo['type'] != 'file'){ return show_json(LNG('common.pathNotExists'),false); } ActionCall('explorer.auth.canView',$distInfo['path']);// 再次判断新路径权限; $this->updateLastOpen($distInfo['path']); Hook::trigger('explorer.fileOut', $distInfo['path']); IO::fileOut($distInfo['path'],false); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function fileOutBy(){ if(!$this->in['path']) return; // 拼接转换相对路径; $add = rawurldecode($this->in['add']); $parse = kodIO::parse($this->in['path']); $allow = array('',kodIO::KOD_IO,kodIO::KOD_USER_DRIVER,kodIO::KOD_SHARE_LINK); if(in_array($parse['type'],$allow)){ $distPath = kodIO::pathTrue(get_path_father($parse['path']).'/'.ltrim($add,'/')); $distInfo = IO::info($distPath); }else{//KOD_SOURCE KOD_SHARE_ITEM(source,) $info = IO::info($parse['path']); if($parse['type'] == kodIO::KOD_SOURCE){ $level = Model("Source")->parentLevelArray($info['parentLevel']); $pathRoot = '{source:'.$level[0].'}'; }else if($parse['type'] == kodIO::KOD_SHARE_ITEM){ $pathArr = explode('/',trim($parse['path'],'/')); $pathRoot = $pathArr[0]; $shareInfo = Model('Share')->getInfo($parse['id']); // source路径内部协作分享; if($shareInfo['sourceID']){$pathRoot = $pathRoot.'/'.$shareInfo['sourceID'];} } $displayPathArr = explode('/',trim($info['pathDisplay'],'/'));array_shift($displayPathArr); $displayPath = $pathRoot.'/'.implode('/',$displayPathArr); $distPath = kodIO::pathTrue(get_path_father($displayPath).'/'.$add); $distInfo = IO::infoFullSimple($distPath); } // pr($distPath,$distInfo,$parse,[$pathRoot,$displayPath,$info,$shareInfo]);exit; if(!$distInfo || $distInfo['type'] != 'file'){ return show_json(LNG('common.pathNotExists'),false); } ActionCall('explorer.auth.canView',$distInfo['path']);// 再次判断新路径权限; $this->updateLastOpen($distInfo['path']); Hook::trigger('explorer.fileOut', $distInfo['path']); IO::fileOut($distInfo['path'],false); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
$userRootShow = _get($GLOBALS,'isRoot') && $GLOBALS['config']["ADMIN_ALLOW_SOURCE"]; if(!$userRootShow){ if( !$pathInfo['auth'] || $pathInfo['auth']['authValue'] == 0){ // 放过-1; 打开通路; continue;// 没有权限; } } // 没有子文件夹; 则获取是否有子部门; // if( !$pathInfo['hasFolder'] && !$pathInfo['hasFile'] ){ if( !$pathInfo['hasFolder'] ){ $groupInfo = Model('Group')->getInfo($groupID); $pathInfo['hasFolder'] = $groupInfo ? $groupInfo['hasChildren']:false; } $result[] = $pathInfo; } // pr($result,$groupSource,$group,$groupArray);exit; return $result; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
$userRootShow = _get($GLOBALS,'isRoot') && $GLOBALS['config']["ADMIN_ALLOW_SOURCE"]; if(!$userRootShow){ if( !$pathInfo['auth'] || $pathInfo['auth']['authValue'] == 0){ // 放过-1; 打开通路; continue;// 没有权限; } } // 没有子文件夹; 则获取是否有子部门; // if( !$pathInfo['hasFolder'] && !$pathInfo['hasFile'] ){ if( !$pathInfo['hasFolder'] ){ $groupInfo = Model('Group')->getInfo($groupID); $pathInfo['hasFolder'] = $groupInfo ? $groupInfo['hasChildren']:false; } $result[] = $pathInfo; } // pr($result,$groupSource,$group,$groupArray);exit; return $result; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function fileGetHash(){ $pageNum = 1024 * 1024 * 10; $this->in['pageNum'] = isset($this->in['pageNum']) ? $this->in['pageNum'] : $pageNum; $this->in['pageNum'] = $this->in['pageNum'] >= $pageNum ? $pageNum : $this->in['pageNum']; // ActionCall("explorer.editor.fileGet");exit; $url = $this->in['path']; $urlInfo = parse_url_query($url); if( !isset($urlInfo["explorer/share/unzipListHash"]) && !isset($urlInfo["accessToken"])){ show_json(LNG('common.pathNotExists'),false); } $index = json_decode(rawurldecode($urlInfo['index']),true); $zipFile = $this->fileHash(rawurldecode($urlInfo['path'])); $filePart = IOArchive::unzipPart($zipFile,$index ? $index:'-1'); if(!$filePart || !IO::exist($filePart['file'])){ show_json(LNG('common.pathNotExists'),false); } Action("explorer.editor")->fileGetMake($filePart['file'],IO::info($filePart['file']),$url); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function fileGetHash(){ $pageNum = 1024 * 1024 * 10; $this->in['pageNum'] = isset($this->in['pageNum']) ? $this->in['pageNum'] : $pageNum; $this->in['pageNum'] = $this->in['pageNum'] >= $pageNum ? $pageNum : $this->in['pageNum']; // ActionCall("explorer.editor.fileGet");exit; $url = $this->in['path']; $urlInfo = parse_url_query($url); if( !isset($urlInfo["explorer/share/unzipListHash"]) && !isset($urlInfo["accessToken"])){ show_json(LNG('common.pathNotExists'),false); } $index = json_decode(rawurldecode($urlInfo['index']),true); $zipFile = $this->fileHash(rawurldecode($urlInfo['path'])); $filePart = IOArchive::unzipPart($zipFile,$index ? $index:'-1'); if(!$filePart || !IO::exist($filePart['file'])){ show_json(LNG('common.pathNotExists'),false); } Action("explorer.editor")->fileGetMake($filePart['file'],IO::info($filePart['file']),$url); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function fileOut(){ $path = rawurldecode($this->in['path']);//允许中文空格等; if(request_url_safe($path)) { header('Location:' . $path);exit; } $path = $this->parsePath($path); $isDownload = isset($this->in['download']) && $this->in['download'] == 1; Hook::trigger('explorer.fileOut', $path); if(isset($this->in['type']) && $this->in['type'] == 'image'){ $info = IO::info($path); $imageThumb = array('jpg','png','jpeg','bmp'); if ($info['size'] >= 1024*200 && function_exists('imagecolorallocate') && in_array($info['ext'],$imageThumb) ){ return IO::fileOutImage($path,$this->in['width']); } } IO::fileOut($path,$isDownload); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function fileOut(){ $path = rawurldecode($this->in['path']);//允许中文空格等; if(request_url_safe($path)) { header('Location:' . $path);exit; } $path = $this->parsePath($path); $isDownload = isset($this->in['download']) && $this->in['download'] == 1; Hook::trigger('explorer.fileOut', $path); if(isset($this->in['type']) && $this->in['type'] == 'image'){ $info = IO::info($path); $imageThumb = array('jpg','png','jpeg','bmp'); if ($info['size'] >= 1024*200 && function_exists('imagecolorallocate') && in_array($info['ext'],$imageThumb) ){ return IO::fileOutImage($path,$this->in['width']); } } IO::fileOut($path,$isDownload); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function linkOut($path,$token=false){ $parse = KodIO::parse($path); $info = IO::info($path); $apiKey = 'explorer/index/fileOut'; if($parse['type'] == KodIO::KOD_SHARE_LINK){ $apiKey = 'explorer/share/fileOut'; } $etag = substr(md5($path),0,5); $name = isset($this->in['name']) ? rawurlencode($this->in['name']):''; if($info){ $name = rawurlencode($info['name']); $etag = substr(md5($info['modifyTime'].$info['size']),0,5); } $url = urlApi($apiKey,"path=".rawurlencode($path).'&et='.$etag.'&name=/'.$name); if($token) $url .= '&accessToken='.Action('user.index')->accessToken(); return $url; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function linkOut($path,$token=false){ $parse = KodIO::parse($path); $info = IO::info($path); $apiKey = 'explorer/index/fileOut'; if($parse['type'] == KodIO::KOD_SHARE_LINK){ $apiKey = 'explorer/share/fileOut'; } $etag = substr(md5($path),0,5); $name = isset($this->in['name']) ? rawurlencode($this->in['name']):''; if($info){ $name = rawurlencode($info['name']); $etag = substr(md5($info['modifyTime'].$info['size']),0,5); } $url = urlApi($apiKey,"path=".rawurlencode($path).'&et='.$etag.'&name=/'.$name); if($token) $url .= '&accessToken='.Action('user.index')->accessToken(); return $url; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
private function checkCsrfToken(){ if(isset($_REQUEST['accessToken'])) return; if(!$this->in['CSRF_TOKEN'] || $this->in['CSRF_TOKEN'] != Cookie::get('CSRF_TOKEN')){ $className = substr(ACTION,0,strrpos(ACTION,'.')); if(!Action($className)){header('HTTP/1.1 404 Not Found');exit;} //write_log(array('CSRF_TOKEN error',$this->in,$_COOKIE,$_SERVER['HTTP_USER_AGENT']),'error'); Cookie::remove('CSRF_TOKEN');// 部分手机浏览器异常情况(ios-夸克浏览器: 打开zip内视频,关闭后拉取文件列表) return show_json('CSRF_TOKEN error!',false); } }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
private function checkCsrfToken(){ if(isset($_REQUEST['accessToken'])) return; if(!$this->in['CSRF_TOKEN'] || $this->in['CSRF_TOKEN'] != Cookie::get('CSRF_TOKEN')){ $className = substr(ACTION,0,strrpos(ACTION,'.')); if(!Action($className)){header('HTTP/1.1 404 Not Found');exit;} //write_log(array('CSRF_TOKEN error',$this->in,$_COOKIE,$_SERVER['HTTP_USER_AGENT']),'error'); Cookie::remove('CSRF_TOKEN');// 部分手机浏览器异常情况(ios-夸克浏览器: 打开zip内视频,关闭后拉取文件列表) return show_json('CSRF_TOKEN error!',false); } }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function allowChangeUserRole($roleID){ if(_get($GLOBALS,'isRoot')) return true; $authInfo = Model('SystemRole')->listData($roleID); if($authInfo && $authInfo['administrator'] == 1) return false; // 系统管理员不允许非系统管理员获取,设置 if(!$this->config["ADMIN_ALLOW_ALL_ACTION"]){return true;} // 启用了三权分立,安全保密员允许获取,或设置用户的角色; return $this->roleActionAllow($authInfo['auth']); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function allowChangeUserRole($roleID){ if(_get($GLOBALS,'isRoot')) return true; $authInfo = Model('SystemRole')->listData($roleID); if($authInfo && $authInfo['administrator'] == 1) return false; // 系统管理员不允许非系统管理员获取,设置 if(!$this->config["ADMIN_ALLOW_ALL_ACTION"]){return true;} // 启用了三权分立,安全保密员允许获取,或设置用户的角色; return $this->roleActionAllow($authInfo['auth']); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
private function checkItem($actions){ $action = strtolower(ACTION); if(!isset($actions[$action])) return; if(!Session::get("kodUser")){show_json(LNG('user.loginFirst'),ERROR_CODE_LOGOUT);} $check = $actions[$action]; if($check['read'] == 'allow'){return $this->checkItemRead($check,$action);} $allow = true; if($allow && $check['group']){ $groupID = $this->in[$check['group']]; $allow = $this->allowChangeGroup($groupID); $adminGroup = $this->userGroupAdmin(); // 自己为管理员的根部门: 禁用编辑与删除; $disableAction = array('admin.group.edit','admin.group.remove'); if(in_array($action,$disableAction) && in_array($groupID,$adminGroup)){$allow = false;} } $err = $allow ? -1:0; if($allow){$allow = $this->userAuthEditCheck();$err=$allow?$err:1;} if($allow && $check['user']){ $allow = $this->allowChangeUser($this->in[$check['user']]);$err=$allow?$err:2;} if($allow && $check['userRole']){$allow = $this->allowChangeUserRole($this->in[$check['userRole']]);$err=$allow?$err:3;} if($allow && $check['roleAuth']){$allow = $this->roleActionAllow($this->in[$check['roleAuth']]);$err=$allow?$err:4;} if($allow && $check['groupArray']){$allow = $this->allowChangeGroupArray($check);$err=$allow?$err:5;} // pr($err,$allow,$check,$this->in,'GET:',$_REQUEST);exit; if($allow) return true; $this->checkError($check); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
private function checkItem($actions){ $action = strtolower(ACTION); if(!isset($actions[$action])) return; if(!Session::get("kodUser")){show_json(LNG('user.loginFirst'),ERROR_CODE_LOGOUT);} $check = $actions[$action]; if($check['read'] == 'allow'){return $this->checkItemRead($check,$action);} $allow = true; if($allow && $check['group']){ $groupID = $this->in[$check['group']]; $allow = $this->allowChangeGroup($groupID); $adminGroup = $this->userGroupAdmin(); // 自己为管理员的根部门: 禁用编辑与删除; $disableAction = array('admin.group.edit','admin.group.remove'); if(in_array($action,$disableAction) && in_array($groupID,$adminGroup)){$allow = false;} } $err = $allow ? -1:0; if($allow){$allow = $this->userAuthEditCheck();$err=$allow?$err:1;} if($allow && $check['user']){ $allow = $this->allowChangeUser($this->in[$check['user']]);$err=$allow?$err:2;} if($allow && $check['userRole']){$allow = $this->allowChangeUserRole($this->in[$check['userRole']]);$err=$allow?$err:3;} if($allow && $check['roleAuth']){$allow = $this->roleActionAllow($this->in[$check['roleAuth']]);$err=$allow?$err:4;} if($allow && $check['groupArray']){$allow = $this->allowChangeGroupArray($check);$err=$allow?$err:5;} // pr($err,$allow,$check,$this->in,'GET:',$_REQUEST);exit; if($allow) return true; $this->checkError($check); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function accessToken(){ $pass = Model('SystemOption')->get('systemPassword'); $pass = substr(md5('kodbox_'.$pass),0,15); $token = Mcrypt::encode(Session::sign(),$pass,3600*24*30); return $token; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function accessToken(){ $pass = Model('SystemOption')->get('systemPassword'); $pass = substr(md5('kodbox_'.$pass),0,15); $token = Mcrypt::encode(Session::sign(),$pass,3600*24*30); return $token; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function accessTokenCheck($accessToken){ $systemPassword = Model('SystemOption')->get('systemPassword'); if(!$accessToken || strlen($accessToken) > 500) return false; $pass = substr(md5('kodbox_'.$systemPassword),0,15); $sessionSign = Mcrypt::decode($accessToken,$pass); if(!$sessionSign || $sessionSign != Session::sign()) return false; return true; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function accessTokenCheck($accessToken){ $systemPassword = Model('SystemOption')->get('systemPassword'); if(!$accessToken || strlen($accessToken) > 500) return false; $pass = substr(md5('kodbox_'.$systemPassword),0,15); $sessionSign = Mcrypt::decode($accessToken,$pass); if(!$sessionSign || $sessionSign != Session::sign()) return false; return true; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function accessTokenGet(){ if(!Session::get('kodUser')){ show_json('user not login!',ERROR_CODE_LOGOUT); } show_json($this->accessToken(),true); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function accessTokenGet(){ if(!Session::get('kodUser')){ show_json('user not login!',ERROR_CODE_LOGOUT); } show_json($this->accessToken(),true); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
private function initSession(){ $this->apiSignCheck(); // 入口不处理cookie,兼容服务器启用了全GET缓存情况(输出前一次用户登录的cookie,导致账号登录异常) $action= strtolower(ACTION); if( $action == 'user.index.index' || $action == 'user.view.call'){ Cookie::disable(true); } $systemPassword = Model('SystemOption')->get('systemPassword'); $accessToken = isset($_REQUEST['accessToken']) ? $_REQUEST['accessToken'] : ''; if($accessToken && strlen($accessToken) < 500){ $pass = substr(md5('kodbox_'.$systemPassword),0,15); $sessionSign = Mcrypt::decode($accessToken,$pass); if(!$sessionSign){show_json(LNG('common.loginTokenError'),ERROR_CODE_LOGOUT);} $this->initAccessToken(); Session::sign($sessionSign); } if(!Session::get('kod')){ Session::set('kod',1); if(!Session::get('kod')){show_tips(LNG('explorer.sessionSaveError'));} } // 注意: Session设置sessionid的cookie;两个请求时间过于相近,可能导致删除cookie失败的问题;(又有sessionid请求覆盖) // 设置csrf防护; if(!Cookie::get('CSRF_TOKEN')){Cookie::set('CSRF_TOKEN',rand_string(16));} }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
private function initSession(){ $this->apiSignCheck(); // 入口不处理cookie,兼容服务器启用了全GET缓存情况(输出前一次用户登录的cookie,导致账号登录异常) $action= strtolower(ACTION); if( $action == 'user.index.index' || $action == 'user.view.call'){ Cookie::disable(true); } $systemPassword = Model('SystemOption')->get('systemPassword'); $accessToken = isset($_REQUEST['accessToken']) ? $_REQUEST['accessToken'] : ''; if($accessToken && strlen($accessToken) < 500){ $pass = substr(md5('kodbox_'.$systemPassword),0,15); $sessionSign = Mcrypt::decode($accessToken,$pass); if(!$sessionSign){show_json(LNG('common.loginTokenError'),ERROR_CODE_LOGOUT);} $this->initAccessToken(); Session::sign($sessionSign); } if(!Session::get('kod')){ Session::set('kod',1); if(!Session::get('kod')){show_tips(LNG('explorer.sessionSaveError'));} } // 注意: Session设置sessionid的cookie;两个请求时间过于相近,可能导致删除cookie失败的问题;(又有sessionid请求覆盖) // 设置csrf防护; if(!Cookie::get('CSRF_TOKEN')){Cookie::set('CSRF_TOKEN',rand_string(16));} }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
private function initAccessToken(){ $action = strtolower(ACTION); $disableCookie = array( 'explorer.index.filedownload', 'explorer.index.fileout', 'explorer.share.filedownload', 'explorer.share.fileout', ); $enableCookie = array('user.index.index'); if(in_array($action,$enableCookie)){Cookie::disable(false);} // 带token的url跳转入口页面允许cookie输出; if(in_array($action,$disableCookie)){Cookie::disable(true);allowCROS();} }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
private function initAccessToken(){ $action = strtolower(ACTION); $disableCookie = array( 'explorer.index.filedownload', 'explorer.index.fileout', 'explorer.share.filedownload', 'explorer.share.fileout', ); $enableCookie = array('user.index.index'); if(in_array($action,$enableCookie)){Cookie::disable(false);} // 带token的url跳转入口页面允许cookie输出; if(in_array($action,$disableCookie)){Cookie::disable(true);allowCROS();} }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
function get_path_ext($path){ $name = get_path_this($path); $ext = ''; if(strstr($name,'.')){ $ext = substr($name,strrpos($name,'.')+1); $ext = strtolower($ext); } if (strlen($ext)>3 && preg_match("/([\x81-\xfe][\x40-\xfe])/", $ext, $match)) { $ext = ''; } return htmlspecialchars($ext); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
function get_path_ext($path){ $name = get_path_this($path); $ext = ''; if(strstr($name,'.')){ $ext = substr($name,strrpos($name,'.')+1); $ext = strtolower($ext); } if (strlen($ext)>3 && preg_match("/([\x81-\xfe][\x40-\xfe])/", $ext, $match)) { $ext = ''; } return htmlspecialchars($ext); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public static function image($file){ $info = ''; $data = GetImageSize($file, $info); $img = false; //var_dump($data,$file,memory_get_usage()-$GLOBALS['config']['appMemoryStart']); switch ($data[2]) { case IMAGETYPE_GIF: if (!function_exists('imagecreatefromgif')) { break; } $img = imagecreatefromgif($file); break; case IMAGETYPE_JPEG: if (!function_exists('imagecreatefromjpeg')) { break; } $img = imagecreatefromjpeg($file); break; case IMAGETYPE_PNG: if (!function_exists('imagecreatefrompng')) { break; } $img = @imagecreatefrompng($file); imagesavealpha($img,true); break; case IMAGETYPE_XBM: $img = imagecreatefromxbm($file); break; case IMAGETYPE_WBMP: $img = imagecreatefromwbmp($file); break; case IMAGETYPE_BMP: $img = imagecreatefrombmp($file); break; default:break; } return $img; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public static function image($file){ $info = ''; $data = GetImageSize($file, $info); $img = false; //var_dump($data,$file,memory_get_usage()-$GLOBALS['config']['appMemoryStart']); switch ($data[2]) { case IMAGETYPE_GIF: if (!function_exists('imagecreatefromgif')) { break; } $img = imagecreatefromgif($file); break; case IMAGETYPE_JPEG: if (!function_exists('imagecreatefromjpeg')) { break; } $img = imagecreatefromjpeg($file); break; case IMAGETYPE_PNG: if (!function_exists('imagecreatefrompng')) { break; } $img = @imagecreatefrompng($file); imagesavealpha($img,true); break; case IMAGETYPE_XBM: $img = imagecreatefromxbm($file); break; case IMAGETYPE_WBMP: $img = imagecreatefromwbmp($file); break; case IMAGETYPE_BMP: $img = imagecreatefrombmp($file); break; default:break; } return $img; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
protected function addFileHeader($name,$zipMethod){ $name = preg_replace('/^\\/+/', '', $name); $nlen = strlen($name); $time = $this->dosTime(time()); $fields = array( array('V', static::FILE_HEADER_SIGNATURE), array('v', static::ZIP_VERSION_64), // 压缩版本 array('v', 0b00001000), // General purpose bit flags - data descriptor flag set array('v', $zipMethod), // Compression method array('V', $time), // Timestamp (DOS Format) array('V', 0x00000000), // CRC32 of data (0 -> moved to data descriptor footer) array('V', 0xFFFFFFFF), // zip64时全0 array('V', 0xFFFFFFFF), // Length of original data (Forced to 0xFFFFFFFF for 64bit extension) array('v', $nlen), // Length of filename array('v', 32), // Extra data (32 bytes) ); $fields64 = array( array('v', 0x0001), // 64Bit Extension array('v', 28), // 28bytes of data follows array('P', 0x0000000000000000), // Length of original data (0 -> moved to data descriptor footer) array('P', 0x0000000000000000), // Length of compressed data (0 -> moved to data descriptor footer) array('P', 0x0000000000000000), // Relative Header Offset array('V', 0x00000000) // Disk number ); $header = $this->packFields($fields); $header64 = $this->packFields($fields64); $this->send($header . $name . $header64); return strlen($header) + $nlen + strlen($header64); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
protected function addFileHeader($name,$zipMethod){ $name = preg_replace('/^\\/+/', '', $name); $nlen = strlen($name); $time = $this->dosTime(time()); $fields = array( array('V', static::FILE_HEADER_SIGNATURE), array('v', static::ZIP_VERSION_64), // 压缩版本 array('v', 0b00001000), // General purpose bit flags - data descriptor flag set array('v', $zipMethod), // Compression method array('V', $time), // Timestamp (DOS Format) array('V', 0x00000000), // CRC32 of data (0 -> moved to data descriptor footer) array('V', 0xFFFFFFFF), // zip64时全0 array('V', 0xFFFFFFFF), // Length of original data (Forced to 0xFFFFFFFF for 64bit extension) array('v', $nlen), // Length of filename array('v', 32), // Extra data (32 bytes) ); $fields64 = array( array('v', 0x0001), // 64Bit Extension array('v', 28), // 28bytes of data follows array('P', 0x0000000000000000), // Length of original data (0 -> moved to data descriptor footer) array('P', 0x0000000000000000), // Length of compressed data (0 -> moved to data descriptor footer) array('P', 0x0000000000000000), // Relative Header Offset array('V', 0x00000000) // Disk number ); $header = $this->packFields($fields); $header64 = $this->packFields($fields64); $this->send($header . $name . $header64); return strlen($header) + $nlen + strlen($header64); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
public function cpuUsageLinux(){ $filePath = ('/proc/stat'); if ( !@is_readable($filePath)) { return 0; } $stat1 = file($filePath); sleep(1); $stat2 = file($filePath); $info1 = explode(' ', preg_replace('!cpu +!', '', $stat1[0])); $info2 = explode(' ', preg_replace('!cpu +!', '', $stat2[0])); $total1 = array_sum($info1); $total2 = array_sum($info2); $time1 = $total1 - $info1[3]; $time2 = $total2 - $info2[3]; return round(($time2 - $time1) / ($total2 - $total1), 3); }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
public function cpuUsageLinux(){ $filePath = ('/proc/stat'); if ( !@is_readable($filePath)) { return 0; } $stat1 = file($filePath); sleep(1); $stat2 = file($filePath); $info1 = explode(' ', preg_replace('!cpu +!', '', $stat1[0])); $info2 = explode(' ', preg_replace('!cpu +!', '', $stat2[0])); $total1 = array_sum($info1); $total2 = array_sum($info2); $time1 = $total1 - $info1[3]; $time2 = $total2 - $info2[3]; return round(($time2 - $time1) / ($total2 - $total1), 3); }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
function privReadEndCentralDirZip64(&$p_central_dir,$cdr_data){ $this->zip64 = true; //56 [zip64 end of central directory record] //Vzip64_cdr_eof/Pblow_offset/vversion/vversion_un/Vdisk/Vdisk_start/Pdisk_entries/Pentries/Psize/Poffset //20 [zip64 end of central directory locator] //Vzip64_cdr_loc_flag/Vdisk_num/Pcdr_offset/Vtotal_disk //22 [end of central directory record] //Vzip_cdr_eof/vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size $offset_back = 56+20+22; $old_pose = ftell($this->zip_fd); fseek($this->zip_fd,$old_pose-$cdr_data['comment_size']-$offset_back); $v_bin = fread($this->zip_fd, 56); $v_data = unpack('Vzip64_cdr_eof/Pblow_offset/vversion/vversion_un/Vdisk/Vdisk_start/Pdisk_entries/Pentries/Psize/Poffset', $v_bin); if($v_data['zip64_cdr_eof'] != 0x06064b50){ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Zip64 Central Dir Record error:".json_encode($v_data)); return PclZip::errorCode(); } $loc_bin = fread($this->zip_fd,20); $loc_data = unpack('Vzip64_cdr_loc_flag/Vdisk_num/Pcdr_offset/Vtotal_disk', $loc_bin); if($loc_data['zip64_cdr_loc_flag'] != 0x07064b50){ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Zip64 central directory locator error:".json_encode($loc_data)); return PclZip::errorCode(); } $p_central_dir['entries'] = $v_data['entries']; $p_central_dir['disk_entries'] = $v_data['disk_entries']; $p_central_dir['offset'] = $v_data['offset']; $p_central_dir['size'] = $v_data['size']; fseek($this->zip_fd,$old_pose); return 1; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
function privReadEndCentralDirZip64(&$p_central_dir,$cdr_data){ $this->zip64 = true; //56 [zip64 end of central directory record] //Vzip64_cdr_eof/Pblow_offset/vversion/vversion_un/Vdisk/Vdisk_start/Pdisk_entries/Pentries/Psize/Poffset //20 [zip64 end of central directory locator] //Vzip64_cdr_loc_flag/Vdisk_num/Pcdr_offset/Vtotal_disk //22 [end of central directory record] //Vzip_cdr_eof/vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size $offset_back = 56+20+22; $old_pose = ftell($this->zip_fd); fseek($this->zip_fd,$old_pose-$cdr_data['comment_size']-$offset_back); $v_bin = fread($this->zip_fd, 56); $v_data = unpack('Vzip64_cdr_eof/Pblow_offset/vversion/vversion_un/Vdisk/Vdisk_start/Pdisk_entries/Pentries/Psize/Poffset', $v_bin); if($v_data['zip64_cdr_eof'] != 0x06064b50){ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Zip64 Central Dir Record error:".json_encode($v_data)); return PclZip::errorCode(); } $loc_bin = fread($this->zip_fd,20); $loc_data = unpack('Vzip64_cdr_loc_flag/Vdisk_num/Pcdr_offset/Vtotal_disk', $loc_bin); if($loc_data['zip64_cdr_loc_flag'] != 0x07064b50){ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Zip64 central directory locator error:".json_encode($loc_data)); return PclZip::errorCode(); } $p_central_dir['entries'] = $v_data['entries']; $p_central_dir['disk_entries'] = $v_data['disk_entries']; $p_central_dir['offset'] = $v_data['offset']; $p_central_dir['size'] = $v_data['size']; fseek($this->zip_fd,$old_pose); return 1; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable
function privWriteCentralFileHeader(&$p_header) { $v_result=1; // TBC //for(reset($p_header); $key = key($p_header); next($p_header)) { //} // ----- Transform UNIX mtime to DOS format mdate/mtime $v_date = getdate($p_header['mtime']); $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; // ----- Packed data $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); // ----- Write the 42 bytes of the header in the zip file fputs($this->zip_fd, $v_binary_data, 46); // ----- Write the variable fields if (strlen($p_header['stored_filename']) != 0) { fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } if ($p_header['comment_len'] != 0) { fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); } // ----- Return return $v_result; }
0
PHP
CWE-77
Improper Neutralization of Special Elements used in a Command ('Command Injection')
The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/77.html
vulnerable
function privWriteCentralFileHeader(&$p_header) { $v_result=1; // TBC //for(reset($p_header); $key = key($p_header); next($p_header)) { //} // ----- Transform UNIX mtime to DOS format mdate/mtime $v_date = getdate($p_header['mtime']); $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; // ----- Packed data $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); // ----- Write the 42 bytes of the header in the zip file fputs($this->zip_fd, $v_binary_data, 46); // ----- Write the variable fields if (strlen($p_header['stored_filename']) != 0) { fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); } if ($p_header['extra_len'] != 0) { fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); } if ($p_header['comment_len'] != 0) { fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); } // ----- Return return $v_result; }
0
PHP
CWE-918
Server-Side Request Forgery (SSRF)
The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.
https://cwe.mitre.org/data/definitions/918.html
vulnerable