Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements from AWS Code Guru | Machine Learning for code review #1465

Closed
airvzxf opened this issue Dec 25, 2022 · 4 comments
Closed

Improvements from AWS Code Guru | Machine Learning for code review #1465

airvzxf opened this issue Dec 25, 2022 · 4 comments
Labels

Comments

@airvzxf
Copy link
Contributor

airvzxf commented Dec 25, 2022

Hello, pwndbg members: @disconnect3d, @zachriggle, @anthraxx and @stnevans. Hi, the best contributor @gsingh93.

I am studying for the AWS Cloud Practitioner certification. Furthermore, I was reviewing the Code Guru tool, which uses Machine Learning for code review. I thought I'd scan your project since I contributed a few years ago and, surprise, I found 120 recommendations, some of them security related.

I have a dilemma on how to contribute, adding issues to this project. Likewise, I am looking for your guidance and approval to do one of the follow scenarios or if you suggest a better one which work for you.

For example, this recommendation from AWS Code Guru, make total sense:

pwndbg/disasm/arm.py line: 51 

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more, reference from Python3 docs.

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

I recommend reviewing the screenshots to see all the scope of the recommendations.


Scenarios or ideas about add these issues to the project:

  1. The first scenario which came to my mind is creating one issue and copy all the issues and paste. It is automatically discarded because it will be nasty and out of tracking control.

  2. The second option is created issue by issue regarding from every recommendation of the Code Guru. It is the best options in my experience, but I will create 120 new issues and I don't know if you consider it as SPAM.

    2.1 If the second option is accepted, I want to use the tag “clean code”, but maybe you would like to create a new one for example “AWS Code Guru”.

  3. Provided to all of you the AWS code review recommendations. You choose specific recommendations, then you or I can create the issues in the project.

  4. No more ideas… =(.

@airvzxf airvzxf added the feature For new features label Dec 25, 2022
@gsingh93
Copy link
Member

Hi, thanks for this. I think option 3 makes the most sense right now. If there's also a list of categories and we can filter some out, that would be great. For example, I'd want to know about other instances of this get() usage so I could double check them and remove the None if that is indeed the right fix. But things like global variables and cyclomatic complexity are issues we probably couldn't spend much time on at the moment, given the other priorities we're working on (would probably be worth doing another scan in a year and then maybe digging into these).

If not, that's fine, if there's some .text,.csv, or .json report file we could get that will be easy enough to filter ourselves.

@airvzxf
Copy link
Contributor Author

airvzxf commented Dec 25, 2022

Ok, it would have been wonderful to create this issues in Hacktoberfest because they are small and clear.

It is not possible to export, but I will put here:

Recomendaciones (120)

pwndbg/disasm/arm.py Línea: 51

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

Origen
CodeGuru


pwndbg/enhance.py Línea: 44

The cyclomatic complexity of this function is 22. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 67-72 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/gdblib/stack.py Línea: 119

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/hexdump.py Línea: 42

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/search.py Línea: 13

The cyclomatic complexity of this function is 23. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 40-74 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 1974

The cyclomatic complexity of this function is 29. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/gdblib/kernel/__init__.py Línea: 59

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Similar issue at line number 223.

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/commands/telescope.py Línea: 69

The cyclomatic complexity of this function is 16. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 111-195 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/ghidra.py Línea: 11

The cyclomatic complexity of this function is 17. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 67-77 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/gdblib/file.py Línea: 30

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/commands/nearpc.py Línea: 81

The cyclomatic complexity of this function is 29. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 155-219 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/commands/search.py Línea: 133

The cyclomatic complexity of this function is 22. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 185-226 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/lib/memory.py Línea: 97

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/commands/heap.py Línea: 805

This function contains 205 lines of code, not including blank lines or lines with only comments, Python punctuation characters, identifiers, or literals. By comparison, 99% of the functions in the CodeGuru reference dataset contain fewer lines of code. Large functions might be difficult to read and have logic that is hard to understand and test. We recommend that you simplify this function or break it into multiple functions.

Large functions might be difficult to read, and have logic that is hard to understand and test. Large functions should be simplified or broken into multiple smaller functions. The size of a function is computed as the number of lines of code, not including blank lines or lines with only comments, Python punctuation characters, identifiers, or literals.

Origen
CodeGuru


pwndbg/ida.py Línea: 186

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/commands/probeleak.py Línea: 83

The cyclomatic complexity of this function is 16. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/commands/__init__.py Línea: 174

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/gdblib/abi.py Línea: 12

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Similar issue at line number 13.

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/gdblib/vmmap.py Línea: 316

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/commands/heap.py Línea: 727

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Similar issue at line number 745.

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.

Origen
CodeGuru


pwndbg/commands/probeleak.py Línea: 156

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.

Origen
CodeGuru


pwndbg/arguments.py Línea: 78

The cyclomatic complexity of this function is 19. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 1432

The cyclomatic complexity of this function is 33. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/commands/__init__.py Línea: 35

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/hexdump.py Línea: 90

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/profiling.py Línea: 9

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/commands/nearpc.py Línea: 193

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/constants/__init__.py Línea: 18

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

Origen
CodeGuru


pwndbg/heap/__init__.py Línea: 77

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 1270

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/gdblib/elf.py Línea: 228

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/ida.py Línea: 53

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Similar issue at line number 324.

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/gdblib/typeinfo.py Línea: 68

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/commands/context.py Línea: 834

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/ghidra.py Línea: 23

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Similar issue at line numbers 28 and 39.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/commands/nearpc.py Línea: 207

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/commands/ida.py Línea: 26

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 1823

The cyclomatic complexity of this function is 38. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/commands/__init__.py Línea: 67

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Similar issue at line number 72.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/disasm/__init__.py Línea: 74

It appears that you do not need the position returned by the find() function. Consider using the operators in and not in to check for simple membership, or more specific operations startswith() and endswith() to check for prefix and suffix relationships with the string.

If there are multiple APIs available to perform similar action, choose the most specialised and efficient one. This helps make your code more readable and easier to understand.

Origen
CodeGuru


pwndbg/gdblib/memory.py Línea: 112

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/gdblib/dt.py Línea: 95

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/commands/xinfo.py Línea: 56

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/gdblib/vmmap.py Línea: 226

The cyclomatic complexity of this function is 23. By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code blocks on lines 233-249, lines 251-296, lines 308-326 into separate functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/enhance.py Línea: 151

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/commands/context.py Línea: 388

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more

Similar issue at line number 411.

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

Origen
CodeGuru


pwndbg/commands/xinfo.py Línea: 95

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/gdblib/symbol.py Línea: 76

The cyclomatic complexity of this function is 18. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/radare2.py Línea: 25

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/ida.py Línea: 178

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/emu/emulator.py Línea: 282

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 546

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/gdblib/strings.py Línea: 22

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/commands/kconfig.py Línea: 19

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/commands/context.py Línea: 861

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/gdblib/tls.py Línea: 22

The cyclomatic complexity of this function is 18. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. We recommend that you simplify this function or break it into multiple functions.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/commands/kchecksec.py Línea: 110

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/commands/start.py Línea: 21

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/hexdump.py Línea: 72

This function contains 61 lines of code, not including blank lines or lines with only comments, Python punctuation characters, identifiers, or literals. By comparison, 99% of the functions in the CodeGuru reference dataset contain fewer lines of code. Large functions might be difficult to read and have logic that is hard to understand and test. We recommend that you simplify this function or break it into multiple functions.

Large functions might be difficult to read, and have logic that is hard to understand and test. Large functions should be simplified or broken into multiple smaller functions. The size of a function is computed as the number of lines of code, not including blank lines or lines with only comments, Python punctuation characters, identifiers, or literals.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 1597

The cyclomatic complexity of this function is 4By comparison, 99% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 1601-1630 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/commands/nearpc.py Línea: 200

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.

Origen
CodeGuru


pwndbg/heap/structs.py Línea: 137

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.

Origen
CodeGuru


pwndbg/gdblib/kernel/__init__.py Línea: 40

Using Exception and BaseException can make your code prone to errors and difficult to maintain. Instead, we recommend using one of the Built-in Exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.

Origen
CodeGuru


pwndbg/commands/vmmap.py Línea: 130

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

Origen
CodeGuru


pwndbg/gdblib/symbol.py Línea: 244

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/disasm/x86.py Línea: 137

It appears you are using the get() method to retrieve the value for a key from a dictionary. If the key is not present, then get() returns the value that is passed in its optional second parameter. If the key is not present, then None is the default return value. Therefore, there is no need to explicitly specify None in the second parameter.

Learn more

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.

Origen
CodeGuru


pwndbg/gdblib/qemu.py Línea: 61

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/commands/context.py Línea: 604

It appears that you do not need the position returned by the find() function. Consider using the operators in and not in to check for simple membership, or more specific operations startswith() and endswith() to check for prefix and suffix relationships with the string.

If there are multiple APIs available to perform similar action, choose the most specialised and efficient one. This helps make your code more readable and easier to understand.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 522

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/commands/context.py Línea: 384

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Similar issue at line number 409.

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/gdblib/prompt.py Línea: 61

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Similar issue at line number 76.

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/commands/heap.py Línea: 630

This function contains 68 lines of code, not including blank lines or lines with only comments, Python punctuation characters, identifiers, or literals. By comparison, 99% of the functions in the CodeGuru reference dataset contain fewer lines of code. Large functions might be difficult to read and have logic that is hard to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 648-670 into a separate function.

Large functions might be difficult to read, and have logic that is hard to understand and test. Large functions should be simplified or broken into multiple smaller functions. The size of a function is computed as the number of lines of code, not including blank lines or lines with only comments, Python punctuation characters, identifiers, or literals.

Origen
CodeGuru


pwndbg/commands/comments.py Línea: 55

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/color/syntax_highlight.py Línea: 30

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/gdblib/vmmap.py Línea: 487

Using break, continue and return statements in a finally block will result in masking of unhandled exceptions from the try, else, and except blocks. If the finally block includes a return statement, the returned value will be the one from the return statement of the finally block, not the try block.

Learn more

Learn more

Swallowing exceptions, without re-throwing or logging them, is a bad practice. The stack trace, and other useful information for debugging, is lost.

Origen
CodeGuru


pwndbg/gdblib/symbol.py Línea: 71

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/lib/regs.py Línea: 66

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/gdblib/dt.py Línea: 74

The cyclomatic complexity of this function is 16. By comparison, 98% of the functions in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the function has a high number of decisions, and it can make the logic difficult to understand and test.

We recommend that you simplify this function or break it into multiple functions. For example, consider extracting the code block on lines 113-148 into a separate function.

High cyclomatic complexity indicates the function has a high number of decisions, and it can make the logic difficult to understand and test. Functions with high cyclomatic complexity should be simplified or broken into multiple simpler functions.

Origen
CodeGuru


pwndbg/lib/gcc.py Línea: 20

Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. Most bugs involving global variables arise from one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Learn more

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.

Origen
CodeGuru


pwndbg/heap/ptmalloc.py Línea: 534

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.

Origen
CodeGuru


pwndbg/commands/reload.py Línea: 25

It appears that you are generically passing an Exception object without performing any other operation on it. This may hide error conditions that can otherwise be quickly detected and addressed. We recommend that you catch a more specific exception. If the code must broadly catch all exceptions, consider logging the stack trace using the logging.exception() API. For example,

try:
    x = 1 / 0
except ZeroDivisionError as e:
    logging.exception('ZeroDivisionError: %s', e)

Do not pass generic exception.

Origen
CodeGuru


pwndbg/gdblib/regs.py Línea: 44

This class contains 15 clusters of instance methods that do not have any accessed class members in common. For example, a cluster might have 2 methods that access only the class fields x and y, and another cluster might have 2 other methods that access only the class fields a and b. By comparison, 99% of the classes in the CodeGuru reference dataset contain fewer clusters. A high number of these clusters indicates low class cohesion. Classes with low class cohesion contain unrelated operations which make them difficult to understand and less likely to be used. We recommend that you simplify this class or break it into multiple cohesive classes.

Classes with low class cohesion contain unrelated operations which make them difficult to understand and less likely to be used. The class cohesion is computed as the number of clusters of instance methods that do not have any accessed class members in common. For example, a cluster might have two methods that access only the class fields x and y, and another cluster might have two other methods that access only the class fields a and b. A high number of these clusters indicates low class cohesion.

Origen
CodeGuru


pwndbg/commands/ignore.py Línea: 43

Security

Problem: This line of code lacks validation when processing input data through the following parameter: 'count' (index: 1 | type: Unknown). The parameter is exposed to external callers, because its enclosing class and method are publicly accessible. This means that upstream validation, if it exists, can be bypassed. Other validated parameters: 'bpnum'. Malicious, malformed, or unbounded inputs can cause unexpected runtime behavior or crashes, and can slow performance.

Fix: Add checks to ensure the validity of the parameter's value, such as testing it for nullness, emptiness, or equality. Or to prevent direct calls to it, reduce the method's visibility using single or double underscore.

Learn more about potential threats and guidance from the Common Weakness Enumeration website and the OWASP Cheat Sheet series.

Public method parameters should be validated for nullness, unexpected values, and malicious values. Invalid or malicious input can compromise the system's safety.

Origen
CodeGuru


pwndbg/commands/ida.py Línea: 108

Security

The naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. The recommended way to create an aware datetime object representing a specific timestamp in UTC is bypassing tzinfo as an argument to the method.

Learn more

Naive datetime objects are treated by many datetime methods as local times and might cause time zone related issues.

Origen
CodeGuru


ida_script.py Línea: 20

Security

The naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. The recommended way to create an aware datetime object representing a specific timestamp in UTC is bypassing tzinfo as an argument to the method.

Learn more

Naive datetime objects are treated by many datetime methods as local times and might cause time zone related issues.

Origen
CodeGuru


pwndbg/gdblib/symbol.py Línea: 141

Security

Problem This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix Consider closing the resource returned by the following method call: open. The resource is allocated by call builtins.open. Currently, there are execution paths that do not contain closure statements, for example, when builtins.hex() throws an exception. To prevent this resource leak, close the object returned by open() in a try-finally block or declare it using a with statement.

More info View details about the with statement in the Python developer's guide (external link).

Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.

Origen
CodeGuru


pwndbg/commands/ida.py Línea: 122

Security

Problem This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix Consider closing the resource created by the following constructor: BZ2File. The resource is allocated by call bz2.BZ2File. Execution paths that do not contain closure statements were detected. To prevent this resource leak, close the object returned by BZ2File() in a try-finally block or declare it using a with statement.

More info View details about the with statement in the Python developer's guide (external link).

Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.

Origen
CodeGuru


pwndbg/commands/rop.py Línea: 33

Security

Problem: This line of code lacks validation when processing input data through the following parameter: 'argument' (index: 1 | type: Unknown). The parameter is exposed to external callers, because its enclosing class and method are publicly accessible. This means that upstream validation, if it exists, can be bypassed. Other validated parameters: 'grep'. Malicious, malformed, or unbounded inputs can cause unexpected runtime behavior or crashes, and can slow performance.

Fix: Add checks to ensure the validity of the parameter's value, such as testing it for nullness, emptiness, or equality. Or to prevent direct calls to it, reduce the method's visibility using single or double underscore.

Learn more about potential threats and guidance from the Common Weakness Enumeration website and the OWASP Cheat Sheet series.

Public method parameters should be validated for nullness, unexpected values, and malicious values. Invalid or malicious input can compromise the system's safety.

Origen
CodeGuru


ida_script.py Línea: 167

Security

If you do not have absolute control over the contents of the string passed to the eval() function, they might be maliciously used to execute an arbitrary function such as __import__('os').system("rm -rf $HOME"). If the string is expected to only contain literals, consider using the ast.literal_eval() method to safely evaluate strings containing Python values from untrusted sources.

Learn more

Running scripts generated from unsanitized inputs (for example, evaluating expressions that include user-provided strings) can lead to malicious behavior and inadvertently running code remotely.

Origen
CodeGuru


pwndbg/wrappers/__init__.py Líneas: 3-4

Security

Consider possible security implications associated with STDOUT module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/lib/version.py Líneas: 2-4

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/cymbol.py Línea: 21

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/heap/ptmalloc.py Línea: 2163

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/gdblib/file.py Línea: 62

Security

Use of insecure and deprecated function (mktemp). https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b306-mktemp-q

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/wrappers/checksec.py Líneas: 1-2

Security

Consider possible security implications associated with CalledProcessError module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


ida_script.py Línea: 167

Security

Use of possibly insecure function - consider using safer ast.literal_eval. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_calls.html#b307-eval

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/ida.py Línea: 290

Security

Use of possibly insecure function - consider using safer ast.literal_eval. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_calls.html#b307-eval

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/version.py Línea: 11

Security

Consider possible security implications associated with check_output module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/comments.py Línea: 55

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6

pwndbg/gdblib/memory.py Línea: 112

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/shell.py Línea: 70

Security

Starting a process without a shell. https://bandit.readthedocs.io/en/latest/plugins/b606\_start\_process\_with\_no_shell.html

Constructing operating system or shell commands with unsanitized user input can lead to inadvertently running malicious code.

Origen
Bandit 1.6


pwndbg/wrappers/__init__.py Línea: 2

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/gdblib/qemu.py Línea: 94

Security

Try, Except, Continue detected. https://bandit.readthedocs.io/en/latest/plugins/b112\_try\_except_continue.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/attachp.py Línea: 4

Security

Consider possible security implications associated with CalledProcessError module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/ropper.py Línea: 2

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/attachp.py Líneas: 5-6

Security

Consider possible security implications associated with check_output module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/heap/ptmalloc.py Línea: 1270

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/reload.py Línea: 25

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/rop.py Línea: 3

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/gdblib/vmmap.py Línea: 316

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/gdblib/symbol.py Línea: 244

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/radare2.py Líneas: 2-3

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/nearpc.py Línea: 207

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/ida.py Línea: 26

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/__init__.py Línea: 174

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


pwndbg/commands/version.py Línea: 10

Security

Consider possible security implications associated with check_call module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/search.py Línea: 199

Security

Try, Except, Continue detected. https://bandit.readthedocs.io/en/latest/plugins/b112\_try\_except_continue.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

Origen
Bandit 1.6


ida_script.py Línea: 8

Security

Using escape to parse untrusted XML data is known to be vulnerable to XML attacks. Replace escape with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b406-import-xml-sax

APIs that are not recommended were found. This could indicate a deeper problem in the code.

Origen
Bandit 1.6


pwndbg/commands/ida.py Línea: 118

Security

Problem This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix Consider closing the resource returned by the following method call: open. The resource is allocated by call builtins.open. Execution paths that do not contain closure statements were detected. To prevent this resource leak, close the object returned by open() in a try-finally block or declare it using a with statement.

More info View details about the with statement in the Python developer's guide (external link).

Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.

Origen
CodeGuru


pwndbg/gdblib/file.py Línea: 62

Security

Creating temporary files with tempfile.mktemp() has known security vulnerabilities. We recommend using the tempfile.NamedTemporaryFile() API and passing it the delete=False parameter to create temporary files. For more information, see Generate temporary files and directories and CWE-377.

Insecure ways of creating temporary files and directories can lead to race conditions (which can be exploited for denial of service attacks) and other security vulnerabilities such as privilege escalation.

Origen
CodeGuru


@gsingh93
Copy link
Member

gsingh93 commented Jan 2, 2023

Here's a first pass at filtering this list down to the ones we may care about.


pwndbg/disasm/arm.py Línea: 51

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.


pwndbg/lib/memory.py Línea: 97

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0


pwndbg/ida.py Línea: 186

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/commands/__init__.py Línea: 174

Do not pass generic exception.


pwndbg/gdblib/vmmap.py Línea: 316

Do not pass generic exception.


pwndbg/commands/heap.py Línea: 727

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Similar issue at line number 745.

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.


pwndbg/commands/probeleak.py Línea: 156

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.


pwndbg/commands/__init__.py Línea: 35

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0


pwndbg/hexdump.py Línea: 90

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0


pwndbg/profiling.py Línea: 9

pwndbg/commands/nearpc.py Línea: 193

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0


pwndbg/constants/__init__.py Línea: 18

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.


pwndbg/heap/__init__.py Línea: 77

pwndbg/heap/ptmalloc.py Línea: 1270

Do not pass generic exception.


pwndbg/gdblib/typeinfo.py Línea: 68

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/ghidra.py Línea: 23

Similar issue at line numbers 28 and 39.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/commands/nearpc.py Línea: 207

Do not pass generic exception.


pwndbg/commands/ida.py Línea: 26

Do not pass generic exception.


pwndbg/commands/__init__.py Línea: 67

Similar issue at line number 72.

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/disasm/__init__.py Línea: 74

It appears that you do not need the position returned by the find() function. Consider using the operators in and not in to check for simple membership, or more specific operations startswith() and endswith() to check for prefix and suffix relationships with the string.

If there are multiple APIs available to perform similar action, choose the most specialised and efficient one. This helps make your code more readable and easier to understand.


pwndbg/gdblib/memory.py Línea: 112

Do not pass generic exception.


pwndbg/gdblib/dt.py Línea: 95

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/commands/xinfo.py Línea: 56

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0


pwndbg/enhance.py Línea: 151

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0


pwndbg/commands/context.py Línea: 388

Similar issue at line number 411.

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.


pwndbg/commands/xinfo.py Línea: 95

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

pwndbg/radare2.py Línea: 25

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/ida.py Línea: 178

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/emu/emulator.py Línea: 282

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.


pwndbg/heap/ptmalloc.py Línea: 546

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.


pwndbg/commands/kconfig.py Línea: 19

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

pwndbg/commands/context.py Línea: 861

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.


pwndbg/commands/kchecksec.py Línea: 110

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

pwndbg/commands/nearpc.py Línea: 200

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.


pwndbg/heap/structs.py Línea: 137

It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always result in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.

Learn more

Concatenating immutable sequences results in a new object. This causes a quadratic runtime cost when done inside loop.


pwndbg/gdblib/kernel/__init__.py Línea: 40

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain. We recommend using built-in exceptions or creating a custom exception class that is derived from Exception or one of its subclasses.


pwndbg/commands/vmmap.py Línea: 130

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.


pwndbg/gdblib/symbol.py Línea: 244

Do not pass generic exception.


pwndbg/disasm/x86.py Línea: 137

Using the get method from the dict class without default values can cause undesirable results. Default parameter values can help prevent a KeyError exception.


pwndbg/commands/context.py Línea: 604

It appears that you do not need the position returned by the find() function. Consider using the operators in and not in to check for simple membership, or more specific operations startswith() and endswith() to check for prefix and suffix relationships with the string.

If there are multiple APIs available to perform similar action, choose the most specialised and efficient one. This helps make your code more readable and easier to understand.


pwndbg/heap/ptmalloc.py Línea: 522

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.


pwndbg/commands/context.py Línea: 384

To check if a container or sequence (string, list, tuple) is empty, use if not val. Do not compare its length using if len(val) == 0 or if len(val) > 0

Learn more

Similar issue at line number 409.

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.


pwndbg/commands/comments.py Línea: 55

Do not pass generic exception.


pwndbg/gdblib/vmmap.py Línea: 487

Using break, continue and return statements in a finally block will result in masking of unhandled exceptions from the try, else, and except blocks. If the finally block includes a return statement, the returned value will be the one from the return statement of the finally block, not the try block.

Learn more

Learn more

Swallowing exceptions, without re-throwing or logging them, is a bad practice. The stack trace, and other useful information for debugging, is lost.


pwndbg/lib/regs.py Línea: 66

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.


pwndbg/heap/ptmalloc.py Línea: 534

To create a list, try to use list comprehension instead of a loop. List comprehension is the preferred way to make a list using Python, and it's simpler and easier to understand than using a loop.

Learn more

Following PEP8 makes your code clear and more readable. Often there are several ways to perform a similar action in Python. PEP 8 provides recommendations to remove that ambiguity and preserve consistency.


pwndbg/commands/reload.py Línea: 25

Do not pass generic exception.


pwndbg/commands/ignore.py Línea: 43

Security

Problem: This line of code lacks validation when processing input data through the following parameter: 'count' (index: 1 | type: Unknown). The parameter is exposed to external callers, because its enclosing class and method are publicly accessible. This means that upstream validation, if it exists, can be bypassed. Other validated parameters: 'bpnum'. Malicious, malformed, or unbounded inputs can cause unexpected runtime behavior or crashes, and can slow performance.

Fix: Add checks to ensure the validity of the parameter's value, such as testing it for nullness, emptiness, or equality. Or to prevent direct calls to it, reduce the method's visibility using single or double underscore.

Learn more about potential threats and guidance from the Common Weakness Enumeration website and the OWASP Cheat Sheet series.

Public method parameters should be validated for nullness, unexpected values, and malicious values. Invalid or malicious input can compromise the system's safety.


pwndbg/commands/ida.py Línea: 108

Security

The naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. The recommended way to create an aware datetime object representing a specific timestamp in UTC is bypassing tzinfo as an argument to the method.

Learn more

Naive datetime objects are treated by many datetime methods as local times and might cause time zone related issues.


ida_script.py Línea: 20

Security

The naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. The recommended way to create an aware datetime object representing a specific timestamp in UTC is bypassing tzinfo as an argument to the method.

Learn more

Naive datetime objects are treated by many datetime methods as local times and might cause time zone related issues.


pwndbg/gdblib/symbol.py Línea: 141

Security

Problem This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix Consider closing the resource returned by the following method call: open. The resource is allocated by call builtins.open. Currently, there are execution paths that do not contain closure statements, for example, when builtins.hex() throws an exception. To prevent this resource leak, close the object returned by open() in a try-finally block or declare it using a with statement.

More info View details about the with statement in the Python developer's guide (external link).

Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.


pwndbg/commands/ida.py Línea: 122

Security

Problem This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix Consider closing the resource created by the following constructor: BZ2File. The resource is allocated by call bz2.BZ2File. Execution paths that do not contain closure statements were detected. To prevent this resource leak, close the object returned by BZ2File() in a try-finally block or declare it using a with statement.

More info View details about the with statement in the Python developer's guide (external link).

Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.


pwndbg/commands/rop.py Línea: 33

Security

Problem: This line of code lacks validation when processing input data through the following parameter: 'argument' (index: 1 | type: Unknown). The parameter is exposed to external callers, because its enclosing class and method are publicly accessible. This means that upstream validation, if it exists, can be bypassed. Other validated parameters: 'grep'. Malicious, malformed, or unbounded inputs can cause unexpected runtime behavior or crashes, and can slow performance.

Fix: Add checks to ensure the validity of the parameter's value, such as testing it for nullness, emptiness, or equality. Or to prevent direct calls to it, reduce the method's visibility using single or double underscore.

Learn more about potential threats and guidance from the Common Weakness Enumeration website and the OWASP Cheat Sheet series.

Public method parameters should be validated for nullness, unexpected values, and malicious values. Invalid or malicious input can compromise the system's safety.


ida_script.py Línea: 167

Security

If you do not have absolute control over the contents of the string passed to the eval() function, they might be maliciously used to execute an arbitrary function such as __import__('os').system("rm -rf $HOME"). If the string is expected to only contain literals, consider using the ast.literal_eval() method to safely evaluate strings containing Python values from untrusted sources.

Learn more

Running scripts generated from unsanitized inputs (for example, evaluating expressions that include user-provided strings) can lead to malicious behavior and inadvertently running code remotely.


pwndbg/wrappers/__init__.py Líneas: 3-4

Security

Consider possible security implications associated with STDOUT module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/lib/version.py Líneas: 2-4

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/cymbol.py Línea: 21

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/heap/ptmalloc.py Línea: 2163

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/gdblib/file.py Línea: 62

Security

Use of insecure and deprecated function (mktemp). https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b306-mktemp-q

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/wrappers/checksec.py Líneas: 1-2

Security

Consider possible security implications associated with CalledProcessError module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


ida_script.py Línea: 167

Security

Use of possibly insecure function - consider using safer ast.literal_eval. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_calls.html#b307-eval

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/ida.py Línea: 290

Security

Use of possibly insecure function - consider using safer ast.literal_eval. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_calls.html#b307-eval

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/version.py Línea: 11

Security

Consider possible security implications associated with check_output module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/comments.py Línea: 55

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.

pwndbg/gdblib/memory.py Línea: 112

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/shell.py Línea: 70

Security

Starting a process without a shell. https://bandit.readthedocs.io/en/latest/plugins/b606\_start\_process\_with\_no_shell.html

Constructing operating system or shell commands with unsanitized user input can lead to inadvertently running malicious code.


pwndbg/wrappers/__init__.py Línea: 2

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/gdblib/qemu.py Línea: 94

Security

Try, Except, Continue detected. https://bandit.readthedocs.io/en/latest/plugins/b112\_try\_except_continue.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/attachp.py Línea: 4

Security

Consider possible security implications associated with CalledProcessError module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/ropper.py Línea: 2

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/attachp.py Líneas: 5-6

Security

Consider possible security implications associated with check_output module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/heap/ptmalloc.py Línea: 1270

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/reload.py Línea: 25

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/rop.py Línea: 3

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/gdblib/vmmap.py Línea: 316

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/gdblib/symbol.py Línea: 244

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/radare2.py Líneas: 2-3

Security

Consider possible security implications associated with subprocess module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/nearpc.py Línea: 207

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/ida.py Línea: 26

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/__init__.py Línea: 174

Security

Try, Except, Pass detected. https://bandit.readthedocs.io/en/latest/plugins/b110\_try\_except_pass.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


pwndbg/commands/version.py Línea: 10

Security

Consider possible security implications associated with check_call module. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b404-import-subprocess

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/search.py Línea: 199

Security

Try, Except, Continue detected. https://bandit.readthedocs.io/en/latest/plugins/b112\_try\_except_continue.html

Improper error handling can enable attacks and lead to unwanted behavior. Parts of the system may receive unintended input, which may result in altered control flow, arbitrary control of a resource, or arbitrary code execution.


ida_script.py Línea: 8

Security

Using escape to parse untrusted XML data is known to be vulnerable to XML attacks. Replace escape with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called. https://bandit.readthedocs.io/en/latest/blacklists/blacklist\_imports.html#b406-import-xml-sax

APIs that are not recommended were found. This could indicate a deeper problem in the code.


pwndbg/commands/ida.py Línea: 118

Security

Problem This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix Consider closing the resource returned by the following method call: open. The resource is allocated by call builtins.open. Execution paths that do not contain closure statements were detected. To prevent this resource leak, close the object returned by open() in a try-finally block or declare it using a with statement.

More info View details about the with statement in the Python developer's guide (external link).

Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.


pwndbg/gdblib/file.py Línea: 62

Security

Creating temporary files with tempfile.mktemp() has known security vulnerabilities. We recommend using the tempfile.NamedTemporaryFile() API and passing it the delete=False parameter to create temporary files. For more information, see Generate temporary files and directories and CWE-377.

Insecure ways of creating temporary files and directories can lead to race conditions (which can be exploited for denial of service attacks) and other security vulnerabilities such as privilege escalation.


disconnect3d added a commit that referenced this issue Jan 4, 2023
* lib/memory.py: use 'if collection' instead of 'if len(collection) > 0'

* commands/__init__.py: use 'not line' instead of 'len(line)==0'

* hexdump.py: use 'not data' instead of 'len(data)==0'

* commands/nearpc.py: use `if p` instead of `if len("%s" % p)>0`

I double checked that this works fine:
```
pwndbg> set nearpc-branch-marker-contiguous
Set contiguous branch marker line for nearpc command to ''.
pwndbg> pi str(pwndbg.commands.nearpc.nearpc_branch_marker_contiguous)
''
pwndbg> pi bool(pwndbg.commands.nearpc.nearpc_branch_marker_contiguous)
False
```
@disconnect3d
Copy link
Member

I've looked at some of these in the past and fixed some of these, but I just don't have time to go through all these.

Also, most of these are false positives.

I am going to close this issue. If you want to help us and fix some of these reported issues, please read the code around them carefully and send a pull request if they are a true positive bug.

@disconnect3d disconnect3d added wontfix and removed feature For new features labels Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants