CVE-2014-125035 (PHP, published 2023-01-02T16:15Z)
Description: value: A vulnerability classified as problematic was found in Jobs-Plugin. Affected by this vulnerability is an unknown functionality. The manipulation leads to cross site scripting. The attack can be launched remotely. The identifier of the patch is b8a56718b1d42834c6ec51d9c489c5dc20471d7b. It is recommended to apply a patch to fix this issue. The identifier VDB-217189 was assigned to this vulnerability.
Severity: nan (CVSS v3 base score: 6.1)
Weakness: CWE-79 \u2014 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.
Repository: https://github.com/mrbobbybryant/Jobs-Plugin
Files changed:
hrm-jobs.php
jobs-cpt.php
jobs-fields.php
js/reorder.js
render-admin.php
Commit message: Whitespace/code cleanup

* add limits and no_count_rows to optimize queries
* add some missing output escaping
* change some spaces to tabs, some remain
* add coding standards spacing to JS as well
* cast post id as (int) to avoid XSS vector


Vulnerable code:
	wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
	add_submenu_page( 
		'edit.php?post_type=job', 
		'Reorder Jobs', 
		'Reorder Jobs', 
		'edit_pages', 
		'reorder_jobs', 
		'hrm_jobs_render_admin' 
		'order' => 'ASC'
		
	    	
					
					<td><a href="<?php echo esc_url($jobUrl) ?>">Learn More</a></td>
					
	    	</table>
			<p><?php _e('You have no Jobs to display.', 'hrm_jobs'); ?></p>
    
    
    
<?php 
    add_meta_box( 
      'hrm_meta', 
      __( 'Job Listing', 'hrm-jobs' ), 
      'hrm_meta_callback', 
      'job' 
          <div class="meta-td">  
            <input type="text" name="job-id" id="job-id" value="<?php if ( isset ( $hrm_stored_meta['job-id'] ) ) echo $hrm_stored_meta['job-id'][0]; ?>" />
            <input type="text" size="10" class="wpdt-row-content datepicker" name="date_listed" id="date_listed" value="<?php if ( isset ( $hrm_stored_meta['date_listed'] ) ) echo $hrm_stored_meta['date_listed'][0]; ?>" />
            <input type="text" size="10" class="wpdt-row-content datepicker" name="application_deadline" id="application_deadline" value="<?php if ( isset ( $hrm_stored_meta['application_deadline'] ) ) echo $hrm_stored_meta['application_deadline'][0]; ?>" />
              $settings = array( 
          <textarea name="minimum-requirements" class ="hrm-textarea" id="minimum-requirements"><?php if ( isset ( $hrm_stored_meta['minimum-requirements'] ) ) echo $hrm_stored_meta['minimum-requirements'][0]; ?></textarea>
          <textarea name="preferred-requirements" class ="hrm-textarea" id="preferred-requirements"><?php if ( isset ( $hrm_stored_meta['preferred-requirements'] ) ) echo $hrm_stored_meta['preferred-requirements'][0]; ?></textarea>
 
 
 
    
 
 
 
 
	$('div#jobs-admin-sort').each(function() {
		var sortList = $('ul#custom-type-list');
				$('#loading-animation').show(); // Show the animate loading gif while waiting
						order: sortList.sortable('toArray').toString() // Passes ID's of list items in	1,3,2 format
						$('div#message').remove();
						$('#loading-animation').hide(); // Hide the loading animation
						$('div#jobs-admin-sort h2:first').after('<div id="message" class="updated below-h2"><p>Jobs sort order has been saved</p></div>');
						$('#loading-animation').hide(); // Hide the loading animation
						$('div#jobs-admin-sort h2:first').after('<div id="message" class="error below-h2"><p>There was an error saving the sort order. Please try again later.</p></div>');
		'order' => 'ASC'
		<h2><?php _e('Sort Job Positions', 'hrm_jobs'); ?> <img src=" <?php echo admin_url(); ?>/images/loading.gif" id="loading-animation" /></h2>
	    	<p><?php _e('<strong>Note:</strong> this only affects the Jobs listed using the shortcode functions', 'hrm_jobs'); ?></p>
	    	</ul>
			<p><?php _e('You have no Jobs to sort.', 'hrm_jobs'); ?></p>
			$wpdb->update($wpdb->posts, array( 'menu_order' => $counter ), array( 'ID' => $item_id) );

Fixed code:
	wp_enqueue_style( 'jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
	add_submenu_page(
		'edit.php?post_type=job',
		'Reorder Jobs',
		'Reorder Jobs',
		'edit_pages',
		'reorder_jobs',
		'hrm_jobs_render_admin'
		'order' => 'ASC',
		'post_per_page' => 100, /* add a reasonable max # rows */
		'no_found_rows' => true, /* don't generate a count as part of query */



					<td><a href="<?php echo esc_url( $jobUrl ) ?>">Learn More</a></td>

			</table>
			<p><?php _e( 'You have no Jobs to display.', 'hrm_jobs' ); ?></p>



<?php
    add_meta_box(
      'hrm_meta',
      __( 'Job Listing', 'hrm-jobs' ),
      'hrm_meta_callback',
      'job'
          <div class="meta-td">
            <input type="text" name="job-id" id="job-id" value="<?php if ( isset ( $hrm_stored_meta['job-id'] ) ) echo esc_attr( $hrm_stored_meta['job-id'][0] ); ?>" />
            <input type="text" size="10" class="wpdt-row-content datepicker" name="date_listed" id="date_listed" value="<?php if ( isset ( $hrm_stored_meta['date_listed'] ) ) echo esc_attr( $hrm_stored_meta['date_listed'][0] ); ?>" />
            <input type="text" size="10" class="wpdt-row-content datepicker" name="application_deadline" id="application_deadline" value="<?php if ( isset ( $hrm_stored_meta['application_deadline'] ) ) echo esc_attr( $hrm_stored_meta['application_deadline'][0] ); ?>" />
              $settings = array(
          <textarea name="minimum-requirements" class ="hrm-textarea" id="minimum-requirements"><?php if ( isset ( $hrm_stored_meta['minimum-requirements'] ) ) echo esc_attr( $hrm_stored_meta['minimum-requirements'][0] ); ?></textarea>
          <textarea name="preferred-requirements" class ="hrm-textarea" id="preferred-requirements"><?php if ( isset ( $hrm_stored_meta['preferred-requirements'] ) ) echo esc_attr( $hrm_stored_meta['preferred-requirements'][0] ); ?></textarea>








	$( 'div#jobs-admin-sort' ).each(function() {
		var sortList = $( 'ul#custom-type-list' );
				$( '#loading-animation' ).show(); // Show the animate loading gif while waiting
						order: sortList.sortable( 'toArray' ).toString() // Passes ID's of list items in	1,3,2 format
						$( 'div#message' ).remove();
						$( '#loading-animation' ).hide(); // Hide the loading animation
						$( 'div#jobs-admin-sort h2:first' ).after( '<div id="message" class="updated below-h2"><p>Jobs sort order has been saved</p></div>' );
						$( '#loading-animation' ).hide(); // Hide the loading animation
						$( 'div#jobs-admin-sort h2:first' ).after( '<div id="message" class="error below-h2"><p>There was an error saving the sort order. Please try again later.</p></div>' );
		'order' => 'ASC',
		'post_per_page' => 100, /* add a reasonable max # rows */
		'no_found_rows' => true, /* don't generate a count as part of query */

		<h2><?php _e('Sort Job Positions', 'hrm_jobs'); ?> <img src="<?php echo esc_url( admin_url() . '/images/loading.gif' ); ?>" id="loading-animation" /></h2>
			<p><?php _e('<strong>Note:</strong> this only affects the Jobs listed using the shortcode functions', 'hrm_jobs'); ?></p>
			</ul>
			<p><?php _e( 'You have no Jobs to sort.', 'hrm_jobs' ); ?></p>
	//@todo add a nonce here to verify user intent
	//@todo add a capability check to ensure use caps

			$wpdb->update( $wpdb->posts, array( 'menu_order' => $counter ), array( 'ID' => (int) $item_id) );