Table of Contents
Reply content:
Home Backend Development PHP Tutorial Questions about security vulnerabilities in project programs scanned by security detection tools?

Questions about security vulnerabilities in project programs scanned by security detection tools?

Aug 04, 2016 am 09:20 AM
c c++ ci java php

The client company used evaluation software to evaluate our project and found several security vulnerabilities, including sql injection and xssattacks. I looked at the server-side program code where the security vulnerabilities occurred, and found that they were basically page-oriented services. A vulnerability occurs where the end sends get or post data. The backend uses the input class that comes with the CI framework to receive data, which can filter the information entered by the user, and CI's csrf configuration item has also been turned on

Testing tools:
Questions about security vulnerabilities in project programs scanned by security detection tools?

Vulnerability overview:
Questions about security vulnerabilities in project programs scanned by security detection tools?

Questions about security vulnerabilities in project programs scanned by security detection tools?

There are a few headaches:

  1. The original code for receiving get and postdata was written like this $this->input->get('section_id). This is how other places in the project receive it. It stands to reason that it has already been done. With filtering and security precautions in place, why do such loopholes still appear?

  2. If there is a problem with the server receiving get and postdata, then all places in the project that use this method should have loopholes. Why do such loopholes appear in only a few places?

  3. Customers only see test data, how should I explain and communicate to them?

Please give me some advice~

Reply content:

The client company used evaluation software to evaluate our project and found several security vulnerabilities, including sql injection and xssattacks. I looked at the server-side program code where the security vulnerabilities occurred, and found that they were basically page-oriented services. A vulnerability occurs where the end sends get or post data. The backend receives data using the input class that comes with the CI framework, which can filter the information entered by the user, and CI's csrf configuration item has also been turned on

Testing tools:
Questions about security vulnerabilities in project programs scanned by security detection tools?

Vulnerability overview:
Questions about security vulnerabilities in project programs scanned by security detection tools?

Questions about security vulnerabilities in project programs scanned by security detection tools?

There are a few headaches:

  1. The original code for receiving get and postdata was written like this $this->input->get('section_id). This is how other places in the project receive it. It stands to reason that it has already been done. With filtering and security precautions in place, why do such loopholes still appear?

  2. If there is a problem with the server receiving get and postdata, then all places in the project that use this method should have loopholes. Why do such loopholes appear in only a few places?

  3. Customers only see test data, how should I explain and communicate to them?

Please give me some advice~

1 The judgment of this kind of test software is not necessarily accurate. Generally, it only judges whether the character lengths of the results returned by connecting different statements are the same to judge whether there is injection.
2 Don’t put too much faith in any framework or not. You have to do the security aspect yourself. Global filtering
3 The xss he detects here are not stored, and the risk is not that high. This kind of report is most often used as a springboard
4 What the client wants is the comfort that there are no loopholes in the report.
5 If you just want him to not be able to scan the vulnerability. Write a log file at the program entry and record all requests and parameters to analyze how the scanning software determines whether there is a vulnerability.
6 Modify the vulnerability in the report of the scanning software. From personal experience, this should be that the parameters you pass do not have intval
7 Turn off mysql error prompts to prevent error injection
Prevention
1 Add global sql keyword filtering to the program
2 Enable PHP single quotes Escape (modify php.ini magic_quotes_gpc).
3 Apache/nginx/iis enables service logs, mysql slow query logs, and program entry record request logs
4 The server installs web application security software such as SafeDog
5 Use UTF-8 for database links to prevent gbk double-byte injection
6 Enhancements The complexity of the mysql password, prohibiting mysql external links, and changing the default port number
7 Reduce the rights of the program mysql account and only give ordinary addition, deletion, checking, and modification permissions. It is forbidden to give file operation permission

XSS cross-site attack solution
1 Use htmlspecialchars to escape where text is written
2 Use SSL to prohibit loading and referencing external js
3 Set httponly to prohibit obtaining cookies
4 The above is to ensure that there is no injection (if there is injection , you can use hexadecimal to bypass htmlspecialchars to achieve the effect of xss attack)
5 It is best to use 2 sets of programs with different routing rules for the backend and the frontend. Key backend operations (backup database) should set a secondary password and add request parameters. complexity to prevent CSRF

PHP Security
1 Add suffix filtering where files are uploaded, and do not make "logical negation" judgments when filtering.
2 It is forbidden to upload files with the suffix php and htaccess. Do not use the data submitted by the client to obtain the file name suffix. You should use the program to add the suffix and random file name
3 Unified routing to limit unauthorized access. The webroot directory can only have one index.php (entry file) for external defense. All other directories are prohibited from external defense. All resource (uploaded) files are added with the anti-leeching function in nginx
4. PHP decentralization processing, web directory Restrict the creation of folders and text (except for folders required by the program, there is usually a cache directory that requires writable permissions)
5 Filter IIS/nginx file parsing vulnerability exploits
6 Use the mobile phone verification code to retrieve the password. Additional servers should be used for mailbox retrieval. (Prevent the real IP from being obtained through the password retrieval function). The last link to reset the password sent to the user's mailbox needs to have complex encryption parameters
7 The user login system should have a single login function. If the user has logged in, other people should be prompted to log in again.
8

1 Security knowledge
1 Web applications use site-library separation and change the default path of the environment web directory
2 When using an integrated environment, you should delete the php probe, phpmyadmin, and phpinfo after the installation is complete (the probe can view your web path, phpmyadmin can be violently cracked)
2 The user password is best to use the md5 value after password salting
3 Add a verification code where the user logs in, how to add a limit on the number of errors to prevent brute force cracking
4 Use CDN acceleration to hide the real IP
5 When the user logs in, do not pass the plaintext account and password to prevent C-side sniffing and obtain the user and administrator plaintext account and password through ARP spoofing
6 Disable the php system command line number exec, system, etc.
7 Install security software such as Security Dog on the server
8 The web directory is prohibited from storing .rar and zip files

My understanding of RSAS and BVS means that if you don’t fix this problem, it will always be scanned. The most fundamental way is to solve these problems and discover the vulnerabilities yourself. The customer is worried that it may not be someone else attacking him, but insiders taking advantage of the vulnerabilities. When creating backdoor programs, some customers leave very little room for explanation.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1263
29
C# Tutorial
1236
24
The Future of C  : Adaptations and Innovations The Future of C : Adaptations and Innovations Apr 27, 2025 am 12:25 AM

The future of C will focus on parallel computing, security, modularization and AI/machine learning: 1) Parallel computing will be enhanced through features such as coroutines; 2) Security will be improved through stricter type checking and memory management mechanisms; 3) Modulation will simplify code organization and compilation; 4) AI and machine learning will prompt C to adapt to new needs, such as numerical computing and GPU programming support.

How to use the chrono library in C? How to use the chrono library in C? Apr 28, 2025 pm 10:18 PM

Using the chrono library in C can allow you to control time and time intervals more accurately. Let's explore the charm of this library. C's chrono library is part of the standard library, which provides a modern way to deal with time and time intervals. For programmers who have suffered from time.h and ctime, chrono is undoubtedly a boon. It not only improves the readability and maintainability of the code, but also provides higher accuracy and flexibility. Let's start with the basics. The chrono library mainly includes the following key components: std::chrono::system_clock: represents the system clock, used to obtain the current time. std::chron

How to handle high DPI display in C? How to handle high DPI display in C? Apr 28, 2025 pm 09:57 PM

Handling high DPI display in C can be achieved through the following steps: 1) Understand DPI and scaling, use the operating system API to obtain DPI information and adjust the graphics output; 2) Handle cross-platform compatibility, use cross-platform graphics libraries such as SDL or Qt; 3) Perform performance optimization, improve performance through cache, hardware acceleration, and dynamic adjustment of the details level; 4) Solve common problems, such as blurred text and interface elements are too small, and solve by correctly applying DPI scaling.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

How to understand DMA operations in C? How to understand DMA operations in C? Apr 28, 2025 pm 10:09 PM

DMA in C refers to DirectMemoryAccess, a direct memory access technology, allowing hardware devices to directly transmit data to memory without CPU intervention. 1) DMA operation is highly dependent on hardware devices and drivers, and the implementation method varies from system to system. 2) Direct access to memory may bring security risks, and the correctness and security of the code must be ensured. 3) DMA can improve performance, but improper use may lead to degradation of system performance. Through practice and learning, we can master the skills of using DMA and maximize its effectiveness in scenarios such as high-speed data transmission and real-time signal processing.

H5: Key Improvements in HTML5 H5: Key Improvements in HTML5 Apr 28, 2025 am 12:26 AM

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

Explain how to use sessions for user authentication. Explain how to use sessions for user authentication. Apr 26, 2025 am 12:04 AM

The session realizes user authentication through the server-side state management mechanism. 1) Session creation and generation of unique IDs, 2) IDs are passed through cookies, 3) Server stores and accesses session data through IDs, 4) User authentication and status management are realized, improving application security and user experience.

Discuss situations where writing platform-specific code in Java might be necessary. Discuss situations where writing platform-specific code in Java might be necessary. Apr 25, 2025 am 12:22 AM

Reasons for writing platform-specific code in Java include access to specific operating system features, interacting with specific hardware, and optimizing performance. 1) Use JNA or JNI to access the Windows registry; 2) Interact with Linux-specific hardware drivers through JNI; 3) Use Metal to optimize gaming performance on macOS through JNI. Nevertheless, writing platform-specific code can affect the portability of the code, increase complexity, and potentially pose performance overhead and security risks.

See all articles